From dd298266200f15b150dd588ec697594c9a1b9e2b Mon Sep 17 00:00:00 2001 From: Sergei Nikolaev Date: Wed, 27 Feb 2019 21:02:54 -0800 Subject: [PATCH] SSD&FP16 converges --- src/caffe/util/bbox_util.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/caffe/util/bbox_util.cpp b/src/caffe/util/bbox_util.cpp index 37c4f959cea..a9e7408d9db 100644 --- a/src/caffe/util/bbox_util.cpp +++ b/src/caffe/util/bbox_util.cpp @@ -1065,10 +1065,9 @@ void GetGroundTruth(const Dtype* gt_data, const int num_gt, if (item_id == -1) { continue; } - int label = gt_data[start_idx + 1]; - if (is_precise()) { - CHECK_NE(background_label_id, label) << "Found background label in the dataset."; - } else if (background_label_id == label) { + int label = std::round(gt_data[start_idx + 1]); + if (label <= background_label_id) { + DLOG(WARNING) << "Ignoring background label in the dataset: " << gt_data[start_idx + 1]; continue; } bool difficult = static_cast(gt_data[start_idx + 7]); @@ -1112,9 +1111,11 @@ void GetGroundTruth(const Dtype* gt_data, const int num_gt, break; } NormalizedBBox bbox; - int label = gt_data[start_idx + 1]; - CHECK_NE(background_label_id, label) - << "Found background label in the dataset."; + int label = std::round(gt_data[start_idx + 1]); + if (label <= background_label_id) { + DLOG(WARNING) << "Ignoring background label in the dataset: " << gt_data[start_idx + 1]; + continue; + } bool difficult = static_cast(gt_data[start_idx + 7]); if (!use_difficult_gt && difficult) { // Skip reading difficult ground truth.