|
|
@@ -382,6 +382,8 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary |
|
|
|
torch.save(ckpt, last) |
|
|
|
if best_fitness == fi: |
|
|
|
torch.save(ckpt, best) |
|
|
|
if (epoch > 0) and (opt.save_period > 0) and (epoch % opt.save_period == 0): |
|
|
|
torch.save(ckpt, w / f'epoch{epoch}.pt') |
|
|
|
del ckpt |
|
|
|
callbacks.run('on_model_save', last, epoch, final_epoch, best_fitness, fi) |
|
|
|
|
|
|
@@ -453,20 +455,23 @@ def parse_opt(known=False): |
|
|
|
parser.add_argument('--adam', action='store_true', help='use torch.optim.Adam() optimizer') |
|
|
|
parser.add_argument('--sync-bn', action='store_true', help='use SyncBatchNorm, only available in DDP mode') |
|
|
|
parser.add_argument('--workers', type=int, default=8, help='maximum number of dataloader workers') |
|
|
|
parser.add_argument('--entity', default=None, help='W&B entity') |
|
|
|
parser.add_argument('--project', default=ROOT / 'runs/train', help='save to project/name') |
|
|
|
parser.add_argument('--name', default='exp', help='save to project/name') |
|
|
|
parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment') |
|
|
|
parser.add_argument('--quad', action='store_true', help='quad dataloader') |
|
|
|
parser.add_argument('--linear-lr', action='store_true', help='linear LR') |
|
|
|
parser.add_argument('--label-smoothing', type=float, default=0.0, help='Label smoothing epsilon') |
|
|
|
parser.add_argument('--upload_dataset', action='store_true', help='Upload dataset as W&B artifact table') |
|
|
|
parser.add_argument('--bbox_interval', type=int, default=-1, help='Set bounding-box image logging interval for W&B') |
|
|
|
parser.add_argument('--save_period', type=int, default=-1, help='Log model after every "save_period" epoch') |
|
|
|
parser.add_argument('--artifact_alias', type=str, default="latest", help='version of dataset artifact to be used') |
|
|
|
parser.add_argument('--local_rank', type=int, default=-1, help='DDP parameter, do not modify') |
|
|
|
parser.add_argument('--freeze', type=int, default=0, help='Number of layers to freeze. backbone=10, all=24') |
|
|
|
parser.add_argument('--patience', type=int, default=100, help='EarlyStopping patience (epochs without improvement)') |
|
|
|
parser.add_argument('--freeze', type=int, default=0, help='Number of layers to freeze. backbone=10, all=24') |
|
|
|
parser.add_argument('--save-period', type=int, default=-1, help='Save checkpoint every x epochs (disabled if < 1)') |
|
|
|
parser.add_argument('--local_rank', type=int, default=-1, help='DDP parameter, do not modify') |
|
|
|
|
|
|
|
# Weights & Biases arguments |
|
|
|
parser.add_argument('--entity', default=None, help='W&B: Entity') |
|
|
|
parser.add_argument('--upload_dataset', action='store_true', help='W&B: Upload dataset as artifact table') |
|
|
|
parser.add_argument('--bbox_interval', type=int, default=-1, help='W&B: Set bounding-box image logging interval') |
|
|
|
parser.add_argument('--artifact_alias', type=str, default='latest', help='W&B: Version of dataset artifact to use') |
|
|
|
|
|
|
|
opt = parser.parse_known_args()[0] if known else parser.parse_args() |
|
|
|
return opt |
|
|
|
|