add auto binarythres fix logic

This commit is contained in:
cyy_mac
2026-03-26 06:36:54 +08:00
parent 9d43dce425
commit 998c3414b2

View File

@@ -624,7 +624,12 @@ void ArmorYoloDetectorNode::performBinaryThresCalibration(
// Get YOLO detection for ROIs
auto yolo_objects = detector_->detectRaw(img);
// If YOLO doesn't detect anything, stop calibration this frame
// Calibration will resume when YOLO detects again
if (yolo_objects.empty()) {
FYT_INFO("armor_yolo_detect", "Calibration: waiting for YOLO detection...");
calib_frame_count_ = 0; // Reset counter when YOLO loses detection
return;
}
@@ -707,10 +712,11 @@ void ArmorYoloDetectorNode::performBinaryThresCalibration(
}
}
// Update binary threshold with optimal value
// Only count frames where we got valid YOLO detection
calib_frame_count_++;
FYT_INFO("armor_yolo_detect", "Calibration progress: {}/10", calib_frame_count_);
if (calib_frame_count_ >= 10) {
// Use median of recent errors to confirm stable calibration
calib_done_ = true;
detector_->binary_thres = best_thres;