Problems of classes with a custum Yolo on Deepstream

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
Jetson nano
• DeepStream Version
4.0.2
• JetPack Version (valid for Jetson only)
4.2
• TensorRT Version

• NVIDIA GPU Driver Version (valid for GPU only)

Hi,

I have some trouble with deepstream.

I trained a Yolov3-tiny on darknet with specific classes :

person
wheelchair
bicycle
motorcycle
car
bus
truck
ambulance
traffic light
stop sign
cedez le passage
shoes
sports ball
traffic cones

As you can see it contains some classes of the COCO dataset but not only them, and not in the same order.

I trained on darknet, and It worked : I took somes pictures to verify it :

Then I took the .cfg .weight and .names for deepstream (I uses deepstream 4.0).

I changed the number of classes in nvdsparsebbox_Yolo.cpp, and I compiled it.

I also created a config_infer_primary… and deepstream_app_config… and configure it well (right number of classes, right sources)

I changed my .names for labels.txt

And I tried Yolo_Deepstream

I don’t understand my results :

For now The video I used let me saw theses objects :

person
car
bicycle
wheelchair

but i detect this :

person is detected as person
car is detected as bicycle
bicycle is detected as wheelchair
wheelchair is detected as…wheelchair.

I really don’t know where is the problem, It works on darknet, and I didn’t modify the order.
Plus, first I thought that some classes were inversed, with car->bicycle and bicycle->wheelchair, but wheelchair->wheelchair!

Do you know where the problem can be in deepstream?

Sincerely,

I ask again about this post beacuse I really don’t know how to correct this problem.

I’m still searching, does anyone know how to contact someone who know well how works deepstream?

Seems you need to change the label file based on your class id

Hi @bcao,

What do you mean by the label file base?
Do you mean the label.txt that is needed to know the names of the classes of what you want to detect?
The one you have to take from darknet (the file “xxxx.names”) and replace it by label.txt in the Yolo-Deepstream repository?
If you’re talking about this file, I changed it, or maybe there’s another one that I need to change, elsewhere in deepstream?

Sincerely

There is a “labelfile-path” in your nvinfer config file, you need to make sure the order of the class names in that label file the same as the order of your classes

If it cannot work, can you share your config files with me?

Hi @bcao, I’m not sure I have a file with that name, I searched it in the repository of Yolo-Deepstream, is it elsewhere?
Here’s my config files.
config_infer_primary_yoloV3_tiny-obj.txt (459 Bytes) deepstream_app_config_yoloV3_tiny-obj.txt (1.5 KB) labels.txt (148 Bytes)

Check following item “labelfile-path=labels.txt” in your config_infer_primary_yoloV3_tiny-obj.txt

[property]
gpu-id=0
net-scale-factor=1
model-color-format=0
custom-network-config=yolov3-tiny-obj.cfg
model-file=yolov3-tiny-obj_75000.weights
model-engine-file=model_b1_fp32.engine
labelfile-path=labels.txt
batch-size=1
network-mode=0
num-detected-classes=14
gie-unique-id=1
process-mode=1
is-classifier=0
maintain-aspect-ratio=1
parse-bbox-func-name=NvDsInferParseCustomYoloV3Tiny
custom-lib-path=nvdsinfer_custom_impl_Yolo/libnvdsinfer_custom_impl_Yolo.so

Hi @bcao, about the line :
labelfile-path=labels.txt

It takes the file that is in the same directory that config_infer_primary_yoloV3_tiny-obj.txt, right?

The file labels.txt that is in the same directory than config_infer_primary_yoloV3_tiny-obj.txt is the file I sent you, and it shows the 14 classes to detect, in the right order (it’s the same file as xxx.names that I used on darknet).

Can you check the class id of your model output and make sure they match the label file.
such as class id = 1 is car, class id = 2 is person, then the label file should be

car
person

Hi @bcao, what do you mean by “model output”?
Because the only place I know where I can modify something about the labels is labels.txt

If you’re talking about this file I didn’t change it between deepstream and darknet but :

-When I try YOLO on darknet, with the same video, it’s working, car = car, bicycle = bicycle.

-The problem I have seems illogical, because i have car = bicycle, bicycle = wheelchair, BUT wheelchair = wheelchair! And I verified before, it’s not that YOLO thinks a car is bicycle, it’s just a problem of label (in darknet it knows that is a car, so it’s like just a string that is misplaced).

I thought that was a problem about the number of classes, but I followed the pdf given by nvidia about how to custom YOLO, and I modified the number of classes in the programmation and in the configuation file of deepstream.

model output means the raw output of your output layer in your model.
I think you can debug the issue in the post process parser in DS to check the class id, it should be simple.
You can share your setup with me if you need further help.

Hi @bcao,
what is the name of the file(s) where I can find this?
Actually I didn’t found how to debug in Deepstream 4.0, what files do you need from my deepstream? The files I changed are one file in C langage about YOLO, in order to modify the number of classes, the three files I sent you, and the .cfg and the .weights of YOLO.

The post process parser function should be “parse-bbox-func-name=NvDsInferParseCustomYoloV3Tiny” , Pls go through the https://docs.nvidia.com/metropolis/deepstream/custom_yolo_model_in_the_deepstream_yolo_app.pdf