How to raise an alarm from a GPIO pin of Jetson Nano once an object is detected?

Hello everyone! I want to say that I have a trained YOLOv4-416 custom model on one class and I have converted the yolo weights to tensorRT format with the help of @jkjung13. Special thanks to him and now I am able to do real time detection using a usb webcam at 4 FPS but now there is one last thing which remains that I want to raise an alarm from a GPIO pin of Jetson Nano once an object is detected. So how can I do that? Kindly anybody who can help @dusty_nv ?

hello farjadhaider3253,

suppose there’s an software events once an object is detected,

you may refer to Jetson GPIO, it’s a Python library that enables the use of GPIOs. please check the sample python scripts, i.e. button_event.py for reference;
or, you may refer to Jetson-Nano GPIO example to directly read/write through /dev/mem

please also check similar discussion thread, Topic 144550 for reference.
thanks

@JerryChang. I have attached a code below that I am using for real time detection on Nano using USB webcam and custom YOLOv4-416 model trained on single class. Have a look at the code and in that code there is a function i.e. loop_and_detect(). I think there is something that can be added in that code. Do you have any idea?trt_yolo.txt (3.6 KB)