classification as primary GIE where is input size specified?


when working through the examples it seems that the primary GIE is always a object detecter.
In my current setup i have a camera as input and a rtsp stream as output using a modified config from the YOLOv3 object detector in the samples. I would like to change this YOLOv3 model to a single classifier.
I have the following questions:
-how to specify input blob size of the classifer in primary-GIE
-The input image from camera is 1920*1080 and the same for the output stream, how to resize image for classifier?

it would be helpful if you can recommend or give a sample config to modify

thanks in advance


1. Network size is defined in the cfg file.
Ex. yolov2.cfg

# Testing
# Training
# batch=64
# subdivisions=8

2. The resize is applied automatically between network and stream.


The network seems to function correctly! however i can’t figure out how to display the confidence of my sigmoid output. The parse-bbox-func-name property seems to handle the displaying of this information.
Do i have to write a custom function for the parse-bbox-func-name property or is there a easier way to pass the information to the on screen display?


You can find some information in this comment:


i ended up modifying the nvdsinfer_customclassifierparser.cpp in sources/libs/nvdsinfer_customparser to write the confidence in the label field. A bit of a hacky solution but it works.

#include <cstring>
#include <iostream>
#include "nvdsinfer_custom_impl.h"

/* C-linkage to prevent name-mangling */
extern "C"
bool NvDsInferClassiferParseCustomSigmoid (std::vector<NvDsInferLayerInfo> const &outputLayersInfo,
        NvDsInferNetworkInfo  const &networkInfo,
        float classifierThreshold,
        std::vector<NvDsInferAttribute> &attrList,
        std::string &descString);

static std::vector < std::vector< std:: string > > labels { {
    "good"} };

extern "C"
bool NvDsInferClassiferParseCustomSigmoid(std::vector<NvDsInferLayerInfo> const &outputLayersInfo,
        NvDsInferNetworkInfo  const &networkInfo,
        float classifierThreshold,
        std::vector<NvDsInferAttribute> &attrList,
        std::string &descString)
    //read sigmoid probability
    float *outputCoverageBuffer = (float *)outputLayersInfo[0].buffer;
    float probability = outputCoverageBuffer[0];
    std::cout << probability << std::endl;

    //convert probability to c-style string
    std::string str =  std::to_string(probability);
    char * prob_c = new char [str.length()+1];
    std::strcpy (prob_c, str.c_str());

    //write probability to attribute label
    NvDsInferAttribute attr;
    attr.attributeLabel = prob_c;
    attr.attributeConfidence = probability;
    if (attr.attributeLabel){
        descString.append(attr.attributeLabel).append(" ");       

    return true;

/* Check that the custom function has been defined correctly */