kalfazed / tensorrt_starter

This repository give a guidline to learn CUDA and TensorRT from the beginning.
127 stars 35 forks source link

There are two errors in Section 7.3 #11

Open Fxycst1213 opened 1 month ago

Fxycst1213 commented 1 month ago

When I resize a 1920*1080 image, I noticed that there was a problem here: 1. trt_preprocess.cu:366

    366: if (src_y1 < 0 || src_x1 < 0 || src_y1 > trans.src_h || src_x1 > trans.src_w) {
    }

I think it should be:

    366: if (src_y1 < 0 || src_x1 < 0 || src_y2 >= trans.src_h || src_x2>= trans.src_w) {
    }

2. trt_detector.cpp:123:125

   123:      m_inputMemory[0][offset_ch2++] = m_inputImage.data[index + 0] / 255.0f;
   124:      m_inputMemory[0][offset_ch1++] = m_inputImage.data[index + 1] / 255.0f;
   125:      m_inputMemory[0][offset_ch0++] = m_inputImage.data[index + 2] / 255.0f;

I think it should be:

   123:     m_inputMemory[0][offset_ch2++] = tar.data[index + 0] / 255.0f;
   124:     m_inputMemory[0][offset_ch1++] = tar.data[index + 1] / 255.0f;
   125:     m_inputMemory[0][offset_ch0++] = tar.data[index + 2] / 255.0f;

Looking forward to hearing from you