diff --git a/configs/datasets/coco_detection.yml b/configs/datasets/coco_detection.yml index 7a62c3b0b57a5d76c8ed519d3a3940c1b4532c15..614135743712b195a8d3822609d9a3c28ee60d22 100644 --- a/configs/datasets/coco_detection.yml +++ b/configs/datasets/coco_detection.yml @@ -17,3 +17,4 @@ EvalDataset: TestDataset: !ImageFolder anno_path: annotations/instances_val2017.json + dataset_dir: dataset/coco diff --git a/configs/datasets/coco_instance.yml b/configs/datasets/coco_instance.yml index 5eaf76791a94bfd2819ba6dab610fae54b69f26e..5b074b00d73ced75247b6ad56604e7c90b705c1a 100644 --- a/configs/datasets/coco_instance.yml +++ b/configs/datasets/coco_instance.yml @@ -17,3 +17,4 @@ EvalDataset: TestDataset: !ImageFolder anno_path: annotations/instances_val2017.json + dataset_dir: dataset/coco diff --git a/configs/datasets/dota.yml b/configs/datasets/dota.yml index f9d9395b00d7ed9028396044c407784d251e43e5..5153163d95a8a418a82d3d6d43f6e1f9404ed075 100644 --- a/configs/datasets/dota.yml +++ b/configs/datasets/dota.yml @@ -17,3 +17,4 @@ EvalDataset: TestDataset: !ImageFolder anno_path: trainval_split/s2anet_trainval_paddle_coco.json + dataset_dir: dataset/DOTA_1024_s2anet/ diff --git a/configs/mot/bytetrack/_base_/mot17.yml b/configs/mot/bytetrack/_base_/mot17.yml index 2efa55546026168c39396c4d51a71428e19a0638..faf47f622d1c2847a9686dfa8d7e48a49c05436c 100644 --- a/configs/mot/bytetrack/_base_/mot17.yml +++ b/configs/mot/bytetrack/_base_/mot17.yml @@ -17,6 +17,7 @@ EvalDataset: TestDataset: !ImageFolder + dataset_dir: dataset/mot/MOT17 anno_path: annotations/val_half.json diff --git a/configs/mot/deepsort/_base_/mot17.yml b/configs/mot/deepsort/_base_/mot17.yml index 2efa55546026168c39396c4d51a71428e19a0638..faf47f622d1c2847a9686dfa8d7e48a49c05436c 100644 --- a/configs/mot/deepsort/_base_/mot17.yml +++ b/configs/mot/deepsort/_base_/mot17.yml @@ -17,6 +17,7 @@ EvalDataset: TestDataset: !ImageFolder + dataset_dir: dataset/mot/MOT17 anno_path: annotations/val_half.json diff --git a/ppdet/data/source/category.py b/ppdet/data/source/category.py index 9390e54c4ce5dacce4674363689b629261c787c6..2c366968a439088bbec66ad2fc5ac182daea199c 100644 --- a/ppdet/data/source/category.py +++ b/ppdet/data/source/category.py @@ -39,6 +39,11 @@ def get_categories(metric_type, anno_file=None, arch=None): if arch == 'keypoint_arch': return (None, {'id': 'keypoint'}) + if anno_file == None or (not os.path.isfile(anno_file)): + logger.warning("anno_file '{}' is None or not set or not exist, " + "please recheck TrainDataset/EvalDataset/TestDataset.anno_path, " + "otherwise the default categories will be used by metric_type.".format(anno_file)) + if metric_type.lower() == 'coco' or metric_type.lower( ) == 'rbox' or metric_type.lower() == 'snipercoco': if anno_file and os.path.isfile(anno_file): @@ -55,8 +60,9 @@ def get_categories(metric_type, anno_file=None, arch=None): # anno file not exist, load default categories of COCO17 else: if metric_type.lower() == 'rbox': + logger.warning("metric_type: {}, load default categories of DOTA.".format(metric_type)) return _dota_category() - + logger.warning("metric_type: {}, load default categories of COCO.".format(metric_type)) return _coco17_category() elif metric_type.lower() == 'voc': @@ -77,6 +83,7 @@ def get_categories(metric_type, anno_file=None, arch=None): # anno file not exist, load default categories of # VOC all 20 categories else: + logger.warning("metric_type: {}, load default categories of VOC.".format(metric_type)) return _vocall_category() elif metric_type.lower() == 'oid': @@ -104,6 +111,7 @@ def get_categories(metric_type, anno_file=None, arch=None): return clsid2catid, catid2name # anno file not exist, load default category 'pedestrian'. else: + logger.warning("metric_type: {}, load default categories of pedestrian MOT.".format(metric_type)) return _mot_category(category='pedestrian') elif metric_type.lower() in ['kitti', 'bdd100kmot']: @@ -122,6 +130,7 @@ def get_categories(metric_type, anno_file=None, arch=None): return clsid2catid, catid2name # anno file not exist, load default categories of visdrone all 10 categories else: + logger.warning("metric_type: {}, load default categories of VisDrone.".format(metric_type)) return _visdrone_category() else: diff --git a/ppdet/metrics/mcmot_metrics.py b/ppdet/metrics/mcmot_metrics.py index 5bcfb923470a1f94a2bd951fb721221a8f339354..48d15c90e6512eb8943ca3ee224ac92b2795453c 100644 --- a/ppdet/metrics/mcmot_metrics.py +++ b/ppdet/metrics/mcmot_metrics.py @@ -26,8 +26,6 @@ from motmetrics.math_util import quiet_divide import numpy as np import pandas as pd -import paddle -import paddle.nn.functional as F from .metrics import Metric import motmetrics as mm import openpyxl @@ -311,7 +309,9 @@ class MCMOTEvaluator(object): self.gt_filename = os.path.join(self.data_root, '../', 'sequences', '{}.txt'.format(self.seq_name)) - + if not os.path.exists(self.gt_filename): + logger.warning("gt_filename '{}' of MCMOTEvaluator is not exist, so the MOTA will be -inf.") + def reset_accumulator(self): import motmetrics as mm mm.lap.default_solver = 'lap' diff --git a/ppdet/metrics/mot_metrics.py b/ppdet/metrics/mot_metrics.py index 85cba3630cd428478175ddc6347db4152d47a353..af2f7dd19c801cfe2c34d86c6c77ed4816b6fbec 100644 --- a/ppdet/metrics/mot_metrics.py +++ b/ppdet/metrics/mot_metrics.py @@ -22,8 +22,7 @@ import sys import math from collections import defaultdict import numpy as np -import paddle -import paddle.nn.functional as F + from ppdet.modeling.bbox_utils import bbox_iou_np_expand from .map_utils import ap_per_class from .metrics import Metric @@ -36,8 +35,10 @@ __all__ = ['MOTEvaluator', 'MOTMetric', 'JDEDetMetric', 'KITTIMOTMetric'] def read_mot_results(filename, is_gt=False, is_ignore=False): - valid_labels = {1} - ignore_labels = {2, 7, 8, 12} # only in motchallenge datasets like 'MOT16' + valid_label = [1] + ignore_labels = [2, 7, 8, 12] # only in motchallenge datasets like 'MOT16' + logger.info("In MOT16/17 dataset the valid_label of ground truth is '{}', " + "in other dataset it should be '0' for single classs MOT.".format(valid_label[0])) results_dict = dict() if os.path.isfile(filename): with open(filename, 'r') as f: @@ -50,12 +51,10 @@ def read_mot_results(filename, is_gt=False, is_ignore=False): continue results_dict.setdefault(fid, list()) - box_size = float(linelist[4]) * float(linelist[5]) - if is_gt: label = int(float(linelist[7])) mark = int(float(linelist[6])) - if mark == 0 or label not in valid_labels: + if mark == 0 or label not in valid_label: continue score = 1 elif is_ignore: @@ -118,6 +117,8 @@ class MOTEvaluator(object): assert self.data_type == 'mot' gt_filename = os.path.join(self.data_root, self.seq_name, 'gt', 'gt.txt') + if not os.path.exists(gt_filename): + logger.warning("gt_filename '{}' of MOTEvaluator is not exist, so the MOTA will be -inf.") self.gt_frame_dict = read_mot_results(gt_filename, is_gt=True) self.gt_ignore_frame_dict = read_mot_results( gt_filename, is_ignore=True)