xingyizhou / CenterNet

Object detection, 3D detection, and pose estimation using center point detection:
MIT License
7.25k stars 1.92k forks source link

Evaluate kitti--AttributeError: 'NoneType' object has no attribute 'shape' #575

Open chmod770-before-agreeing opened 4 years ago

chmod770-before-agreeing commented 4 years ago

When I try to evaluate the kitti dataset as is said in the GETTING_STARTED.MD , some problems occured during the running step just like :

(CenterNet) wqk@dsp:~/docs/CenterNet/src$ python test.py ddd --exp_id 3dop --dataset kitti --kitti_split 3dop --load_model ../models/ddd_3dop.pth Fix size testing. training chunk_sizes: [32] The output will be saved to /data/wqk/docs/CenterNet/src/lib/../../exp/ddd/3dop heads {'hm': 3, 'dep': 1, 'rot': 8, 'dim': 3, 'wh': 2, 'reg': 2} Namespace(K=100, aggr_weight=0.0, agnostic_ex=False, arch='dla_34', aug_ddd=0.5, aug_rot=0, batch_size=32, cat_spec_wh=False, center_thresh=0.1, chunk_sizes=[32], data_dir='/data/wqk/docs/CenterNet/src/lib/../../data', dataset='kitti', debug=0, debug_dir='/data/wqk/docs/CenterNet/src/lib/../../exp/ddd/3dop/debug', debugger_theme='white', demo='', dense_hp=False, dense_wh=False, dep_weight=1, dim_weight=1, down_ratio=4, eval_oracle_dep=False, eval_oracle_hm=False, eval_oracle_hmhp=False, eval_oracle_hp_offset=False, eval_oracle_kps=False, eval_oracle_offset=False, eval_oracle_wh=False, exp_dir='/data/wqk/docs/CenterNet/src/lib/../../exp/ddd', exp_id='3dop', fix_res=True, flip=0.5, flip_test=False, gpus=[0], gpus_str='0', head_conv=256, heads={'hm': 3, 'dep': 1, 'rot': 8, 'dim': 3, 'wh': 2, 'reg': 2}, hide_data_time=False, hm_hp=True, hm_hp_weight=1, hm_weight=1, hp_weight=1, input_h=384, input_res=1280, input_w=1280, keep_res=False, kitti_split='3dop', load_model='../models/ddd_3dop.pth', lr=0.000125, lr_step=[90, 120], master_batch_size=32, mean=array([[[0.485, 0.456, 0.406]]], dtype=float32), metric='loss', mse_loss=False, nms=False, no_color_aug=False, norm_wh=False, not_cuda_benchmark=False, not_hm_hp=False, not_prefetch_test=False, not_rand_crop=False, not_reg_bbox=False, not_reg_hp_offset=False, not_reg_offset=False, num_classes=3, num_epochs=140, num_iters=-1, num_stacks=1, num_workers=4, off_weight=1, output_h=96, output_res=320, output_w=320, pad=31, peak_thresh=0.2, print_iter=0, rect_mask=False, reg_bbox=True, reg_hp_offset=True, reg_loss='l1', reg_offset=True, resume=False, root_dir='/data/wqk/docs/CenterNet/src/lib/../..', rot_weight=1, rotate=0, save_all=False, save_dir='/data/wqk/docs/CenterNet/src/lib/../../exp/ddd/3dop', scale=0.4, scores_thresh=0.1, seed=317, shift=0.1, std=array([[[0.229, 0.224, 0.225]]], dtype=float32), task='ddd', test=False, test_scales=[1.0], trainval=False, val_intervals=5, vis_thresh=0.3, wh_weight=0.1) ==> initializing kitti 3dop, val data. loading annotations into memory... Done (t=0.15s) creating index... index created! Loaded val 3769 samples Creating model... loaded ../models/ddd_3dop.pth, epoch 70 3dopTraceback (most recent call last): File "test.py", line 126, in prefetch_test(opt) File "test.py", line 69, in prefetch_test for ind, (img_id, pre_processed_images) in enumerate(data_loader): File "/data/wqk/anaconda3/envs/CenterNet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 336, in next return self._process_next_batch(batch) File "/data/wqk/anaconda3/envs/CenterNet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 357, in _process_next_batch raise batch.exc_type(batch.exc_msg) AttributeError: Traceback (most recent call last): File "/data/wqk/anaconda3/envs/CenterNet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 106, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/data/wqk/anaconda3/envs/CenterNet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 106, in samples = collate_fn([dataset[i] for i in batch_indices]) File "test.py", line 39, in getitem image, scale, img_info['calib']) File "/data/wqk/docs/CenterNet/src/lib/detectors/ddd.py", line 31, in pre_process height, width = image.shape[0:2] AttributeError: 'NoneType' object has no attribute 'shape'

chmod770-before-agreeing commented 4 years ago

I will be grateful for your help

xingyizhou commented 4 years ago

It says the images are not loaded. Can you check you have placed the dataset correctly?

libbo1006 commented 4 years ago

Maybe the path contain the non-ascii words.

juanmed commented 4 years ago

I had the same problem. For some reason the simlinks that are created during the data preparation process described in DATA.md are not working. So instead of creating simlinks I simply copied the actual data into the directories indicated in DATA.md. In other words the folders data/kitti/images/test and data/kitti/images/trainval do contain the actual images.

libbo1006 commented 4 years ago

my data path like this

At 2020-02-10 19:52:24, "Juan" notifications@github.com wrote:

I had the same problem. For some reason the simlinks that are created during the data preparation process described in DATA.md are not working. So instead of creating simlinks I simply copied the actual data into the directories indicated in DATA.md. In other words the folders data/kitti/images/test and data/kitti/images/trainval do contain the actual images.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

moviebat commented 4 years ago

height, width = image.shape[0:2] add try Except: ok because the image is not exist

chaoswjc commented 4 years ago

try ln -s ../training/image_2 images/trainval instead of ln -s training/image_2 images/trainval

yanzhao16 commented 2 years ago

try ln -s ../training/image_2 images/trainval instead of ln -s training/image_2 images/trainval

This answer is correct.