arashwan / matrixnet

PyTorch implementation for MatrixNet object detection architecture.
MIT License
171 stars 32 forks source link

while running test.py, I get zero division error from soft_nms_merge #16

Open hyeyi opened 4 years ago

hyeyi commented 4 years ago

I ran train.py with my own images with 5 categories. It was done. Now, I am trying to run test.py. $ python test.py MatrixNetCornersResnet50 --testiter 340000 --split validation

Unfortunately, I am getting error messages. I will really appreciate if you can show me how to fix the error.

This is the log.

cfg_file: ./config/MatrixNetCornersResnet50.json loading all datasets... split: test loading from cache file: ./MatrixNetCornersResnet50_48LayerRange_512isize/coco_test.pkl loading annotations into memory... Done (t=0.01s) creating index... index created! system config... {'batch_size': 23, 'cache_dir': './MatrixNetCornersResnet50_48LayerRange_512isize', 'chunk_sizes': [5, 6, 6, 6], 'config_dir': './config', 'data_dir': './data/', 'data_rng': RandomState(MT19937) at 0x2ADE183A2048, 'dataset': 'MSCOCO', 'decay_rate': 10, 'display': 5, 'learning_rate': 5e-05, 'max_iter': 350000, 'model_name': 'MatrixNetCorners', 'nnet_rng': RandomState(MT19937) at 0x2ADE183A2150, 'opt_algo': 'adam', 'prefetch_size': 6, 'pretrain': None, 'result_dir': './results', 'snapshot': 10000, 'stepsize': 300000, 'test_split': 'testdev2017', 'train_split': 'train', 'val_iter': 100, 'val_split': 'test', 'weight_decay': False, 'weight_decay_rate': 1e-05, 'weight_decay_type': 'l2'} db config... {'backbone': 'resnet50', 'base_layer_range': [24, 48, 24, 48], 'border': 128, 'categories': 5, 'cutout': True, 'data_aug': True, 'gaussian_bump': True, 'gaussian_iou': 0.3, 'gaussian_radius': -1, 'height_thresholds': None, 'input_size': [512, 512], 'layers_range': [[[0, 48, 0, 48], [48, 96, 0, 48], [96, 192, 0, 48], -1, -1], [[0, 48, 48, 96], [48, 96, 48, 96], [96, 192, 48, 96], [192, 384, 0, 96], -1], [[0, 48, 96, 192], [48, 96, 96, 192], [96, 192, 96, 192], [192, 384, 96, 192], [384, 2000, 96, 192]], [-1, [0, 96, 192, 384], [96, 192, 192, 384], [192, 384, 192, 384], [384, 2000, 192, 384]], [-1, -1, [0, 192, 384, 2000], [192, 384, 384, 2000], [384, 2000, 384, 2000]]], 'lighting': True, 'matching_threshold': 0.3, 'max_per_image': 100, 'merge_bbox': True, 'nms_algorithm': 'exp_soft_nms', 'nms_kernel': 3, 'nms_threshold': 0.5, 'output_kernel_size': 3, 'rand_color': True, 'rand_crop': True, 'rand_pushes': False, 'rand_samples': False, 'rand_scale_max': 1.4, 'rand_scale_min': 0.6, 'rand_scale_step': 0.1, 'rand_scales': array([0.6, 0.7, 0.8, 0.9, 1. , 1.1, 1.2, 1.3]), 'special_crop': False, 'test_flip_images': True, 'test_image_max_dim': 900, 'test_scales': [1], 'top_k': 50, 'train_image_max_dim': 800, 'weight_exp': 6, 'width_thresholds': None} loading parameters at iteration: 340000 building neural network... module_file: models.MatrixNetCorners total parameters: 48347962 loading parameters... loading model from ./MatrixNetCornersResnet50_48LayerRange_512isize/nnet/MatrixNetCorners/MatrixNetCorners_340000.pkl

However, I am getting the following error message.

locating kps: 0%| | 0/575 [00:00<?, ?it/s] Traceback (most recent call last): File "test.py", line 98, in test(testing_db, args.split, args.testiter, args.debug, args.suffix) File "test.py", line 61, in test testing(db, nnet, resultdir, debug=debug) File "/data/hsyi/Pray/matrixnet/test/coco.py", line 433, in testing return globals()["test"+system_configs.model_name](db, nnet, result_dir, debug=debug) File "/data/hsyi/Pray/matrixnet/test/coco.py", line 164, in test_MatrixNetCorners soft_nms_merge(top_bboxes[image_id][j + 1], Nt=nms_threshold, method=nms_algorithm, weight_exp=weight_exp) File "nms.pyx", line 280, in nms.soft_nms_merge ZeroDivisionError: float division

Thank you in advance.

rra94 commented 4 years ago

Can you check if there are any predictions being made at all?

You can comment out the NMS in test/coco.py and try