• Hardware Platform (Jetson / GPU) GPU • DeepStream Version 6.4 • Issue Type( questions, new requirements, bugs) question
Hello,
I’m working on integrating a multi-task (multi-head) model that needs to classify both age and gender simultaneously.
labels.txt file:
text
children
teenagers
adults
seniors
male
female
Problem:
Currently, DeepStream only detects the first output (age). The default parser seems to ignore the “gender” output.
Question:
Does DeepStream natively support multi-head models with multiple outputs? If not, what is the recommended approach to parse both outputs simultaneously?
Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU) • DeepStream Version • JetPack Version (valid for Jetson only) • TensorRT Version • NVIDIA GPU Driver Version (valid for GPU only)
I’m using a custom model with multiple output heads deepstream classifier parser doesn’t seem to handle this structure and fails to parse the results correctly.
We don’t know about your model, please check whether the output layers are softmax layers. If they are not softmax layers, you may need to customize the postprocessing function by yourself.
Your label file is wrong. Please check with the function ClassifyPostprocessor::parseAttributesFromSoftmaxLayers() in /opt/nvidia/deepstream/deepstream/sources/libs/nvdsinfer/nvdsinfer_context_impl_output_parsing.cpp and the function InferPostprocessor::parseLabelsFile() in /opt/nvidia/deepstream/deepstream/sources/libs/nvdsinfer/nvdsinfer_context_impl.cpp
my output layers are not softmax layers - they are linear layers producing raw logits. I use CrossEntropyLoss and FocalLoss during training, which internally apply softmax.
I have already added softmax to the output layers and modified the label file as follows:
enfants;adolescents;adultes;seniors
male;female
However, I’m now getting incorrect results where all age predictions are classified as either “enfants” or “adultes”.
My question: How can I determine if this is a model issue or a DeepStream mapping problem? Is there a way to debug how DeepStream maps the model outputs to the labels in the label.txt file?
How did you get the model? Normally the model will be provided with the training and inferencing tools by the author. If the model itself can work with the original tool, you need to check whether your configurations in DeepStream is aligned with the parameters used in training.
The gender layer is before age layer as you configured with the nvinfer configuration, while you put the age labels before the gender labels in the label file. Please make sure they are provided by the same order. We don’t know anything about your model, please check the correct order by yourself.
There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks.