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

modify the loss caculation in yolov3_head.py #4

Merged
merged 1 commit into from
Nov 22, 2019
Merged

modify the loss caculation in yolov3_head.py #4

merged 1 commit into from
Nov 22, 2019

Conversation

ausk
Copy link
Contributor

@ausk ausk commented Nov 22, 2019

File "main.py", line 386, in main
    loss_dict = model.forward(imgs, targets, epoch)
  File "/home/workspace/git/python/detection/ASFF/models/yolov3_asff.py", line 149, in forward
    x, anchor_loss, iou_loss, l1_loss, conf_loss, cls_loss = header(fused, targets)
  File "/home/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/workspace/git/python/detection/ASFF/models/yolov3_head.py", line 265, in forward
    loss_wh = (self.l1_loss(output[...,2:4], l1_target[...,2:4],tgt_scale)).sum() / batchsize
  File "/home/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
TypeError: forward() takes 3 positional arguments but 4 were given

Hello, thank you for sharing your great idea and code.

When run training on the coco, I meet an error: TypeError: forward() takes 3 positional arguments but 4 were given as posted. And in the code:

self.l1_loss = nn.L1Loss(reduction='none')

While https://github.com/ruinmessi/ASFF/blob/master/models/yolov3_head.py#L264-L266

loss_xy = (tgt_scale*self.bcewithlog_loss(output[...,:2], l1_target[...,:2])).sum() / batchsize
loss_wh = (self.l1_loss(output[...,2:4], l1_target[...,2:4]),tgt_scale)).sum() / batchsize

Maybe, it should be:

loss_xy = (tgt_scale*self.bcewithlog_loss(output[...,:2], l1_target[...,:2])).sum() / batchsize
loss_wh = (tgt_scale*self.l1_loss(output[...,2:4], l1_target[...,2:4])).sum() / batchsize

```
File "main.py", line 386, in main
    loss_dict = model.forward(imgs, targets, epoch)
  File "/home/workspace/git/python/detection/ASFF/models/yolov3_asff.py", line 149, in forward
    x, anchor_loss, iou_loss, l1_loss, conf_loss, cls_loss = header(fused, targets)
  File "/home/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/workspace/git/python/detection/ASFF/models/yolov3_head.py", line 265, in forward
    loss_wh = (self.l1_loss(output[...,2:4], l1_target[...,2:4],tgt_scale)).sum() / batchsize
  File "/home/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
TypeError: forward() takes 3 positional arguments but 4 were given
```

Hello, thank you for sharing your great idea and code.

When run training on the coco, I meet an error: `TypeError: forward() takes 3 positional arguments but 4 were given` as posted.  And in the code:

```
self.l1_loss = nn.L1Loss(reduction='none')
```

While https://github.com/ruinmessi/ASFF/blob/master/models/yolov3_head.py#L264-L266

```
loss_xy = (tgt_scale*self.bcewithlog_loss(output[...,:2], l1_target[...,:2])).sum() / batchsize
loss_wh = (self.l1_loss(output[...,2:4], l1_target[...,2:4]),tgt_scale)).sum() / batchsize
```

Maybe, it should be:

```
loss_xy = (tgt_scale*self.bcewithlog_loss(output[...,:2], l1_target[...,:2])).sum() / batchsize
loss_wh = (tgt_scale*self.l1_loss(output[...,2:4], l1_target[...,2:4])).sum() / batchsize
```
@GOATmessi8 GOATmessi8 merged commit 1e583da into GOATmessi8:master Nov 22, 2019
@ausk ausk deleted the patch-1 branch November 22, 2019 10:18
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

Successfully merging this pull request may close these issues.

2 participants