MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / process

Method process

quickstart/common/util.cpp:84–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84std::unique_ptr<float> RGBImageReader::process() const
85{
86 const int C = mDims.d[1];
87 const int H = mDims.d[2];
88 const int W = mDims.d[3];
89 auto buffer = std::unique_ptr<float>{new float[volume()]};
90
91 if (mPPM.h == H && mPPM.w == W)
92 {
93 for (int c = 0; c < C; c++)
94 {
95 for (int j = 0, HW = H * W; j < HW; ++j)
96 {
97 buffer.get()[c * HW + j] = (static_cast<float>(mPPM.buffer[j * C + c])/mPPM.max - mMean[c]) / mStd[c];
98 }
99 }
100 }
101 else
102 {
103 assert(!"Specified dimensions don't match PPM image");
104 }
105
106 return buffer;
107}
108
109ArgmaxImageWriter::ArgmaxImageWriter(const std::string& filename, const nvinfer1::Dims& dims, const std::vector<int>& palette, const int num_classes)
110 : ImageBase(filename, dims)

Callers 1

inferMethod · 0.45

Calls 4

volumeFunction · 0.50
getMethod · 0.45
resizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected