open-mmlab / mmdetection3d

OpenMMLab's next-generation platform for general 3D object detection.
https://mmdetection3d.readthedocs.io/en/latest/
Apache License 2.0
5.02k stars 1.49k forks source link

[Bug] Unable to run tools/test.py #2808

Open ranai-srivastav opened 7 months ago

ranai-srivastav commented 7 months ago

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

main branch https://github.com/open-mmlab/mmdetection3d

Environment

sys.platform: linux Python: 3.8.10 (default, May 26 2023, 14:05:08) [GCC 9.4.0] CUDA available: True numpy_random_seed: 2147483648 GPU 0: NVIDIA GeForce RTX 3090 CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 12.3, V12.3.52 GCC: x86_64-linux-gnu-gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 PyTorch: 2.1.0+cu121 PyTorch compiling details: PyTorch built with:

TorchVision: 0.16.0+cu121 OpenCV: 4.8.0 MMEngine: 0.9.0 MMDetection: 3.2.0 MMDetection3D: 1.3.0+5c0613b spconv2.0: False

Reproduces the problem - code sample

N/A

Reproduces the problem - command or script

python3 tools/test.py configs/pointpillars/pointpillars_hv_secfpn_sbn-all_8xb4-2x_nus-3d.py checkpoints/hv_pointpillars_fpn_sbn-all_4x8_2x_nus-3d_20200620_230405-2fa62f3d.pth --cfg-options 'test_evaluator.jsonfile_prefix=./pointpillars_nuscenes_results' --show --task lidar_det

Reproduces the problem - error message

python3 tools/test.py configs/pointpillars/pointpillars_hv_secfpn_sbn-all_8xb4-2x_nus-3d.py checkpoints/hv_pointpillars_fpn_sbn-all_4x8_2x_nus-3d_20200620_230405-2fa62f3d.pth --cfg-options 'test_evaluator.jsonfile_prefix=./pointpillars_nuscenes_results' --show --task lidar_det 11/14 00:07:01 - mmengine - INFO -

System environment: sys.platform: linux Python: 3.8.10 (default, May 26 2023, 14:05:08) [GCC 9.4.0] CUDA available: True numpy_random_seed: 791388108 GPU 0: NVIDIA GeForce RTX 3090 CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 12.3, V12.3.52 GCC: x86_64-linux-gnu-gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 PyTorch: 2.1.0+cu121 PyTorch compiling details: PyTorch built with:

Runtime environment: cudnn_benchmark: False mp_cfg: {'mp_start_method': 'fork', 'opencv_num_threads': 0} dist_cfg: {'backend': 'nccl'} seed: 791388108 Distributed launcher: none Distributed training: False GPU number: 1

11/14 00:07:01 - mmengine - INFO - Config: auto_scale_lr = dict(base_batch_size=32, enable=False) backend_args = None class_names = [ 'car', 'truck', 'trailer', 'bus', 'construction_vehicle', 'bicycle', 'motorcycle', 'pedestrian', 'traffic_cone', 'barrier', ] data_prefix = dict(img='', pts='samples/LIDAR_TOP', sweeps='sweeps/LIDAR_TOP') data_root = 'data/nuscenes/' dataset_type = 'NuScenesDataset' default_hooks = dict( checkpoint=dict(interval=-1, type='CheckpointHook'), logger=dict(interval=50, type='LoggerHook'), param_scheduler=dict(type='ParamSchedulerHook'), sampler_seed=dict(type='DistSamplerSeedHook'), timer=dict(type='IterTimerHook'), visualization=dict( draw=True, score_thr=0.1, show=True, type='Det3DVisualizationHook', vis_task='lidar_det', wait_time=2)) default_scope = 'mmdet3d' env_cfg = dict( cudnn_benchmark=False, dist_cfg=dict(backend='nccl'), mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0)) eval_pipeline = [ dict( backend_args=None, coord_type='LIDAR', load_dim=5, type='LoadPointsFromFile', use_dim=5), dict( backend_args=None, sweeps_num=10, test_mode=True, type='LoadPointsFromMultiSweeps'), dict(keys=[ 'points', ], type='Pack3DDetInputs'), ] input_modality = dict(use_camera=False, use_lidar=True) launcher = 'none' load_from = 'checkpoints/hv_pointpillars_fpn_sbn-all_4x8_2x_nus-3d_20200620_230405-2fa62f3d.pth' log_level = 'INFO' log_processor = dict(by_epoch=True, type='LogProcessor', window_size=50) lr = 0.001 metainfo = dict(classes=[ 'car', 'truck', 'trailer', 'bus', 'construction_vehicle', 'bicycle', 'motorcycle', 'pedestrian', 'traffic_cone', 'barrier', ]) model = dict( data_preprocessor=dict( type='Det3DDataPreprocessor', voxel=True, voxel_layer=dict( max_num_points=64, max_voxels=( 30000, 40000, ), point_cloud_range=[ -50, -50, -5, 50, 50, 3, ], voxel_size=[ 0.25, 0.25, 8, ])), pts_backbone=dict( in_channels=64, layer_nums=[ 3, 5, 5, ], layer_strides=[ 2, 2, 2, ], norm_cfg=dict(eps=0.001, momentum=0.01, type='naiveSyncBN2d'), out_channels=[ 64, 128, 256, ], type='SECOND'), pts_bbox_head=dict( anchor_generator=dict( custom_values=[ 0, 0, ], ranges=[ [ -49.6, -49.6, -1.80032795, 49.6, 49.6, -1.80032795, ], [ -49.6, -49.6, -1.74440365, 49.6, 49.6, -1.74440365, ], [ -49.6, -49.6, -1.68526504, 49.6, 49.6, -1.68526504, ], [ -49.6, -49.6, -1.67339111, 49.6, 49.6, -1.67339111, ], [ -49.6, -49.6, -1.61785072, 49.6, 49.6, -1.61785072, ], [ -49.6, -49.6, -1.80984986, 49.6, 49.6, -1.80984986, ], [ -49.6, -49.6, -1.763965, 49.6, 49.6, -1.763965, ], ], reshape_out=True, rotations=[ 0, 1.57, ], sizes=[ [ 4.60718145, 1.95017717, 1.72270761, ], [ 6.73778078, 2.4560939, 2.73004906, ], [ 12.01320693, 2.87427237, 3.81509561, ], [ 1.68452161, 0.60058911, 1.27192197, ], [ 0.7256437, 0.66344886, 1.75748069, ], [ 0.40359262, 0.39694519, 1.06232151, ], [ 0.48578221, 2.49008838, 0.98297065, ], ], type='AlignedAnchor3DRangeGenerator'), assigner_per_size=False, bbox_coder=dict(code_size=9, type='DeltaXYZWLHRBBoxCoder'), diff_rad_by_sin=True, dir_offset=-0.7854, feat_channels=384, in_channels=384, loss_bbox=dict( beta=0.1111111111111111, loss_weight=1.0, type='mmdet.SmoothL1Loss'), loss_cls=dict( alpha=0.25, gamma=2.0, loss_weight=1.0, type='mmdet.FocalLoss', use_sigmoid=True), loss_dir=dict( loss_weight=0.2, type='mmdet.CrossEntropyLoss', use_sigmoid=False), num_classes=10, type='Anchor3DHead', use_direction_classifier=True), pts_middle_encoder=dict( in_channels=64, output_shape=[ 400, 400, ], type='PointPillarsScatter'), pts_neck=dict( in_channels=[ 64, 128, 256, ], norm_cfg=dict(eps=0.001, momentum=0.01, type='naiveSyncBN2d'), out_channels=[ 128, 128, 128, ], type='SECONDFPN', upsample_strides=[ 1, 2, 4, ]), pts_voxel_encoder=dict( feat_channels=[ 64, 64, ], in_channels=4, norm_cfg=dict(eps=0.001, momentum=0.01, type='naiveSyncBN1d'), point_cloud_range=[ -50, -50, -5, 50, 50, 3, ], type='HardVFE', voxel_size=[ 0.25, 0.25, 8, ], with_cluster_center=True, with_distance=False, with_voxel_center=True), test_cfg=dict( pts=dict( max_num=500, min_bbox_size=0, nms_across_levels=False, nms_pre=1000, nms_thr=0.2, score_thr=0.05, use_rotate_nms=True)), train_cfg=dict( pts=dict( allowed_border=0, assigner=dict( ignore_iof_thr=-1, iou_calculator=dict(type='BboxOverlapsNearest3D'), min_pos_iou=0.3, neg_iou_thr=0.3, pos_iou_thr=0.6, type='Max3DIoUAssigner'), code_weight=[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.2, ], debug=False, pos_weight=-1)), type='MVXFasterRCNN') optim_wrapper = dict( clip_grad=dict(max_norm=35, norm_type=2), optimizer=dict(lr=0.001, type='AdamW', weight_decay=0.01), type='OptimWrapper') param_scheduler = [ dict( begin=0, by_epoch=False, end=1000, start_factor=0.001, type='LinearLR'), dict( begin=0, by_epoch=True, end=24, gamma=0.1, milestones=[ 20, 23, ], type='MultiStepLR'), ] point_cloud_range = [ -50, -50, -5, 50, 50, 3, ] resume = False test_cfg = dict(type='TestLoop') test_dataloader = dict( batch_size=1, dataset=dict( ann_file='nuscenes_infos_val.pkl', backend_args=None, box_type_3d='LiDAR', data_prefix=dict( img='', pts='samples/LIDAR_TOP', sweeps='sweeps/LIDAR_TOP'), data_root='data/nuscenes/', metainfo=dict(classes=[ 'car', 'truck', 'trailer', 'bus', 'construction_vehicle', 'bicycle', 'motorcycle', 'pedestrian', 'traffic_cone', 'barrier', ]), modality=dict(use_camera=False, use_lidar=True), pipeline=[ dict( backend_args=None, coord_type='LIDAR', load_dim=5, type='LoadPointsFromFile', use_dim=5), dict( backend_args=None, sweeps_num=10, test_mode=True, type='LoadPointsFromMultiSweeps'), dict( flip=False, img_scale=( 1333, 800, ), pts_scale_ratio=1, transforms=[ dict( rot_range=[ 0, 0, ], scale_ratio_range=[ 1.0, 1.0, ], translation_std=[ 0, 0, 0, ], type='GlobalRotScaleTrans'), dict(type='RandomFlip3D'), dict( point_cloud_range=[ -50, -50, -5, 50, 50, 3, ], type='PointsRangeFilter'), ], type='MultiScaleFlipAug3D'), dict(keys=[ 'points', ], type='Pack3DDetInputs'), ], test_mode=True, type='NuScenesDataset'), drop_last=False, num_workers=1, persistent_workers=True, sampler=dict(shuffle=False, type='DefaultSampler')) test_evaluator = dict( ann_file='data/nuscenes/nuscenes_infos_val.pkl', backend_args=None, data_root='data/nuscenes/', jsonfile_prefix='./pointpillars_nuscenes_results', metric='bbox', type='NuScenesMetric') test_pipeline = [ dict( backend_args=None, coord_type='LIDAR', load_dim=5, type='LoadPointsFromFile', use_dim=5), dict( backend_args=None, sweeps_num=10, test_mode=True, type='LoadPointsFromMultiSweeps'), dict( flip=False, img_scale=( 1333, 800, ), pts_scale_ratio=1, transforms=[ dict( rot_range=[ 0, 0, ], scale_ratio_range=[ 1.0, 1.0, ], translation_std=[ 0, 0, 0, ], type='GlobalRotScaleTrans'), dict(type='RandomFlip3D'), dict( point_cloud_range=[ -50, -50, -5, 50, 50, 3, ], type='PointsRangeFilter'), ], type='MultiScaleFlipAug3D'), dict(keys=[ 'points', ], type='Pack3DDetInputs'), ] train_cfg = dict(max_epochs=24, type='EpochBasedTrainLoop', val_interval=24) train_dataloader = dict( batch_size=4, dataset=dict( ann_file='nuscenes_infos_train.pkl', backend_args=None, box_type_3d='LiDAR', data_prefix=dict( img='', pts='samples/LIDAR_TOP', sweeps='sweeps/LIDAR_TOP'), data_root='data/nuscenes/', metainfo=dict(classes=[ 'car', 'truck', 'trailer', 'bus', 'construction_vehicle', 'bicycle', 'motorcycle', 'pedestrian', 'traffic_cone', 'barrier', ]), modality=dict(use_camera=False, use_lidar=True), pipeline=[ dict( backend_args=None, coord_type='LIDAR', load_dim=5, type='LoadPointsFromFile', use_dim=5), dict( backend_args=None, sweeps_num=10, type='LoadPointsFromMultiSweeps'), dict( type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), dict( rot_range=[ -0.3925, 0.3925, ], scale_ratio_range=[ 0.95, 1.05, ], translation_std=[ 0, 0, 0, ], type='GlobalRotScaleTrans'), dict(flip_ratio_bev_horizontal=0.5, type='RandomFlip3D'), dict( point_cloud_range=[ -50, -50, -5, 50, 50, 3, ], type='PointsRangeFilter'), dict( point_cloud_range=[ -50, -50, -5, 50, 50, 3, ], type='ObjectRangeFilter'), dict( classes=[ 'car', 'truck', 'trailer', 'bus', 'construction_vehicle', 'bicycle', 'motorcycle', 'pedestrian', 'traffic_cone', 'barrier', ], type='ObjectNameFilter'), dict(type='PointShuffle'), dict( keys=[ 'points', 'gt_bboxes_3d', 'gt_labels_3d', ], type='Pack3DDetInputs'), ], test_mode=False, type='NuScenesDataset'), num_workers=4, persistent_workers=True, sampler=dict(shuffle=True, type='DefaultSampler')) train_pipeline = [ dict( backend_args=None, coord_type='LIDAR', load_dim=5, type='LoadPointsFromFile', use_dim=5), dict(backend_args=None, sweeps_num=10, type='LoadPointsFromMultiSweeps'), dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), dict( rot_range=[ -0.3925, 0.3925, ], scale_ratio_range=[ 0.95, 1.05, ], translation_std=[ 0, 0, 0, ], type='GlobalRotScaleTrans'), dict(flip_ratio_bev_horizontal=0.5, type='RandomFlip3D'), dict( point_cloud_range=[ -50, -50, -5, 50, 50, 3, ], type='PointsRangeFilter'), dict( point_cloud_range=[ -50, -50, -5, 50, 50, 3, ], type='ObjectRangeFilter'), dict( classes=[ 'car', 'truck', 'trailer', 'bus', 'construction_vehicle', 'bicycle', 'motorcycle', 'pedestrian', 'traffic_cone', 'barrier', ], type='ObjectNameFilter'), dict(type='PointShuffle'), dict( keys=[ 'points', 'gt_bboxes_3d', 'gt_labels_3d', ], type='Pack3DDetInputs'), ] val_cfg = dict(type='ValLoop') val_dataloader = dict( batch_size=1, dataset=dict( ann_file='nuscenes_infos_val.pkl', backend_args=None, box_type_3d='LiDAR', data_prefix=dict( img='', pts='samples/LIDAR_TOP', sweeps='sweeps/LIDAR_TOP'), data_root='data/nuscenes/', metainfo=dict(classes=[ 'car', 'truck', 'trailer', 'bus', 'construction_vehicle', 'bicycle', 'motorcycle', 'pedestrian', 'traffic_cone', 'barrier', ]), modality=dict(use_camera=False, use_lidar=True), pipeline=[ dict( backend_args=None, coord_type='LIDAR', load_dim=5, type='LoadPointsFromFile', use_dim=5), dict( backend_args=None, sweeps_num=10, test_mode=True, type='LoadPointsFromMultiSweeps'), dict( flip=False, img_scale=( 1333, 800, ), pts_scale_ratio=1, transforms=[ dict( rot_range=[ 0, 0, ], scale_ratio_range=[ 1.0, 1.0, ], translation_std=[ 0, 0, 0, ], type='GlobalRotScaleTrans'), dict(type='RandomFlip3D'), dict( point_cloud_range=[ -50, -50, -5, 50, 50, 3, ], type='PointsRangeFilter'), ], type='MultiScaleFlipAug3D'), dict(keys=[ 'points', ], type='Pack3DDetInputs'), ], test_mode=True, type='NuScenesDataset'), drop_last=False, num_workers=1, persistent_workers=True, sampler=dict(shuffle=False, type='DefaultSampler')) val_evaluator = dict( ann_file='data/nuscenes/nuscenes_infos_val.pkl', backend_args=None, data_root='data/nuscenes/', metric='bbox', type='NuScenesMetric') vis_backends = [ dict(type='LocalVisBackend'), ] visualizer = dict( name='visualizer', type='Det3DLocalVisualizer', vis_backends=[ dict(type='LocalVisBackend'), ]) voxel_size = [ 0.25, 0.25, 8, ] work_dir = './work_dirs/pointpillars_hv_secfpn_sbn-all_8xb4-2x_nus-3d'

/home/ranai/software/mmdetection3d/mmdet3d/models/dense_heads/anchor3d_head.py:94: UserWarning: dir_offset and dir_limit_offset will be depressed and be incorporated into box coder in the future warnings.warn( 11/14 00:07:03 - mmengine - INFO - Distributed training is not used, all SyncBatchNorm (SyncBN) layers in the model will be automatically reverted to BatchNormXd layers if they are used. /home/ranai/software/mmdetection3d/mmdet3d/engine/hooks/visualization_hook.py:75: UserWarning: The show is True, it means that only the prediction results are visualized without storing data, so vis_backends needs to be excluded. warnings.warn('The show is True, it means that only ' 11/14 00:07:03 - mmengine - INFO - Autoplay mode, press [SPACE] to pause. 11/14 00:07:03 - mmengine - INFO - Hooks will be executed in the following order: before_run: (VERY_HIGH ) RuntimeInfoHook
(BELOW_NORMAL) LoggerHook


before_train: (VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(VERY_LOW ) CheckpointHook


before_train_epoch: (VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(NORMAL ) DistSamplerSeedHook


before_train_iter: (VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook


after_train_iter: (VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(BELOW_NORMAL) LoggerHook
(LOW ) ParamSchedulerHook
(VERY_LOW ) CheckpointHook


after_train_epoch: (NORMAL ) IterTimerHook
(LOW ) ParamSchedulerHook
(VERY_LOW ) CheckpointHook


before_val: (VERY_HIGH ) RuntimeInfoHook


before_val_epoch: (NORMAL ) IterTimerHook


before_val_iter: (NORMAL ) IterTimerHook


after_val_iter: (NORMAL ) IterTimerHook
(NORMAL ) Det3DVisualizationHook
(BELOW_NORMAL) LoggerHook


after_val_epoch: (VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(BELOW_NORMAL) LoggerHook
(LOW ) ParamSchedulerHook
(VERY_LOW ) CheckpointHook


after_val: (VERY_HIGH ) RuntimeInfoHook


after_train: (VERY_HIGH ) RuntimeInfoHook
(VERY_LOW ) CheckpointHook


before_test: (VERY_HIGH ) RuntimeInfoHook


before_test_epoch: (NORMAL ) IterTimerHook


before_test_iter: (NORMAL ) IterTimerHook


after_test_iter: (NORMAL ) IterTimerHook
(NORMAL ) Det3DVisualizationHook
(BELOW_NORMAL) LoggerHook


after_test_epoch: (VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(BELOW_NORMAL) LoggerHook


after_test: (VERY_HIGH ) RuntimeInfoHook


after_run: (BELOW_NORMAL) LoggerHook


Traceback (most recent call last): File "tools/test.py", line 149, in main() File "tools/test.py", line 145, in main runner.test() File "/home/ranai/.local/lib/python3.8/site-packages/mmengine/runner/runner.py", line 1816, in test self._test_loop = self.build_test_loop(self._test_loop) # type: ignore File "/home/ranai/.local/lib/python3.8/site-packages/mmengine/runner/runner.py", line 1604, in build_test_loop loop = LOOPS.build( File "/home/ranai/.local/lib/python3.8/site-packages/mmengine/registry/registry.py", line 570, in build return self.build_func(cfg, args, kwargs, registry=self) File "/home/ranai/.local/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 121, in build_from_cfg obj = obj_cls(args) # type: ignore File "/home/ranai/.local/lib/python3.8/site-packages/mmengine/runner/loops.py", line 410, in init super().init(runner, dataloader) File "/home/ranai/.local/lib/python3.8/site-packages/mmengine/runner/base_loop.py", line 26, in init self.dataloader = runner.build_dataloader( File "/home/ranai/.local/lib/python3.8/site-packages/mmengine/runner/runner.py", line 1370, in build_dataloader dataset = DATASETS.build(dataset_cfg) File "/home/ranai/.local/lib/python3.8/site-packages/mmengine/registry/registry.py", line 570, in build return self.build_func(cfg, args, kwargs, registry=self) File "/home/ranai/.local/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 121, in build_from_cfg obj = obj_cls(args) # type: ignore File "/home/ranai/software/mmdetection3d/mmdet3d/datasets/nuscenes_dataset.py", line 102, in init super().init( File "/home/ranai/software/mmdetection3d/mmdet3d/datasets/det3d_dataset.py", line 129, in init super().init( File "/home/ranai/.local/lib/python3.8/site-packages/mmengine/dataset/base_dataset.py", line 247, in init self.full_init() File "/home/ranai/.local/lib/python3.8/site-packages/mmengine/dataset/base_dataset.py", line 298, in full_init self.data_list = self.load_data_list() File "/home/ranai/.local/lib/python3.8/site-packages/mmengine/dataset/base_dataset.py", line 440, in load_data_list raise ValueError('Annotation must have data_list and metainfo ' ValueError: Annotation must have data_list and metainfo keys

Additional information

I've run tools/create_data.py on the dataset and it runs without a problem Running tools/dataset_converters/update_infos_to_v2.py --dataset nuscenes gives the following error

./data/kitti/kitti_infos_train.pkl  will be modified.
Reading from input file: ./data/kitti/kitti_infos_train.pkl .
Traceback (most recent call last):
  File "tools/dataset_converters/update_infos_to_v2.py", line 1159, in <module>
    update_pkl_infos(
  File "tools/dataset_converters/update_infos_to_v2.py", line 1148, in update_pkl_infos
    update_nuscenes_infos(pkl_path=pkl_path, out_dir=out_dir)
  File "tools/dataset_converters/update_infos_to_v2.py", line 263, in update_nuscenes_infos
    data_list = mmengine.load(pkl_path)
  File "/home/ranai/.local/lib/python3.8/site-packages/mmengine/fileio/io.py", line 832, in load
    raise TypeError(f'Unsupported format: {file_format}')
TypeError: Unsupported format: pkl o
abadithela commented 7 months ago

Hi, I am facing this issue as well. Any updates on how to address this?

T-Ray35 commented 4 months ago

I met same issue when convert kitti dataset, however, since I am using a mini dataset, I cannot use converted pkls that provided by mmlab.