Can't detect only my labels in transfer learning-built model

Hello there,

I have trained an object detection model in which there is only one label-‘plant’ because of a project I am currently doing.

I need a live feed from the camera to detect plants and later i will use plants to navigate in a garden.

But using the code to turn on my camera and detect objects i am also getting detections like person box etc which i don’t need and might be an obstacle for navigation. Basically, the way i trained the model i am not getting those outputs but rather getting them all together. But this doesn’t happen when i use the command prompt. But only takes place when i am using python. The code and all the screenshots are posted below.

Just to be clear i want to know how can use the model in python with video source /dev/video0

Thank you in advance. The forum has been really helpful to me.

the image was taken from the recorded video using the command line: detectnet --model=models/model0110/ssd-mobilenet.onnx --label=models/model0110/labels.txt --input-blob=input_0 --output-cvg=scores --output-bbox=boxes /home/nano/garden/test.mp4

code that i am using:
import jetson.inference
import jetson.utils


while True:
display.SetStatus(“Object Detection |Network {:.0f} FPS”.format(net.GetNetworkFPS()))

@dusty_nv i followed your video. But labeled it with labelimg. This is the output what i get if i run the video as my videoSource in python. The code is also your’s. Please let me know what i am doing wrong.

And I dont know why my data folder is empty.

Hi @adnan.f.a, if you pull the master branch of jetson-inference, there is a newer API for creating detectNet in Python with paths to custom models: jetson-inference/ at 9ee9a950a80fbc7597d7e78a7ba0a282e85fae78 · dusty-nv/jetson-inference · GitHub

net = detectNet(model="model/ssd-mobilenet.onnx", labels="model/labels.txt", 
                 input_blob="input_0", output_cvg="scores", output_bbox="boxes", 

Otherwise to use your existing code with argv method, try it like this instead (it looks like there were some typos with your original code):

'--input_blob=input_0', '--output_cvg=scores', '--output_bbox=boxes'],threshold=0.5)

If that still doesn’t work, please post the console log of running your Python script.

1 Like

Great the existing code worked. For the first one i got an error:
Traceback (most recent call last):
File “”, line 4, in
net = detectNet(model=“model/ssd-mobilenet.onnx”, labels=“model/labels.txt”,
NameError: name ‘detectNet’ is not defined
Thanks a lot. It means a lot to me when you guys help me out.

No problem, glad you got it working! You probably need to change it to jetson.inference.detectNet() – but unless you cloned/installed jetson-inference master within the past couple months (IIRC), that newer way may not work.

1 Like