mirror of
https://github.com/WongKinYiu/yolov7.git
synced 2025-02-17 12:50:14 +08:00
main code
update anchor https://github.com/WongKinYiu/yolov7/issues/272
This commit is contained in:
parent
54d3908a0c
commit
3708cdedd2
@ -51,8 +51,8 @@ def check_anchors(dataset, model, thr=4.0, imgsz=640):
|
||||
if new_bpr > bpr: # replace anchors
|
||||
anchors = torch.tensor(anchors, device=m.anchors.device).type_as(m.anchors)
|
||||
m.anchor_grid[:] = anchors.clone().view_as(m.anchor_grid) # for inference
|
||||
m.anchors[:] = anchors.clone().view_as(m.anchors) / m.stride.to(m.anchors.device).view(-1, 1, 1) # loss
|
||||
check_anchor_order(m)
|
||||
m.anchors[:] = anchors.clone().view_as(m.anchors) / m.stride.to(m.anchors.device).view(-1, 1, 1) # loss
|
||||
print(f'{prefix}New anchors saved to model. Update model *.yaml to use these anchors in the future.')
|
||||
else:
|
||||
print(f'{prefix}Original anchors better than new anchors. Proceeding with original anchors.')
|
||||
|
Loading…
Reference in New Issue
Block a user