deepstream-lpr-python-version icon indicating copy to clipboard operation
deepstream-lpr-python-version copied to clipboard

Sgie’s detecting properly but classifier_meta_list is None

Open monitarb opened this issue 3 years ago • 7 comments

Hey, first of all, thanks for doing this in Python!

I'm trying to replicate this in my Jetson NX with a couple of changes:

  • My pgie model is the 4-classes model used on python-apps
  • My sgie model detects mask/not_mask so it operates on people (class "person")
  • I do not need a ROI in my case nor the OCR model for LP Text extraction... So I made the changes needed on the code and to my config files. I can see the mask/not mask Bounding Boxes in my display, but I can't get ahold of the metadata inside the code. This is: obj_meta.classifier_meta_list is always None. I have changed the inside of the if condition to check this:
l_class = obj_meta.classifier_meta_list
while l_class is not None:
	print("There's SOME metadata!")

And I can see the sgies bounding boxes on the display, inside some person's bounding boxes, but I NEVER see my "There's SOME metadata!" message. I did this test because I need the metadata of my sgie inside l_class. Have you come across this? What could be the issue?

monitarb avatar May 11 '21 17:05 monitarb

Hi, there is some issue regarding fetching classifier metadata that I have observed. l_class gives data for this LPR and for the caffemodels (the ones in test-app2 regarding car color, make and model). But for some reason it gives None for other classifiers. There are some etlt classifiers in NVIDIA NGC which I tried as secondary but they also gave l_class = None. I havent had the chance to explore it more or raise the issue in the forum. Maybe you should try posting the question in the forum.

preronamajumder avatar May 11 '21 17:05 preronamajumder

Hey there! I think I made some progress on my side, but now I've come to another block I hope you could help me: In my case classifier_meta_list is None because my sgie is not a classifier. My pipeline is: pgie (detector:4 classes) -> tracker -> sgie (detector on class Person: Mask, helmet, boots) It would like if, in your example, your sgie1 looked for licence plate, lights and wheels on the class Car... right? I believe I'm looking for the metadata of my sgie in the wrong place since classifier_meta_list gives the metadata of the classifier (In your case, the letters of the licence plate). Now, since I don't have a classifier, any idea where to get the metadata from the sgie1 (detector) from the probe?

monitarb avatar Jun 29 '21 16:06 monitarb

If you put the following you can single out data from individual gie. for primary you should do the following:

if obj_meta.unique_component_id == 1:
        class_id = obj_meta.class_id
        x = obj_meta.rect_params.left
        y = obj_meta.rect_params.top
        w = obj_meta.rect_params.width
        h = obj_meta.rect_params.height

for sgie it should be the following:

if obj_meta.unique_component_id == 2:
         class_id = obj_meta.class_id
         x = obj_meta.rect_params.left
         y = obj_meta.rect_params.top
         w = obj_meta.rect_params.width
         h = obj_meta.rect_params.height

the unique_component_id corresponds to the gie-unique-id provided in the primary/secondary config

This is a link to the python APIs for NvDsObjectMeta. You can see here what metadata you can extract. https://docs.nvidia.com/metropolis/deepstream/python-api/PYTHON_API/NvDsMeta/NvDsObjectMeta.html

preronamajumder avatar Jun 29 '21 20:06 preronamajumder

Thank You! This is actually what I was looking for! FYI, obj_meta gives the correct labels (either obj_meta.unique_component_id == 1 or 2) on my detector model trained on TLT! In my case (my sgie is a detector), classifier_meta_list is always None and this was Ok!

monitarb avatar Jul 13 '21 17:07 monitarb

Hi, thank you for this project. I am facing the same problem as above l_class = obj_meta.classifier_meta_list l_class is always None. Can you please help me on this?

vinodbukya6 avatar Dec 16 '21 12:12 vinodbukya6

In my case it was because my sgie was a detector model, NOT a classifier. So classifier_meta_list for it always returned None. In that case, the metadata I was looking for could be found in object_meta as well. The way to distinguish it from the metadata of pgie was using obj_meta.unique_component_id == 1 (pgie) or 2 (sgie) as @preronamajumder shows above. Good luck!

monitarb avatar Dec 16 '21 14:12 monitarb

Thank you. Yeah, in my case it should work because it is a classifier(car license plate recognization). I tried with NVIDIA reference also (https://github.com/NVIDIA-AI-IOT/deepstream_lpr_app) still facing the same issue.

vinodbukya6 avatar Dec 16 '21 14:12 vinodbukya6