linghu8812 / tensorrt_inference

702 stars 206 forks source link

nanodet wrong prepareImage #30

Open luameows opened 3 years ago

luameows commented 3 years ago

In pytorch, the model is train with BGR img order, however in tensorrt, the input is RGB order. image

luameows commented 3 years ago

also the resized img is not in the center of the blank, but top left of the blank, so the code should be changed.

rsz_img.copyTo(flt_img(cv::Rect(IMAGE_WIDTH/2 - rsz_img.cols/2, IMAGE_HEIGHT/2 - rsz_img.rows/2, rsz_img.cols, rsz_img.rows)));
DaChaoXc commented 3 years ago

resize style can change, but test results show RGB order is better than BGR order, so i use RGB order @luameows