linghu8812 / tensorrt_inference

699 stars 205 forks source link

RetinaFace IOU compute problem #120

Open Curry-Christopher opened 2 years ago

Curry-Christopher commented 2 years ago

Hi, I have a question about the code in RetinaFace.cpp. Why the bbox computation in the IOUCalculate Class and EngineInference Class is different? It seems that (det_a.x, det_a.y) in the former is upper left coordinates, but the(face_box.x, face_box.y) in the latter is center coordinates.

float RetinaFace::IOUCalculate(const RetinaFace::FaceBox &det_a, const RetinaFace::FaceBox &det_b) { cv::Point2f center_a(det_a.x + det_a.w / 2, det_a.y + det_a.h / 2); cv::Point2f center_b(det_b.x + det_b.w / 2, det_b.y + det_b.h / 2); cv::Point2f left_up(std::min(det_a.x, det_b.x),std::min(det_a.y, det_b.y)); cv::Point2f right_down(std::max(det_a.x + det_a.w, det_b.x + det_b.w),std::max(det_a.y + det_a.h, det_b.y + det_b.h)); ... } void RetinaFace::EngineInference(const std::vector &image_list, const int &outSize, void **buffers, const std::vector &bufferSize, cudaStream_t stream) { ... cv::Rect box(rect.face_box.x - rect.face_box.w / 2, rect.face_box.y - rect.face_box.h / 2, rect.face_box.w, rect.face_box.h); ... }