diff --git a/train.py b/train.py index dc8dce05..5509b550 100644 --- a/train.py +++ b/train.py @@ -65,8 +65,8 @@ def train(): multi_scale = opt.multi_scale if multi_scale: - img_sz_min = round(img_size / 32 / 1.5) + 1 - img_sz_max = round(img_size / 32 * 1.5) - 1 + img_sz_min = round(img_size / 32 / 1.5) + img_sz_max = round(img_size / 32 * 1.5) img_size = img_sz_max * 32 # initiate with maximum multi_scale size print('Using multi-scale %g - %g' % (img_sz_min * 32, img_size)) @@ -383,10 +383,15 @@ def train(): def prebias(): # trains output bias layers for 1 epoch and creates new backbone if opt.prebias: + a = opt.img_weights # save settings + opt.img_weights = False # disable settings + train() # transfer-learn yolo biases for 1 epoch create_backbone(last) # saved results as backbone.pt + opt.weights = wdir + 'backbone.pt' # assign backbone opt.prebias = False # disable prebias + opt.img_weights = a # reset settings if __name__ == '__main__': @@ -407,7 +412,7 @@ if __name__ == '__main__': parser.add_argument('--bucket', type=str, default='', help='gsutil bucket') parser.add_argument('--img-weights', action='store_true', help='select training images by weight') parser.add_argument('--cache-images', action='store_true', help='cache images for faster training') - parser.add_argument('--weights', type=str, default='weights/yolov3-spp.weights', help='initial weights') + parser.add_argument('--weights', type=str, default='', help='initial weights') parser.add_argument('--arc', type=str, default='default', help='yolo architecture') # defaultpw, uCE, uBCE parser.add_argument('--prebias', action='store_true', help='transfer-learn yolo biases prior to training') parser.add_argument('--name', default='', help='renames results.txt to results_name.txt if supplied')