Download scripts/facelib/detection/yolov5face/utils/autoanchor.py from killbill007/backup: direct link, hf CLI and curl.
- Browser
- Download file 460 Bytes
-
https://huggingface.co/killbill007/backup/resolve/main/scripts/facelib/detection/yolov5face/utils/autoanchor.py
- Command line
-
hf download hf://killbill007/backup/scripts/facelib/detection/yolov5face/utils/autoanchor.py
-
curl -L -o autoanchor.py https://huggingface.co/killbill007/backup/resolve/main/scripts/facelib/detection/yolov5face/utils/autoanchor.py
460 Bytes
| # Auto-anchor utils | |
| def check_anchor_order(m): | |
| # Check anchor order against stride order for YOLOv5 Detect() module m, and correct if necessary | |
| a = m.anchor_grid.prod(-1).view(-1) # anchor area | |
| da = a[-1] - a[0] # delta a | |
| ds = m.stride[-1] - m.stride[0] # delta s | |
| if da.sign() != ds.sign(): # same order | |
| print("Reversing anchor order") | |
| m.anchors[:] = m.anchors.flip(0) | |
| m.anchor_grid[:] = m.anchor_grid.flip(0) | |