wuzhihao7788 / yolodet-pytorch

reproduce the YOLO series of papers in pytorch, including YOLOv4, PP-YOLO, YOLOv5,YOLOv3, etc.
390 stars 106 forks source link

你好,我在训练出错 #14

Open 1246886181 opened 3 years ago

1246886181 commented 3 years ago

Traceback (most recent call last): File "tools/train.py", line 144, in main() File "tools/train.py", line 69, in main cfg = Config.fromfile(args.config) File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/utils/config.py", line 174, in fromfile cfg_dict, cfg_text = Config._file2dict(filename) File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/utils/config.py", line 113, in _file2dict mod = import_module('_tempconfig') File "/home/tongyu/.conda/envs/yolodet/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 674, in exec_module File "", line 781, in get_code File "", line 741, in source_to_code File "", line 219, in _call_with_frames_removed File "/tmp/tmpwcunctkd/_tempconfig.py", line 37 bbox_loss=dict(type='IOU_Loss', iou_type='GIOU',loss_weight=0.05), ^ SyntaxError: invalid syntax

1246886181 commented 3 years ago

已解决但是出现了新的问题。

1246886181 commented 3 years ago
           Class      Images     Targets           P           R      mAP@.5  mAP@.5:.95:   0%|                                                                                                        | 0/11 [00:00<?, ?it/s]/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/models/heads/base.py:330: UserWarning: This overload of nonzero is deprecated:
    nonzero()

Consider using one of the following signatures instead: nonzero(*, bool as_tuple) (Triggered internally at /opt/conda/conda-bld/pytorch_1595629431274/work/torch/csrc/utils/python_arg_parser.cpp:766.) i, j = (x[:, 5:] > conf_thres).nonzero().t() Class Images Targets P R mAP@.5 mAP@.5:.95: 0%| | 0/11 [00:00<?, ?it/s] Traceback (most recent call last): File "tools/train.py", line 144, in main() File "tools/train.py", line 140, in main train_detector(model,datasets,cfg,validate=args.validate,timestamp=timestamp,meta=meta) File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/apis/train.py", line 161, in train_detector runner.run(data_loaders, cfg.workflow, cfg.total_epochs) File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/apis/runner.py", line 331, in run epoch_runner(data_loaders[i], **kwargs) File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/apis/runner.py", line 230, in train self.call_hook('after_train_epoch') File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/apis/runner.py", line 205, in call_hook getattr(hook, fn_name)(self) File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/models/hooks/eval_hook.py", line 52, in after_train_epoch results = single_gpu_test(model, self.dataloader) File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/apis/test.py", line 93, in single_gpu_test output = non_max_suppression(inf_out, conf_thres=conf_thres, iou_thres=iou_thres, merge=merge) File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/models/heads/base.py", line 355, in non_max_suppression i = torchvision.ops.boxes.nms(boxes, scores, iou_thres) File "/home/tongyu/.conda/envs/yolodet/lib/python3.6/site-packages/torchvision/ops/boxes.py", line 40, in nms return torch.ops.torchvision.nms(boxes, scores, iou_threshold) RuntimeError: Trying to create tensor with negative dimension -349300680: [-349300680]

monoloxo commented 3 years ago

你好,我也遇到了同样的问题,请问你现在解决了吗?

monoloxo commented 3 years ago

我找到了,确实是yolov4_coco_100e.py中bbox那行的上一句的None后面没有逗号的原因。