yolov5 regress updates to yolov3
This commit is contained in:
+2
-4
@@ -365,9 +365,8 @@ def compute_loss(p, targets, model): # predictions, targets, model
|
||||
|
||||
nb = b.shape[0] # number of targets
|
||||
if nb:
|
||||
nt += nb
|
||||
nt += nb # cumulative targets
|
||||
ps = pi[b, a, gj, gi] # prediction subset corresponding to targets
|
||||
# ps[:, 2:4] = torch.sigmoid(ps[:, 2:4]) # wh power loss (uncomment)
|
||||
|
||||
# GIoU
|
||||
pxy = torch.sigmoid(ps[:, 0:2])
|
||||
@@ -408,7 +407,6 @@ def compute_loss(p, targets, model): # predictions, targets, model
|
||||
|
||||
def build_targets(p, targets, model):
|
||||
# Build targets for compute_loss(), input targets(image,class,x,y,w,h)
|
||||
|
||||
nt = targets.shape[0]
|
||||
tcls, tbox, indices, anch = [], [], [], []
|
||||
gain = torch.ones(6, device=targets.device) # normalized to gridspace gain
|
||||
@@ -647,7 +645,7 @@ def coco_single_class_labels(path='../coco/labels/train2014/', label_class=43):
|
||||
shutil.copyfile(src=img_file, dst='new/images/' + Path(file).name.replace('txt', 'jpg')) # copy images
|
||||
|
||||
|
||||
def kmean_anchors(path='./data/coco64.txt', n=9, img_size=(320, 1024), thr=0.20, gen=1000):
|
||||
def kmean_anchors(path='./data/coco64.txt', n=9, img_size=(640, 640), thr=0.20, gen=1000):
|
||||
# Creates kmeans anchors for use in *.cfg files: from utils.utils import *; _ = kmean_anchors()
|
||||
# n: number of anchors
|
||||
# img_size: (min, max) image size used for multi-scale training (can be same values)
|
||||
|
||||
Reference in New Issue
Block a user