Duankaiwen / CenterNet

Codes for our paper "CenterNet: Keypoint Triplets for Object Detection" .
MIT License
1.86k stars 384 forks source link

models/py_utils/kp_utils.py #7

Open wu-yy opened 5 years ago

wu-yy commented 5 years ago

The function _ae_loss of file "models/py_utils/kp_utils.py":

whether the code "dist = tag_mean.unsqueeze(1) - tag_mean.unsqueeze(2)" is change to "dist = tag_mean.unsqueeze(1) - tag_mean.unsqueeze(-2)"?

Dawning23 commented 5 years ago

@wu-yy I also encountered the same problem, have you solved it?

Dawning23 commented 5 years ago

@Duankaiwen Can you help me with this?

loading all datasets... using 4 threads loading from cache file: cache/coco_trainval2014.pkl loading annotations into memory... Done (t=13.40s) creating index... index created! loading from cache file: cache/coco_trainval2014.pkl loading annotations into memory... Done (t=13.10s) creating index... index created! loading from cache file: cache/coco_trainval2014.pkl loading annotations into memory... Done (t=12.44s) creating index... index created! loading from cache file: cache/coco_trainval2014.pkl loading annotations into memory... Done (t=13.10s) creating index... index created! loading from cache file: cache/coco_minival2014.pkl loading annotations into memory... Done (t=0.38s) creating index... index created! system config... {'batch_size': 1, 'cache_dir': 'cache', 'chunk_sizes': [1], 'config_dir': 'config', 'data_dir': '/home/zbh/Projects/centernet/data', 'data_rng': <mtrand.RandomState object at 0x7fbfdd16f9d8>, 'dataset': 'MSCOCO', 'decay_rate': 10, 'display': 5, 'learning_rate': 0.00025, 'max_iter': 480000, 'nnet_rng': <mtrand.RandomState object at 0x7fbfdd16fa20>, 'opt_algo': 'adam', 'prefetch_size': 6, 'pretrain': None, 'result_dir': 'results', 'sampling_function': 'kp_detection', 'snapshot': 5000, 'snapshot_name': 'CenterNet-104', 'stepsize': 450000, 'test_split': 'testdev', 'train_split': 'trainval', 'val_iter': 500, 'val_split': 'minival', 'weight_decay': False, 'weight_decay_rate': 1e-05, 'weight_decay_type': 'l2'} db config... {'ae_threshold': 0.5, 'border': 128, 'categories': 80, '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': [1], 'top_k': 70, 'weight_exp': 8} len of db: 118287 start prefetching data... shuffling indices... start prefetching data... shuffling indices... start prefetching data... shuffling indices... start prefetching data... shuffling indices... start prefetching data... building model... module_file: models.CenterNet-104 shuffling indices... total parameters: 210062960 setting learning rate to: 0.00025 training start... 0%| | 0/480000 [00:00<?, ?it/s]/home/zbh/Anaconda3/envs/centernet/lib/python3.6/site-packages/torch/nn/modules/upsampling.py:122: UserWarning: 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 "/home/zbh/Projects/centernet/train.py", line 206, in train(training_dbs, validation_db, args.start_iter) File "/home/zbh/Projects/centernet/train.py", line 138, in train training_loss, focal_loss, pull_loss, push_loss, regr_loss = nnet.train(training) File "/home/zbh/Projects/centernet/nnet/py_factory.py", line 82, in train loss_kp = self.network(xs, ys) File "/home/zbh/Anaconda3/envs/centernet/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(*input, *kwargs) File "/home/zbh/Projects/centernet/models/py_utils/data_parallel.py", line 70, in forward outputs = self.parallel_apply(replicas, inputs, kwargs) File "/home/zbh/Projects/centernet/models/py_utils/data_parallel.py", line 80, in parallel_apply return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)]) File "/home/zbh/Anaconda3/envs/centernet/lib/python3.6/site-packages/torch/nn/parallel/parallel_apply.py", line 77, in parallel_apply raise output File "/home/zbh/Anaconda3/envs/centernet/lib/python3.6/site-packages/torch/nn/parallel/parallel_apply.py", line 53, in _worker output = module(input, kwargs) File "/home/zbh/Anaconda3/envs/centernet/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(input, kwargs) File "/home/zbh/Projects/centernet/nnet/py_factory.py", line 21, in forward loss_kp = self.loss(preds, ys, kwargs) File "/home/zbh/Anaconda3/envs/centernet/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(input, **kwargs) File "/home/zbh/Projects/centernet/models/py_utils/kp.py", line 339, in forward pull, push = self.ae_loss(tl_tag, br_tag, gt_mask) File "/home/zbh/Projects/centernet/models/py_utils/kp_utils.py", line 217, in _ae_loss dist = tag_mean.unsqueeze(1) - tag_mean.unsqueeze(2) RuntimeError: Dimension out of range (expected to be in range of [-2, 1], but got 2)

Duankaiwen commented 5 years ago

@Dawning23 https://github.com/Duankaiwen/CenterNet/issues/20

Dawning23 commented 5 years ago

@Duankaiwen That's really helpful,thanks a lot!

songjiaojie commented 4 years ago

Dimension out of range (expected to be in range of [-2, 1], but got 2) can you help me?

Duankaiwen commented 4 years ago

@songjiaojie https://github.com/Duankaiwen/CenterNet/issues/20