How to access labelfile_path in custom classifier parser for nvinferserver? (original) (raw)

August 18, 2025, 7:28am 1

I am working with a classification model using nvinferserver.
My config looks like this (example):

postprocess {
    labelfile_path: "./configs/labels.txt"
    classification { 
        threshold: 0.6
        custom_parse_classifier_func: NvDsInferParseClassification
    }
}

With the built-in parser, the labels from labelfile_path are automatically applied.
But when I switch to a custom parser (based on the sample code in:
/opt/nvidia/deepstream/sources/libs/nvdsinfer_customparser), I only get the raw outputs — the labels are not available.

From what I see, the function signature (NvDsInferParseClassification) does not provide access to config parameters like labelfile_path.


Question:
How can I access the labels defined in labelfile_path inside a custom parser?
If that is not possible, what is the recommended way to load labels (or the label path) in a custom parser?


Platform Details:


fanzh August 18, 2025, 3:35pm 3

I am check. will get back to you.

fanzh August 19, 2025, 5:49am 4

nvnfersever plugin and low-level lib are opensource. If custom_parse_classifier_func is set, a custom parsing function needs to be implemented. Taking this NvDsParseCustomPoseClassification for example, the content of labelfile_path can’t be accessed in this function, but you can add the defination like this code.