fix minor bugs in REID re-track; add detection lost then detect mechanism;

lost了会在附近的pixel截取放大再做yolo,还不行就算了
This commit is contained in:
hjy
2026-04-16 22:25:51 +08:00
parent 7163663118
commit ab32e12c58
4 changed files with 215 additions and 40 deletions
+15 -1
View File
@@ -26,6 +26,9 @@ struct TargetObservationConfig {
float min_depth = 0.5f;
float max_depth = 12.0f;
float search_radius_px = 25.0f;
bool lost_detection_compensation_enabled = true;
float lost_detection_roi_scale = 2.0f;
int lost_detection_roi_min_size_px = 192;
bool reid_enabled = false;
std::string reid_engine_path;
float reid_match_threshold = 0.65f;
@@ -73,6 +76,8 @@ struct TargetObservationDebugInfo {
bool selected_from_center_bootstrap = false;
bool reid_attempted = false;
bool recovered_by_reid = false;
bool lost_detection_compensation_attempted = false;
bool recovered_by_lost_detection_compensation = false;
float reid_similarity = -1.0f;
float yolo_ms = 0.0f;
float mot_ms = 0.0f;
@@ -104,6 +109,13 @@ public:
private:
Eigen::MatrixXf format_detections(
const std::vector<yolos::pose::PoseResult>& poses) const;
std::vector<yolos::pose::PoseResult> detect_poses_with_lost_compensation(
const cv::Mat& camera_bgr,
TargetObservationDebugInfo* debug_info) const;
cv::Rect build_lost_detection_roi(const cv::Size& image_size) const;
static void offset_poses(
std::vector<yolos::pose::PoseResult>& poses,
const cv::Point& offset);
TargetObservation select_target(
const cv::Mat& camera_bgr,
@@ -123,7 +135,7 @@ private:
int recover_target_with_reid(
const cv::Mat& camera_bgr,
const Eigen::MatrixXf& tracks,
const std::vector<yolos::pose::PoseResult>& poses,
float* best_similarity) const;
void update_target_gallery(
const cv::Mat& camera_bgr,
@@ -140,6 +152,8 @@ private:
TrackGallery target_gallery_;
int current_target_id_ = -1;
int current_raw_track_id_ = -1;
cv::Rect last_target_bbox_;
bool has_last_target_bbox_ = false;
int64_t frame_index_ = 0;
int lost_track_frames_ = 0;
bool initialized_ = false;