deepinsight / deepinsight/insightface

Error occurs when learning the scrfd model

Open
#2,456 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
29.7k
Forks
6.1k
PR merge metrics
No merged PRs in 30d

Description

Error
```
File "/home/face_detection/mmdet/models/losses/iou_loss.py", line 365, in forward
return (pred * weight).sum() # 0
RuntimeError: The size of tensor a (4) must match the size of tensor b (9) at non-singleton dimension 1
```
```
File "/home/face_detection/mmdet/core/utils/dist_utils.py", line 68, in reduce_mean
dist.all_reduce(tensor.div_(dist.get_world_size()), op=dist.ReduceOp.SUM)
RuntimeError: result type Float can't be cast to the desired output type Long
```
https://github.com/deepinsight/insightface/blob/c2db41402c627cab8ea32d55da591940f2258276/detection/scrfd/mmdet/models/dense_heads/scrfd_head.py#L649

It was a problem caused by avg_factor becoming zero.

I replace
```
avg_factor = reduce_mean(avg_factor).item()
```
to
```
avg_factor = reduce_mean(avg_factor).clamp_(min=1).item()
```

is there any problem?

reference : https://github.com/open-mmlab/mmdetection/issues/4456

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.