diff --git a/algorithm/mot/sv_mot.cpp b/algorithm/mot/sv_mot.cpp index 73701c3..4e26283 100644 --- a/algorithm/mot/sv_mot.cpp +++ b/algorithm/mot/sv_mot.cpp @@ -195,7 +195,7 @@ void SORT::update(TargetsInFrame& tgts) tracklet.age = 0; tracklet.hits = 1; tracklet.misses = 0; - tracklet.frame_id=tgts.frame_id; + tracklet.frame_id = tgts.frame_id; tracklet.tentative = true; // initate the motion pair, Matrix > motion = kf.initiate(tracklet.bbox); @@ -245,13 +245,13 @@ void SORT::update(TargetsInFrame& tgts) int detectionIndex = match.second; if (trackletIndex >= 0 && detectionIndex >= 0) { - if (iouMatrix[match.first][match.second] >= _iou_threshold)//iou_thrshold + if (iouMatrix[match.first][match.second] >= _iou_threshold) // iou_thrshold { sv::Box box; tgts.targets[detectionIndex].getBox(box); this->_tracklets[trackletIndex].age = 0; this->_tracklets[trackletIndex].hits++; - this->_tracklets[trackletIndex].frame_id=tgts.frame_id; + this->_tracklets[trackletIndex].frame_id = tgts.frame_id; this->_tracklets[trackletIndex].bbox << box.x1, box.y1, box.x2-box.x1, box.y2-box.y1; auto[mean, covariance] = kf.update(this->_tracklets[trackletIndex].mean, this->_tracklets[trackletIndex].covariance, box); @@ -264,7 +264,7 @@ void SORT::update(TargetsInFrame& tgts) } } // create new tracklets for unmatched detections - for (int i = 0; i < tgts.targets.size(); i++) + for (int i=0; i features; Eigen::Matrix mean; diff --git a/samples/test/eval_mAP_on_coco_val/coco_eval.py b/samples/test/eval_mAP_on_coco_val/coco_eval.py index 39de0ed..cf13271 100644 --- a/samples/test/eval_mAP_on_coco_val/coco_eval.py +++ b/samples/test/eval_mAP_on_coco_val/coco_eval.py @@ -11,19 +11,19 @@ if __name__ == '__main__': # use COCO API to load forecast results and annotations cocoGt = COCO(anno_json) with open(pred_json,'r') as file: - data = json.load(file) + data = json.load(file) # align anno_json with pred_json category_id gtCatDicts = {} for anns in range(len(cocoGt.getCatIds())): - gtCatDicts[anns] = cocoGt.getCatIds()[anns] + gtCatDicts[anns] = cocoGt.getCatIds()[anns] pdCatIds=list(set([d['category_id'] for d in data])) if not set(pdCatIds).issubset(set(cocoGt.getCatIds())): for ins in data: - temp = int(gtCatDicts[ins['category_id']]) - ins['category_id'] = temp + temp = int(gtCatDicts[ins['category_id']]) + ins['category_id'] = temp # load prediction results cocoDt = cocoGt.loadRes(data) diff --git a/samples/test/eval_mAP_on_coco_val/eval_mAP_on_coco_val.cpp b/samples/test/eval_mAP_on_coco_val/eval_mAP_on_coco_val.cpp index 12f6339..426fc0e 100644 --- a/samples/test/eval_mAP_on_coco_val/eval_mAP_on_coco_val.cpp +++ b/samples/test/eval_mAP_on_coco_val/eval_mAP_on_coco_val.cpp @@ -8,17 +8,21 @@ using namespace cv; //extract name std::string GetImageFileName(const std::string& imagePath) { - size_t lastSlash = imagePath.find_last_of("/\\"); - if (lastSlash == std::string::npos) { - return imagePath; - } else { - std::string fileName = imagePath.substr(lastSlash + 1); - size_t lastDot = fileName.find_last_of("."); - if (lastDot != std::string::npos) { - return fileName.substr(0, lastDot); - } - return fileName; + size_t lastSlash = imagePath.find_last_of("/\\"); + if (lastSlash == std::string::npos) + { + return imagePath; + } + else + { + std::string fileName = imagePath.substr(lastSlash + 1); + size_t lastDot = fileName.find_last_of("."); + if (lastDot != std::string::npos) + { + return fileName.substr(0, lastDot); } + return fileName; + } } @@ -60,8 +64,8 @@ int main(int argc, char *argv[]) } - for (int i = 0; i < val_image.size(); i++) { - + for (int i = 0; i < val_image.size(); i++) + { //create pred file std::string val_image_name = GetImageFileName(val_image[i]); std::string filename = folder+"/"+ val_image_name + ".txt"; @@ -84,11 +88,12 @@ int main(int argc, char *argv[]) // reslusts for (int j = 0; j < tgts.targets.size(); j++) { - sv::Box b; - tgts.targets[j].getBox(b); - file<