Does Post Training Quantization needs Lables also?

Dear Team,

I have a doubt regarding the Batchstream class used in sample of SampleSSD Application in TensorRT samples folder.
I saw Batchstream class reading label files also as seen in the below snippet:

if (mListFile.empty())
        {
            std::string inputFileName = locateFile(mPrefix + std::to_string(mFileCount++) + mSuffix, mDataDir);
            FILE* file = fopen(inputFileName.c_str(), "rb");
            if (!file)
            {
                return false;
            }

            int d[4];
            size_t readSize = fread(d, sizeof(int), 4, file);
            ASSERT(readSize == 4);
            ASSERT(mDims.d[0] == d[0] && mDims.d[1] == d[1] && mDims.d[2] == d[2] && mDims.d[3] == d[3]);
            size_t readInputCount = fread(getFileBatch(), sizeof(float), mDims.d[0] * mImageSize, file);
            ASSERT(readInputCount == size_t(mDims.d[0] * mImageSize));
            size_t readLabelCount = fread(getFileLabels(), sizeof(float), mDims.d[0], file);
            ASSERT(readLabelCount == 0 || readLabelCount == size_t(mDims.d[0]));

            fclose(file);
        }

I want to understand, if we need labels also for implementing calibrator(PTQ) in the C++ Application of TensorRT.

Thanks and Regards,
Vyom Mishra

Gentle Reminder!

Hi,

Labels are not required for the Calibration.
Please refer to Developer Guide :: NVIDIA Deep Learning TensorRT Documentation for more details.

Thank you.

Dear Sir,
Thanks for your reply!

I too read the same in the documentation, but when i was looking into the implementation of class BatchStream in sampleSSD application, i found it is reading Lables also. you can check the snippet shared above.

Can you please help me to understand why the above snippet has label reading code.

Regards,
Vyom Mishra

Hi,

Class BatchStream is only used by the calibrators and therefore doesn’t need to use the labels. I think the above one is a mistake. Hope you’re referring to the correct sample code.

Thank you.