How to set the config file of sgie of multi label classifier?

Hi @489536658,
Could you clarify what you expect? Or, could you show what 's the correct output with DS4.0?

Thanks!

Hi, mchi,


now, the NvDsClassifierMetaList header is always null, or the NvDsClassifierMetaList is empty.
The expected result is that NvDsClassifierMetaList is not empty, and the code in for loop can be executed.

Hi, mchi, is there any news about the test?
Thanks!

sorry, team is OOTO recently, will get back to you with some delay.

Hi @489536658,
Since there is not label file in config_infer_secondary_person.txt, in below attach_metadata_classifier() function, NvDsClassifierMeta can’t be configued due to – object_info.label.length() == 0 .

File: /opt/nvidia/deepstream/deepstream/sources/gst-plugins/gst-nvinfer/gstnvinfer_meta_utils.cpp
    void
    attach_metadata_classifier (GstNvInfer * nvinfer, GstMiniObject * tensor_out_object,
        GstNvInferFrame & frame, GstNvInferObjectInfo & object_info)
    {
      NvDsObjectMeta *object_meta = frame.obj_meta;
      NvDsBatchMeta *batch_meta = (nvinfer->process_full_frame) ?
        frame.frame_meta->base_meta.batch_meta : object_meta->base_meta.batch_meta;

      if (object_info.attributes.size () == 0 ||
              object_info.label.length() == 0)
        return;

Ok, thanks!

Hi, mchi, in the comment of config file, the label file propety is optional, so is it ok without label file?

From the code I showd above, it’s not.
Could you give the label file and check again?

Hi, mchi, i have no label file, because the label file’s format of a multi label classifier is unknown

Hi @489536658,
Besides giving the label file, also need to set “process-mode=2” in config_infer_secondary_person.txt, otherwise, classifier gie will inference on full frame instead of the detected objects.

So, if you add below two lines in “config_infer_secondary_person.txt”, NvDsClassifierMetaList will not be NULL. However, you need to update labels.txt according to your model.

process-mode=2
labelfile-path=../../../../samples/models/Secondary_CarColor/labels.txt

Hi, mchi, could you tell me the label file’s format of a multi label classifier rather than that of single label classifier?

can you please try the format as …/…/…/…/samples/models/Secondary_CarColor/labels.txt ?

Hi, mchi, the Secondary_CarColor is a single label classifier, the label file of which is totally different from that of a multi label classifier, is there no exmaple label file of multi label classifier provided by Deepstream group?

please check code below from - /opt/nvidia/deepstream/deepstream-5.0/sources/libs/nvdsinfer/nvdsinfer_context_impl_output_parsing.cpp, the content of m_Labels is from the label file, attr.attributeIndex is the class, attr.attributeValue is the attribute of the class

bool
ClassifyPostprocessor::parseAttributesFromSoftmaxLayers(
std::vector const& outputLayersInfo,
NvDsInferNetworkInfo const& networkInfo, float classifierThreshold,
std::vector& attrList, std::string& attrString)
{

if (attrFound)
{
if (m_Labels.size() > attr.attributeIndex &&
attr.attributeValue < m_Labels[attr.attributeIndex].size())
attr.attributeLabel =
m_Labels[attr.attributeIndex][attr.attributeValue].c_str();
else
attr.attributeLabel = nullptr;
attrList.push_back(attr);
if (attr.attributeLabel)
attrString.append(attr.attributeLabel).append(" ");
}

}

label-sgie-person.txt (512 Bytes)

Hi, mchi, the attached file is our prepared label file, and now, the sgie of multi label classifier works fine, but the value of the attribute “num_classes” is always zero, could you please make a test?

what make you think num_classes must be non-zero?

Hi, mchi, according to the comment

Hi @489536658,
Confirmed that num_classes is not used now, it will be removed in future.

Thanks!

Hi, mchi, got it, thanks for your all replies!

Hey!
I’m trying to build a multilabel detector for my Jetson Xavier: from labeling the data, train the model (maybe in tlt?) and running it on deepstream.
Can you give me a guide, documentation or brief description? I’ve never done a model like this before!
Thanks in advance!