I was wondering if there is a way to make the DetectNet display run faster? I am running a program that sends information from DetectNet to an arduino and I am pretty sure I have debugged everything and the code works. Every time I launch the python script, the detectNet display either opens and runs at 1 fps before freezing, or it tries to open and I get this:
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:656 Failed to create CaptureSession
[gstreamer] gstCamera – end of stream (EOS)
Hi @jpurpura37, does detectnet.py run ok on your system before the modifications?
It appears you are creating a new Serial interface on every iteration of the main loop. You also create a Serial interface up above, at initialization time (which should be the correct time to do it). You probably should only create the arudino = serial.Serial(...) interface once at the beginning.
Also, add some timing around the arduino.write() call to see if it is blocking the execution for extended periods of time. If it is, you should run that from a separate Python thread.
I think re-initializing the port was the issue, not sure why I was doing that so thanks for pointing that out. Also, it looks like in order to add timing functions I have to import a time module. Where would be a good place to get that?
Near the top where the other modules are imported - in Python, it’s a best practice to import the modules at the beginning of the script (although not strictly required)