"...git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "1a8b3c2ee86c09d0d3e066f7e9ea2ab69e8e78fa"
Commit 9d32fbc4 authored by zhangwenwei's avatar zhangwenwei
Browse files

Merge branch 'change-ci' into 'master'

Fix KITTI Evaluation Log Bug

See merge request open-mmlab/mmdet.3d!7
parents b3b20620 64e29949
variables: variables:
PYTORCH_IMAGE: registry.sensetime.com/eig-research/pytorch:pytorch1.3.1-cuda10.1-devel PYTORCH_IMAGE: registry.sensetime.com/eig-research/pytorch:1.3.1-cuda10.1-cudnn7-devel
stages: stages:
- linting - linting
......
...@@ -681,7 +681,6 @@ def kitti_eval(gt_annos, ...@@ -681,7 +681,6 @@ def kitti_eval(gt_annos,
# mAP threshold array: [num_minoverlap, metric, class] # mAP threshold array: [num_minoverlap, metric, class]
# mAP result: [num_class, num_diff, num_minoverlap] # mAP result: [num_class, num_diff, num_minoverlap]
curcls_name = class_to_name[curcls] curcls_name = class_to_name[curcls]
ret_dict[curcls_name] = {}
for i in range(min_overlaps.shape[0]): for i in range(min_overlaps.shape[0]):
# prepare results for print # prepare results for print
result += ('{} AP@{:.2f}, {:.2f}, {:.2f}:\n'.format( result += ('{} AP@{:.2f}, {:.2f}, {:.2f}:\n'.format(
...@@ -702,18 +701,17 @@ def kitti_eval(gt_annos, ...@@ -702,18 +701,17 @@ def kitti_eval(gt_annos,
# prepare results for logger # prepare results for logger
for idx in range(3): for idx in range(3):
postfix = '{}_{}'.format(difficulty[idx], min_overlaps[i, idx, if i == 0:
j]) postfix = f'{difficulty[idx]}_strict'
else:
postfix = f'{difficulty[idx]}_loose'
prefix = f'KITTI/{curcls_name}'
if mAP3d is not None: if mAP3d is not None:
ret_dict[curcls_name]['3D_{}'.format(postfix)] = mAP3d[j, ret_dict[f'{prefix}_3D_{postfix}'] = mAP3d[j, idx, i]
idx,
i]
if mAPbev is not None: if mAPbev is not None:
ret_dict[curcls_name]['BEV_{}'.format(postfix)] = mAPbev[ ret_dict[f'{prefix}_BEV_{postfix}'] = mAPbev[j, idx, i]
j, idx, i]
if mAPbbox is not None: if mAPbbox is not None:
ret_dict[curcls_name]['2D_{}'.format(postfix)] = mAPbbox[ ret_dict[f'{prefix}_2D_{postfix}'] = mAPbbox[j, idx, i]
j, idx, i]
# calculate mAP over all classes if there are multiple classes # calculate mAP over all classes if there are multiple classes
if len(current_classes) > 1: if len(current_classes) > 1:
...@@ -735,14 +733,14 @@ def kitti_eval(gt_annos, ...@@ -735,14 +733,14 @@ def kitti_eval(gt_annos,
# prepare results for logger # prepare results for logger
ret_dict['Overall'] = dict() ret_dict['Overall'] = dict()
for idx in range(3): for idx in range(3):
postfix = '{}'.format(difficulty[idx]) postfix = f'{difficulty[idx]}'
if mAP3d is not None: if mAP3d is not None:
ret_dict['Overall']['3D_{}'.format(postfix)] = mAP3d[idx, 0] ret_dict[f'KITTI/Overall_3D_{postfix}'] = mAP3d[idx, 0]
if mAPbev is not None: if mAPbev is not None:
ret_dict['Overall']['BEV_{}'.format(postfix)] = mAPbev[idx, 0] ret_dict[f'KITTI/Overall_BEV_{postfix}'] = mAPbev[idx, 0]
if mAPbbox is not None: if mAPbbox is not None:
ret_dict['Overall']['2D_{}'.format(postfix)] = mAPbbox[idx, 0] ret_dict[f'KITTI/Overall_2D_{postfix}'] = mAPbbox[idx, 0]
print(result)
return result, ret_dict return result, ret_dict
......
...@@ -9,6 +9,7 @@ import torch ...@@ -9,6 +9,7 @@ import torch
import torch.utils.data as torch_data import torch.utils.data as torch_data
from mmdet.datasets import DATASETS from mmdet.datasets import DATASETS
from mmdet.utils import print_log
from ..core.bbox import box_np_ops from ..core.bbox import box_np_ops
from .pipelines import Compose from .pipelines import Compose
from .utils import remove_dontcare from .utils import remove_dontcare
...@@ -317,10 +318,10 @@ class KittiDataset(torch_data.Dataset): ...@@ -317,10 +318,10 @@ class KittiDataset(torch_data.Dataset):
else: else:
ap_result_str, ap_dict = kitti_eval(gt_annos, result_files, ap_result_str, ap_dict = kitti_eval(gt_annos, result_files,
self.class_names) self.class_names)
print_log('\n' + ap_result_str, logger=logger)
if tmp_dir is not None: if tmp_dir is not None:
tmp_dir.cleanup() tmp_dir.cleanup()
return ap_dict, tmp_dir return ap_dict
def bbox2result_kitti(self, def bbox2result_kitti(self,
net_outputs, net_outputs,
......
from __future__ import division from __future__ import division
import argparse import argparse
import copy import copy
import logging
import os import os
import os.path as osp import os.path as osp
import time import time
...@@ -103,6 +104,10 @@ def main(): ...@@ -103,6 +104,10 @@ def main():
log_file = osp.join(cfg.work_dir, '{}.log'.format(timestamp)) log_file = osp.join(cfg.work_dir, '{}.log'.format(timestamp))
logger = get_root_logger(log_file=log_file, log_level=cfg.log_level) logger = get_root_logger(log_file=log_file, log_level=cfg.log_level)
# add a logging filter
logging_filter = logging.Filter('mmdet')
logging_filter.filter = lambda record: record.find('mmdet') != -1
# init the meta dict to record some important information such as # init the meta dict to record some important information such as
# environment info and seed, which will be logged # environment info and seed, which will be logged
meta = dict() meta = dict()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment