Centernet: test error

Created on 24 Apr 2019  ·  7Comments  ·  Source: xingyizhou/CenterNet

Hi, thanks for your great work. When test in coco datsets by python test.py ctdet --exp_id coco_dla --keep_res --load_model ../models/ctdet_coco_dla_2x.pth, the error has happen

Keep resolution testing.
training chunk_sizes: [32]
The output will be saved to /home3/wangjx/CenterNet/CenterNet-master/src/lib/../../exp/ctdet/coco_dla
heads {'hm': 80, '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='/home3/wangjx/CenterNet/CenterNet-master/src/lib/../../data', dataset='coco', debug=0, debug_dir='/home3/wangjx/CenterNet/CenterNet-master/src/lib/../../exp/ctdet/coco_dla/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='/home3/wangjx/CenterNet/CenterNet-master/src/lib/../../exp/ctdet', exp_id='coco_dla', fix_res=False, flip=0.5, flip_test=False, gpus=[0], gpus_str='3', head_conv=256, heads={'hm': 80, 'wh': 2, 'reg': 2}, hide_data_time=False, hm_hp=True, hm_hp_weight=1, hm_weight=1, hp_weight=1, input_h=512, input_res=512, input_w=512, keep_res='True', kitti_split='3dop', load_model='../models/ctdet_coco_dla_2x.pth', lr=0.000125, lr_step=[90, 120], master_batch_size=32, mean=array([[[0.40789655, 0.44719303, 0.47026116]]], 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=80, num_epochs=140, num_iters=-1, num_stacks=1, num_workers=4, off_weight=1, output_h=128, output_res=128, output_w=128, 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='/home3/wangjx/CenterNet/CenterNet-master/src/lib/../..', rot_weight=1, rotate=0, save_all=False, save_dir='/home3/wangjx/CenterNet/CenterNet-master/src/lib/../../exp/ctdet/coco_dla', scale=0.4, scores_thresh=0.1, seed=317, shift=0.1, std=array([[[0.2886383 , 0.27408165, 0.27809834]]], dtype=float32), task='ctdet', test=False, test_scales=[1.0], trainval=False, val_intervals=5, vis_thresh=0.3, wh_weight=0.1)
==> initializing coco 2017 val data.
loading annotations into memory...
Done (t=0.62s)
creating index...
index created!
Loaded val 5000 samples
Creating model...
loaded ../models/ctdet_coco_dla_2x.pth, epoch 230
coco_dlaTraceback (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 "/home/wangjx/anaconda3/envs/CenterNet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 336, in __next__
return self._process_next_batch(batch)
File "/home/wangjx/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 "/home/wangjx/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 "/home/wangjx/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 41, in __getitem__
images[scale], meta[scale] = self.pre_process_func(image, scale)
File "/home3/wangjx/CenterNet/CenterNet-master/src/lib/detectors/base_detector.py", line 38, in pre_process
height, width = image.shape[0:2]
AttributeError: 'NoneType' object has no attribute 'shape'

can you help me?

Most helpful comment

yeah, it's the dataset problem, and I think line24 in dataset/coco.py should be add 'images' according to your DATA.md, (self.img_dir = os.path.join(self.data_dir, 'images','{}2017'.format(split))).

All 7 comments

The error message says it fails to read the image. Can you check if you have set up the dataset correctly?

yeah, it's the dataset problem, and I think line24 in dataset/coco.py should be add 'images' according to your DATA.md, (self.img_dir = os.path.join(self.data_dir, 'images','{}2017'.format(split))).

An easier way is to make the data path like below:
mkdir -p data/coco/
ln -s /data/coco/annotations data/coco/annotations
ln -s /data/coco/images/train2017 data/coco/train2017
ln -s /data/coco/images/test2017 data/coco/test2017
ln -s /data/coco/images/val2017 data/coco/val2017

Hello, I am modifying according to your method and found that I can run, but after running for a while, I will report the previous error. I don’t know if you have encountered the same problem. Thank you.@wjx2

Hello, I don't know why I will report an error after running to 504. I don't know if you have encountered such a similar problem. @xingyizhou @wjx2 @ZikaiSun

@wjx2 thanks, it works

Hello, I don't know why I will report an error after running to 504. I don't know if you have encountered such a similar problem. @xingyizhou @wjx2 @ZikaiSun

Hello,I have met the same problem.After running for a while,it will report the error
AttributeError: 'NoneType' object has no attribute 'shape'

Have you solved it?

Was this page helpful?
0 / 5 - 0 ratings