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

AttributeError: 'BboxLoss' object has no attribute 'dfl_loss' #442

Open
1343464520 opened this issue Nov 28, 2024 · 0 comments
Open

AttributeError: 'BboxLoss' object has no attribute 'dfl_loss' #442

1343464520 opened this issue Nov 28, 2024 · 0 comments

Comments

@1343464520
Copy link

训练时出现这个问题,不知道是啥原因。请帮忙看看,谢谢!

Plotting labels to runs\detect\pruning_task_2\step_0_finetune\labels.jpg...
optimizer: 'optimizer=auto' found, ignoring 'lr0=0.01' and 'momentum=0.937' and determining best 'optimizer', 'lr0' and 'momentum' automatically...
optimizer: AdamW(lr=0.001429, momentum=0.9) with parameter groups 65 weight(decay=0.0), 72 weight(decay=0.0005), 71 bias(decay=0.0)
Image sizes 640 train, 640 val
Using 8 dataloader workers
Logging results to runs\detect\pruning_task_2\step_0_finetune
Starting training for 60 epochs...

  Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size

0%| | 0/216 [00:00<?, ?it/s]
Traceback (most recent call last):
File "D:\Model_Pruning\Torch-Pruning\examples\yolov8\yolov8_pruning.py", line 422, in
prune(args)
File "D:\Model_Pruning\Torch-Pruning\examples\yolov8\yolov8_pruning.py", line 373, in prune
model.train_v2(pruning=True, **pruning_cfg)
File "D:\Model_Pruning\Torch-Pruning\examples\yolov8\yolov8_pruning.py", line 270, in train_v2
self.trainer.train()
File "D:\software\anaconda\envs\pruning\Lib\site-packages\ultralytics\engine\trainer.py", line 207, in train
self._do_train(world_size)
File "D:\software\anaconda\envs\pruning\Lib\site-packages\ultralytics\engine\trainer.py", line 380, in _do_train
self.loss, self.loss_items = self.model(batch)
^^^^^^^^^^^^^^^^^
File "D:\software\anaconda\envs\pruning\Lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\anaconda\envs\pruning\Lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\anaconda\envs\pruning\Lib\site-packages\ultralytics\nn\tasks.py", line 111, in forward
return self.loss(x, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\anaconda\envs\pruning\Lib\site-packages\ultralytics\nn\tasks.py", line 293, in loss
return self.criterion(preds, batch)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\anaconda\envs\pruning\Lib\site-packages\ultralytics\utils\loss.py", line 255, in call
loss[0], loss[2] = self.bbox_loss(
^^^^^^^^^^^^^^^
File "D:\software\anaconda\envs\pruning\Lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\anaconda\envs\pruning\Lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\anaconda\envs\pruning\Lib\site-packages\ultralytics\utils\loss.py", line 106, in forward
if self.dfl_loss:
^^^^^^^^^^^^^
File "D:\software\anaconda\envs\pruning\Lib\site-packages\torch\nn\modules\module.py", line 1931, in getattr
raise AttributeError(
AttributeError: 'BboxLoss' object has no attribute 'dfl_loss'

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

1 participant