Add codeformer and update license
This commit is contained in:
12
facelib/detection/yolov5face/utils/autoanchor.py
Normal file
12
facelib/detection/yolov5face/utils/autoanchor.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# 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)
|
||||
Reference in New Issue
Block a user