Skip to content
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

训练报错 #10

Open
dnty opened this issue Sep 9, 2021 · 7 comments
Open

训练报错 #10

dnty opened this issue Sep 9, 2021 · 7 comments

Comments

@dnty
Copy link

dnty commented Sep 9, 2021

您好,我正在复现您的代码。可以正常编译训练,但是运行python tools/train.py --config configs/kd_faster_rcnn/voc_stu_faster_rcnn_r50_FGFI.py报错如下:
请问mmdet里面是不是缺少什么更改过的模块?

2021-09-09 16:41:56,230 - mmdet - INFO - workflow: [('train', 1)], max: 4 epochs
Traceback (most recent call last):
File "tools/train.py", line 176, in
main()
File "tools/train.py", line 172, in main
meta=meta)
File "/home/dgfs/zl/DeFeat/mmdet/apis/train.py", line 476, in train_detector
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "/home/dgfs/anaconda3/envs/defeat/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 127, in run
epoch_runner(data_loaders[i], **kwargs)
File "/home/dgfs/anaconda3/envs/defeat/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 50, in train
self.run_iter(data_batch, train_mode=True, **kwargs)
File "/home/dgfs/anaconda3/envs/defeat/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 27, in run_iter
self.model, data_batch, train_mode=train_mode, **kwargs)
File "/home/dgfs/zl/DeFeat/mmdet/apis/train.py", line 79, in batch_processor
losses = model(**data)
File "/home/dgfs/anaconda3/envs/defeat/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/dgfs/anaconda3/envs/defeat/lib/python3.7/site-packages/mmcv/parallel/data_parallel.py", line 42, in forward
return super().forward(*inputs, **kwargs)
File "/home/dgfs/anaconda3/envs/defeat/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 159, in forward
return self.module(*inputs[0], **kwargs[0])
File "/home/dgfs/anaconda3/envs/defeat/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/dgfs/zl/DeFeat/mmdet/core/fp16/decorators.py", line 49, in new_func
return old_func(*args, **kwargs)
File "/home/dgfs/zl/DeFeat/mmdet/models/detectors/base.py", line 148, in forward
return self.forward_train(img, img_metas, **kwargs)
File "/home/dgfs/zl/DeFeat/mmdet/models/detectors/two_stage_kd.py", line 185, in forward_train
if 'mask-neck-one' in kd_cfg.type:
AttributeError: 'NoneType' object has no attribute 'type'

@ggjy
Copy link
Owner

ggjy commented Sep 9, 2021

如果要用KD的话,应该是 python tools/train_kd.py

@dnty
Copy link
Author

dnty commented Sep 9, 2021 via email

@ma3252788
Copy link

谢谢您啦!但是我用train_kd.py训练又报了另外一个错,UnboundLocalError:local variable'neck_feat_t' referenced before assignment。想再问下您two_stage_kd.py中的kd_cfg是从哪个文件导入的呢?

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2021年9月9日(星期四) 下午5:09 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [ggjy/DeFeat.pytorch] 训练报错 (#10) 如果要用KD的话,应该是 python tools/train_kd.py — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

我也报这个错了。。求解答~~谢谢

@ma3252788
Copy link

2021-09-09 23:32:05,896 - mmdet - INFO - workflow: [('train', 1)], max: 4 epochs
kd_decay rate:  1.0
Traceback (most recent call last):
  File "/home/ubuntu/bigdisk/part1/DeFeat.pytorch/tools/train_kd.py", line 204, in <module>
    main()
  File "/home/ubuntu/bigdisk/part1/DeFeat.pytorch/tools/train_kd.py", line 200, in main
    meta=meta)
  File "/home/ubuntu/bigdisk/part1/DeFeat.pytorch/mmdet/apis/train.py", line 570, in train_detector_kd
    runner.run(data_loaders, cfg.workflow, cfg.total_epochs, kd_cfg=cfg.model.hint_adapt)
  File "/home/ubuntu/bigdisk/part1/DeFeat.pytorch/mmcv/runner/runner_kd.py", line 405, in run
    epoch_runner(data_loaders[i], **kwargs)
  File "/home/ubuntu/bigdisk/part1/DeFeat.pytorch/mmcv/runner/runner_kd.py", line 304, in train
    self.model, self.model_t, data_batch, train_mode=True, kd_warm=kd_warm, kd_decay=kd_decay, epoch=self._epoch, **kwargs)
  File "/home/ubuntu/bigdisk/part1/DeFeat.pytorch/mmdet/apis/train.py", line 328, in batch_processor_kd
    losskd_neck = losskd_neck + (torch.pow(neck_feat_adapt - neck_feat_t[i], 2) * 
UnboundLocalError: local variable 'neck_feat_t' referenced before assignment

@ggjy 谢谢大佬!!

@ma3252788
Copy link

这个好像是config-t这个参数没设置的问题。。设置之后就好了

@dnty
Copy link
Author

dnty commented Sep 10, 2021 via email

@dingdingzuo
Copy link

请问这个config-t怎么设置? @dnty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants