zju3dv / snake

Code for "Deep Snake for Real-Time Instance Segmentation" CVPR 2020 oral
Other
1.15k stars 229 forks source link

训练中评估出现numpy.float64' object cannot be interpreted as an integer #214

Closed samwang90 closed 2 years ago

samwang90 commented 2 years ago

我的numpy版本是1.21.0 用1.16.4的话会在开始训练时报错 Traceback (most recent call last): File "train_net.py", line 55, in main() File "train_net.py", line 51, in main train(cfg, network) File "train_net.py", line 15, in train evaluator = make_evaluator(cfg) File "/home/dayu/snake/lib/evaluators/make_evaluator.py", line 19, in make_evaluator return _evaluator_factory(cfg) File "/home/dayu/snake/lib/evaluators/make_evaluator.py", line 11, in _evaluator_factory evaluator = imp.load_source(module, path).Evaluator(cfg.result_dir) File "/home/dayu/anaconda3/envs/snake/lib/python3.7/imp.py", line 171, in load_source module = _load(spec) File "", line 696, in _load File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "lib/evaluators/coco/snake.py", line 5, in from lib.utils.snake import snake_config, snake_cityscapes_utils, snake_eval_utils, snake_poly_utils File "/home/dayu/snake/lib/utils/snake/snake_eval_utils.py", line 3, in import pycocotools.mask as mask_utils File "/home/dayu/anaconda3/envs/snake/lib/python3.7/site-packages/pycocotools/mask.py", line 3, in import pycocotools._mask as _mask File "init.pxd", line 199, in init pycocotools._mask ValueError: numpy.ndarray has the wrong size, try recompiling. Expected 80, got 88

升级numpy后训练不会报错了,评估会报错 Loading and preparing results... DONE (t=0.00s) creating index... index created! Traceback (most recent call last): File "train_net.py", line 55, in main() File "train_net.py", line 51, in main train(cfg, network) File "train_net.py", line 33, in train trainer.val(epoch, val_loader, evaluator, recorder) File "/home/dayu/snake/lib/train/trainers/trainer.py", line 98, in val result = evaluator.summarize() File "lib/evaluators/coco/snake.py", line 72, in summarize coco_eval = COCOeval(self.coco, coco_dets, 'segm') File "/home/dayu/anaconda3/envs/snake/lib/python3.7/site-packages/pycocotools/cocoeval.py", line 76, in init self.params = Params(iouType=iouType) # parameters File "/home/dayu/anaconda3/envs/snake/lib/python3.7/site-packages/pycocotools/cocoeval.py", line 527, in init self.setDetParams() File "/home/dayu/anaconda3/envs/snake/lib/python3.7/site-packages/pycocotools/cocoeval.py", line 507, in setDetParams self.iouThrs = np.linspace(.5, 0.95, np.round((0.95 - .5) / .05) + 1, endpoint=True) File "<__array_function__ internals>", line 6, in linspace File "/home/dayu/anaconda3/envs/snake/lib/python3.7/site-packages/numpy/core/function_base.py", line 120, in linspace num = operator.index(num) TypeError: 'numpy.float64' object cannot be interpreted as an integer

pengsida commented 2 years ago

这个问题我没遇到过,看起来是numpy的问题,建议谷歌看看。