updates
This commit is contained in:
parent
563dad3b53
commit
b6d9a742ec
8
train.py
8
train.py
|
@ -20,6 +20,10 @@ last = wdir + 'last.pt'
|
||||||
best = wdir + 'best.pt'
|
best = wdir + 'best.pt'
|
||||||
results_file = 'results.txt'
|
results_file = 'results.txt'
|
||||||
|
|
||||||
|
# last = '../coco/last_sgd273_default_ltrb25x4.pt'
|
||||||
|
# best = '../coco/best_sgd273_default_ltrb25x4.pt'
|
||||||
|
# results_file = '../coco/results_sgd273_default_ltrb25x4.txt'
|
||||||
|
|
||||||
# Hyperparameters (j-series, 50.5 mAP yolov3-320) evolved by @ktian08 https://github.com/ultralytics/yolov3/issues/310
|
# Hyperparameters (j-series, 50.5 mAP yolov3-320) evolved by @ktian08 https://github.com/ultralytics/yolov3/issues/310
|
||||||
hyp = {'giou': 1.582, # giou loss gain
|
hyp = {'giou': 1.582, # giou loss gain
|
||||||
'cls': 27.76, # cls loss gain (CE=~1.0, uCE=~20)
|
'cls': 27.76, # cls loss gain (CE=~1.0, uCE=~20)
|
||||||
|
@ -386,8 +390,8 @@ if __name__ == '__main__':
|
||||||
parser.add_argument('--epochs', type=int, default=273) # 500200 batches at bs 16, 117263 images = 273 epochs
|
parser.add_argument('--epochs', type=int, default=273) # 500200 batches at bs 16, 117263 images = 273 epochs
|
||||||
parser.add_argument('--batch-size', type=int, default=32) # effective bs = batch_size * accumulate = 16 * 4 = 64
|
parser.add_argument('--batch-size', type=int, default=32) # effective bs = batch_size * accumulate = 16 * 4 = 64
|
||||||
parser.add_argument('--accumulate', type=int, default=2, help='batches to accumulate before optimizing')
|
parser.add_argument('--accumulate', type=int, default=2, help='batches to accumulate before optimizing')
|
||||||
parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='cfg file path')
|
parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp-2overlap.cfg', help='cfg file path')
|
||||||
parser.add_argument('--data', type=str, default='data/coco.data', help='*.data file path')
|
parser.add_argument('--data', type=str, default='data/coco_64img.data', help='*.data file path')
|
||||||
parser.add_argument('--multi-scale', action='store_true', help='adjust (67% - 150%) img_size every 10 batches')
|
parser.add_argument('--multi-scale', action='store_true', help='adjust (67% - 150%) img_size every 10 batches')
|
||||||
parser.add_argument('--img-size', type=int, default=416, help='inference size (pixels)')
|
parser.add_argument('--img-size', type=int, default=416, help='inference size (pixels)')
|
||||||
parser.add_argument('--rect', action='store_true', help='rectangular training')
|
parser.add_argument('--rect', action='store_true', help='rectangular training')
|
||||||
|
|
|
@ -644,7 +644,7 @@ def cutout(image, labels):
|
||||||
return inter_area / box2_area
|
return inter_area / box2_area
|
||||||
|
|
||||||
# create random masks
|
# create random masks
|
||||||
scales = [0.5] * 1 # + [0.25] * 4 + [0.125] * 16 # image size fraction
|
scales = [0.5] * 1 # + [0.25] * 4 + [0.125] * 16 + [0.0625] * 64 + [0.03125] * 256 # image size fraction
|
||||||
for s in scales:
|
for s in scales:
|
||||||
mask_h = random.randint(1, int(h * s))
|
mask_h = random.randint(1, int(h * s))
|
||||||
mask_w = random.randint(1, int(w * s))
|
mask_w = random.randint(1, int(w * s))
|
||||||
|
@ -660,7 +660,7 @@ def cutout(image, labels):
|
||||||
image[ymin:ymax, xmin:xmax] = mask_color
|
image[ymin:ymax, xmin:xmax] = mask_color
|
||||||
|
|
||||||
# return unobscured labels
|
# return unobscured labels
|
||||||
if len(labels):
|
if len(labels) and s > 0.03:
|
||||||
box = np.array([xmin, ymin, xmax, ymax], dtype=np.float32)
|
box = np.array([xmin, ymin, xmax, ymax], dtype=np.float32)
|
||||||
ioa = bbox_ioa(box, labels[:, 1:5]) # intersection over area
|
ioa = bbox_ioa(box, labels[:, 1:5]) # intersection over area
|
||||||
labels = labels[ioa < 0.90] # remove >90% obscured labels
|
labels = labels[ioa < 0.90] # remove >90% obscured labels
|
||||||
|
|
Loading…
Reference in New Issue