-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError: invalid argument 5: k not in range for dimension #131
Comments
@WuChannn 'num_dets' should be less than or equal to 'top_k' * 'top_k' |
@Duankaiwen Hello, kaiwen. I change top_k to 6, and num_dets in the follwing code is 8, however the num of predicted center points is 0. and the full log is: cfg_file: config/CenterNet-52.json [6/1884] Traceback (most recent call last): |
@WuChannn Comment out line 147 in test/coco.py |
@Duankaiwen Thanks a lot. Hope to help others. |
@Duankaiwen Hello, kaiwen. When I try to test with my own images with my trained model, I always get nothing in the saved images and results.json.
could you please give a brief explanation for each element in the vector? and I would like to know why the last elem in dets and the third elem in center are always 3. I also print out detections before valid_ind = detections[:,4]> -1, I got the fifth elem always be -1, so the valid_detections should be [] after valid_ind = detections[:,4]> -1, then I get noting in the result and there is an IndexError in the Traceback.
look forwars to your reply, thanks a lot. |
The situation happened mainly due to the wrong ground truth: |
@WuChannn |
@WuChannn Oh,I see |
@Duankaiwen Hello, kaiwen Actually, I wanna know whether 'kp_detection' means key point detection? and why "kp_categories" is set to 1 in CenterNet-xx.json? Also where to find 'db.class_name' definition in 'cat_name = db.class_name(j)' in test/coco.py? thanks a lot |
@WuChannn 'kp_detection' is just a function name in sample/coco.py, ‘kp_categories’ is not used, you can delete it. 'db.class_name' is defined in db/coco.py, you can step through each line of code by pdb. |
@Duankaiwen Hello, kaiwen: I came across a strange problem: when I set test_scales to [1], and I get nothing in the saved results.json in debug mode, and come up
However, when I set test_scales to [0.1], and I get something in the saved results.json in debug mode, though they are wrong result. I can't figure out why, so I refer to your help. Looking forward to your help. |
@Duankaiwen hello, kaiwen
when i test my test dataset using my own trained model, i met with this problem, and the following is my log:
cfg_file: config/CenterNet-52.json
loading all datasets...
split: test
loading from cache file: cache/ks_test.pkl
loading annotations into memory...
Done (t=1.83s)
creating index...
index created!
system config...
{'batch_size': 3,
'cache_dir': 'cache',
'chunk_sizes': [3],
'config_dir': 'config',
'data_dir': './data',
'data_rng': <mtrand.RandomState object at 0x7ff5fa1b58b8>,
'dataset': 'KS',
'decay_rate': 10,
'display': 50,
'learning_rate': 0.00025,
'max_iter': 480000,
'nnet_rng': <mtrand.RandomState object at 0x7ff5fa1b5900>,
'opt_algo': 'adam',
'prefetch_size': 6,
'pretrain': None,
'result_dir': 'results',
'sampling_function': 'kp_detection',
'snapshot': 5000,
'snapshot_name': 'CenterNet-52',
'stepsize': 450000,
'test_split': 'test',
'train_split': 'train',
'val_iter': 100,
'val_split': 'test',
'weight_decay': False,
'weight_decay_rate': 1e-05,
'weight_decay_type': 'l2'}
db config...
{'ae_threshold': 0.5,
'border': 128,
'categories': 6,
'data_aug': True,
'gaussian_bump': True,
'gaussian_iou': 0.7,
'gaussian_radius': -1,
'input_size': [511, 511],
'kp_categories': 1,
'lighting': True,
'max_per_image': 100,
'merge_bbox': False,
'nms_algorithm': 'exp_soft_nms',
'nms_kernel': 3,
'nms_threshold': 0.5,
'output_sizes': [[128, 128]],
'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_scales': [0.5],
'top_k': 5,
'weight_exp': 8}
loading parameters at iteration: 5000
building neural network...
module_file: models.CenterNet-52
total parameters: 104787098
loading parameters...
loading model from cache/nnet/CenterNet-52/CenterNet-52_5000.pkl
locating kps: 0%| | 0/2772 [00:00<?, ?it/s]/root/data/anaconda2/envs/CenterNet/lib/python3.6/site-packages/torch/nn/modules/upsampling.py:122: UserW
arning: nn.Upsampling is deprecated. Use nn.functional.interpolate instead.
warnings.warn("nn.Upsampling is deprecated. Use nn.functional.interpolate instead.")
Traceback (most recent call last):
File "test.py", line 94, in
test(testing_db, args.split, args.testiter, args.debug, args.suffix)
File "test.py", line 61, in test
testing(db, nnet, result_dir, debug=debug)
File "/root/data/ks/code/CenterNet_duan/test/ks.py", line 321, in testing
return globals()[system_configs.sampling_function](db, nnet, result_dir, debug=debug)
File "/root/data/ks/code/CenterNet_duan/test/ks.py", line 129, in kp_detection
dets, center = decode_func(nnet, images, K, ae_threshold=ae_threshold, kernel=nms_kernel)
File "/root/data/ks/code/CenterNet_duan/test/ks.py", line 54, in kp_decode
detections, center = nnet.test([images], ae_threshold=ae_threshold, K=K, kernel=kernel)
File "/root/data/ks/code/CenterNet_duan/nnet/py_factory.py", line 114, in test
return self.model(*xs, **kwargs)
File "/root/data/anaconda2/envs/CenterNet/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/root/data/ks/code/CenterNet_duan/nnet/py_factory.py", line 32, in forward
return self.module(*xs, **kwargs)
File "/root/data/anaconda2/envs/CenterNet/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/root/data/ks/code/CenterNet_duan/models/py_utils/kp.py", line 290, in forward
return self._test(*xs, **kwargs)
File "/root/data/ks/code/CenterNet_duan/models/py_utils/kp.py", line 285, in _test
return self._decode(*outs[-8:], **kwargs)
File "/root/data/ks/code/CenterNet_duan/models/py_utils/kp_utils.py", line 148, in _decode
scores, inds = torch.topk(scores, num_dets)
RuntimeError: invalid argument 5: k not in range for dimension at /opt/conda/conda-bld/pytorch_1532581333611/work/aten/src/THC/generic/THCTensorTopK.c
u:21
I'm looking forward to your reply. Thank u
The text was updated successfully, but these errors were encountered: