Board : Jetson Nano B01
I Completed to try this program
https://github.com/dusty-nv/jetson-inference/blob/master/docs/detectnet-example-2.md
Then I tried to modify the program by adding an output in the form of a light that would light up when it detects an object via the GPIO pin on the Jetson board. With the following programs:
import Jetson.GPIO as GPIO
import jetson_inference
import jetson_utils
# Konfigurasi GPIO
lamp_pin = 12
GPIO.setmode(GPIO.BOARD)
GPIO.setup(lamp_pin, GPIO.OUT)
lamp_state = False
net = jetson_inference.detectNet("ssd-mobilenet-v2", threshold=0.5)
camera = jetson_utils.videoSource("/dev/video0")
display = jetson_utils.videoOutput()
person_count = 0
while True:
img = camera.Capture()
detection = net.Detect(img)
# Menghitung jumlah objek person
person_count = 0
for obj in detection:
if obj.ClassID == 1: # ID kelas "person"
person_count += 1
print("Jumlah objek person yang dideteksi: {}".format(person_count))
# Menyalakan lampu jika ada objek person yang dideteksi
if person_count > 0 and not lamp_state:
GPIO.output(lamp_pin, GPIO.HIGH)
lamp_state = True
print("Lampu dinyalakan")
elif person_count == 0 and lamp_state:
GPIO.output(lamp_pin, GPIO.LOW)
lamp_state = False
print("Lampu dimatikan")
display.Render(img)
display.SetStatus("Object Detection | Network {:.0f} FPS".format(net.GetNetworkFPS()))
After I entered Docker/run.sh and ran the python3 my-detection.py command, the following error occurred:
Traceback (most recent call last):
File "my-detection.py", line 1, in <module>
import Jetson.GPIO as GPIO
ModuleNotFoundError: No module named 'Jetson.GPIO'
Give me help to solve this problem