This commit is contained in:
Glenn Jocher 2019-07-20 15:04:41 +02:00
parent 4816969933
commit 39f63b7110
3 changed files with 6 additions and 8 deletions

View File

@ -120,7 +120,7 @@ def detect(cfg,
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='cfg file path')
parser.add_argument('--data-cfg', type=str, default='data/coco.data', help='coco.data file path')
parser.add_argument('--data', type=str, default='data/coco.data', help='coco.data file path')
parser.add_argument('--weights', type=str, default='weights/yolov3-spp.weights', help='path to weights file')
parser.add_argument('--images', type=str, default='data/samples', help='path to images')
parser.add_argument('--img-size', type=int, default=416, help='inference size (pixels)')

View File

@ -191,7 +191,7 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser(prog='test.py')
parser.add_argument('--batch-size', type=int, default=16, help='size of each image batch')
parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='cfg file path')
parser.add_argument('--data-cfg', type=str, default='data/coco.data', help='coco.data file path')
parser.add_argument('--data', type=str, default='data/coco.data', help='coco.data file path')
parser.add_argument('--weights', type=str, default='weights/yolov3-spp.weights', help='path to weights file')
parser.add_argument('--iou-thres', type=float, default=0.5, help='iou threshold required to qualify as detected')
parser.add_argument('--conf-thres', type=float, default=0.001, help='object confidence threshold')

View File

@ -40,7 +40,7 @@ hyp = {'giou': 1.153, # giou loss gain
'weight_decay': 0.000572, # optimizer weight decay
'hsv_s': 0.5, # image HSV-Saturation augmentation (fraction)
'hsv_v': 0.5, # image HSV-Value augmentation (fraction)
'degrees': 10, # image rotation (+/- deg)
'degrees': 5, # image rotation (+/- deg)
'translate': 0.1, # image translation (+/- fraction)
'scale': 0.1, # image scale (+/- gain)
'shear': 2} # image shear (+/- deg)
@ -339,7 +339,7 @@ if __name__ == '__main__':
parser.add_argument('--batch-size', type=int, default=16, help='batch size')
parser.add_argument('--accumulate', type=int, default=4, help='number of batches to accumulate before optimizing')
parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='cfg file path')
parser.add_argument('--data-cfg', type=str, default='data/coco_64img.data', help='coco.data file path')
parser.add_argument('--data', type=str, default='data/coco_64img.data', help='coco.data file path')
parser.add_argument('--multi-scale', action='store_true', help='train at (1/1.5)x - 1.5x sizes')
parser.add_argument('--img-size', type=int, default=416, help='inference size (pixels)')
parser.add_argument('--rect', action='store_true', help='rectangular training')
@ -369,10 +369,8 @@ if __name__ == '__main__':
# Evolve hyperparameters (optional)
if opt.evolve:
gen = 1000 # generations to evolve
print_mutation(hyp, results) # Write mutation results
for _ in range(gen):
for _ in range(1000): # generations to evolve
# Get best hyperparameters
x = np.loadtxt('evolve.txt', ndmin=2)
fitness = x[:, 2] * 0.5 + x[:, 3] * 0.5 # fitness as weighted combination of mAP and F1
@ -385,7 +383,7 @@ if __name__ == '__main__':
s = [.15, .15, .15, .15, .15, .15, .15, .15, .15, .00, .05, .10, .15, .15, .15, .15, .15, .15] # sigmas
for i, k in enumerate(hyp.keys()):
x = (np.random.randn(1) * s[i] + 1) ** 2.0 # plt.hist(x.ravel(), 300)
hyp[k] *= float(x) # vary by 20% 1sigma
hyp[k] *= float(x) # vary by sigmas
# Clip to limits
keys = ['lr0', 'iou_t', 'momentum', 'weight_decay', 'hsv_s', 'hsv_v', 'translate', 'scale']