Commit
·
f06e2d5
1
Parent(s):
69ff781
opt.image_weights bug fix (#885)
Browse files
train.py
CHANGED
@@ -216,7 +216,7 @@ def train(hyp, opt, device, tb_writer=None):
|
|
216 |
model.train()
|
217 |
|
218 |
# Update image weights (optional)
|
219 |
-
if opt.
|
220 |
# Generate indices
|
221 |
if rank in [-1, 0]:
|
222 |
cw = model.class_weights.cpu().numpy() * (1 - maps) ** 2 # class weights
|
@@ -386,7 +386,6 @@ if __name__ == '__main__':
|
|
386 |
parser.add_argument('--epochs', type=int, default=300)
|
387 |
parser.add_argument('--batch-size', type=int, default=16, help='total batch size for all GPUs')
|
388 |
parser.add_argument('--img-size', nargs='+', type=int, default=[640, 640], help='[train, test] image sizes')
|
389 |
-
parser.add_argument('--img-weights', action='store_true', help='use weighted image selection for training')
|
390 |
parser.add_argument('--rect', action='store_true', help='rectangular training')
|
391 |
parser.add_argument('--resume', nargs='?', const=True, default=False, help='resume most recent training')
|
392 |
parser.add_argument('--nosave', action='store_true', help='only save final checkpoint')
|
@@ -395,6 +394,7 @@ if __name__ == '__main__':
|
|
395 |
parser.add_argument('--evolve', action='store_true', help='evolve hyperparameters')
|
396 |
parser.add_argument('--bucket', type=str, default='', help='gsutil bucket')
|
397 |
parser.add_argument('--cache-images', action='store_true', help='cache images for faster training')
|
|
|
398 |
parser.add_argument('--name', default='', help='renames results.txt to results_name.txt if supplied')
|
399 |
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
|
400 |
parser.add_argument('--multi-scale', action='store_true', help='vary img-size +/- 50%%')
|
|
|
216 |
model.train()
|
217 |
|
218 |
# Update image weights (optional)
|
219 |
+
if opt.image_weights:
|
220 |
# Generate indices
|
221 |
if rank in [-1, 0]:
|
222 |
cw = model.class_weights.cpu().numpy() * (1 - maps) ** 2 # class weights
|
|
|
386 |
parser.add_argument('--epochs', type=int, default=300)
|
387 |
parser.add_argument('--batch-size', type=int, default=16, help='total batch size for all GPUs')
|
388 |
parser.add_argument('--img-size', nargs='+', type=int, default=[640, 640], help='[train, test] image sizes')
|
|
|
389 |
parser.add_argument('--rect', action='store_true', help='rectangular training')
|
390 |
parser.add_argument('--resume', nargs='?', const=True, default=False, help='resume most recent training')
|
391 |
parser.add_argument('--nosave', action='store_true', help='only save final checkpoint')
|
|
|
394 |
parser.add_argument('--evolve', action='store_true', help='evolve hyperparameters')
|
395 |
parser.add_argument('--bucket', type=str, default='', help='gsutil bucket')
|
396 |
parser.add_argument('--cache-images', action='store_true', help='cache images for faster training')
|
397 |
+
parser.add_argument('--image-weights', action='store_true', help='use weighted image selection for training')
|
398 |
parser.add_argument('--name', default='', help='renames results.txt to results_name.txt if supplied')
|
399 |
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
|
400 |
parser.add_argument('--multi-scale', action='store_true', help='vary img-size +/- 50%%')
|