This commit is contained in:
tomasz 2020-07-02 18:10:02 +02:00
parent 2655ba89c6
commit 07f4525d0c
3 changed files with 13 additions and 8 deletions

View File

@ -1,21 +1,22 @@
train: train:
epochs: 600 epochs: 1200
batch-size: 8 batch-size: 3
cfg: ./cfg/yolov3-spp-19cls.cfg cfg: ./cfg/yolov3-spp-19cls.cfg
data: ./data/widok_01_19.data data: ./data/widok_01_19.data
multi-scale: false multi-scale: false
img-size: '512 960' img-size: '512 1920'
rect: false rect: true
resume: true resume: false
nosave: false nosave: false
notest: false notest: false
evolve: false evolve: false
bucket: bucket:
cache-images: false cache-images: false
weights: /home/tomekb/yolov3/weights/last.pt weights: /home/tomekb/yolov3/weights/yolov3-spp-ultralytics.pt
device: 1 device: 1
adam: true adam: true
single-cls: false single-cls: false
save-every-nth-epoch: 50
# inne hiperparametry # inne hiperparametry
other-hyps: other-hyps:
@ -42,7 +43,7 @@ experiments:
dir: ./experiments dir: ./experiments
detect: detect:
source: /home/tomekb/yolov3/data/widok_01_19/widok_01_19_test_labels.txt source: /home/tomekb/yolov3/data/widok_01_19/widok_01_19_test_labels.txt
test-img-size: 1024 test-img-size: 1920
conf-thres: 0.3 conf-thres: 0.3
iou-thres: 0.6 iou-thres: 0.6
classes: classes:

View File

@ -349,12 +349,15 @@ def train(hyp):
'model': ema.ema.module.state_dict() if hasattr(model, 'module') else ema.ema.state_dict(), 'model': ema.ema.module.state_dict() if hasattr(model, 'module') else ema.ema.state_dict(),
'optimizer': None if final_epoch else optimizer.state_dict()} 'optimizer': None if final_epoch else optimizer.state_dict()}
if epoch % opt.save_every_nth_epoch == 0:
torch.save(chkpt, f'yolo_{epoch}.pt')
# Save last, best and delete # Save last, best and delete
torch.save(chkpt, last) torch.save(chkpt, last)
if (best_fitness == fi) and not final_epoch: if (best_fitness == fi) and not final_epoch:
torch.save(chkpt, best) torch.save(chkpt, best)
del chkpt del chkpt
# end epoch ---------------------------------------------------------------------------------------------------- # end epoch ----------------------------------------------------------------------------------------------------
# end training # end training
@ -397,9 +400,10 @@ if __name__ == '__main__':
parser.add_argument('--device', default='', help='device id (i.e. 0 or 0,1 or cpu)') parser.add_argument('--device', default='', help='device id (i.e. 0 or 0,1 or cpu)')
parser.add_argument('--adam', action='store_true', help='use adam optimizer') parser.add_argument('--adam', action='store_true', help='use adam optimizer')
parser.add_argument('--single-cls', action='store_true', help='train as single-class dataset') parser.add_argument('--single-cls', action='store_true', help='train as single-class dataset')
parser.add_argument('--save-every-nth-epoch', type=int, help='Saving every n-th epoth')
opt = parser.parse_args() opt = parser.parse_args()
#opt.weights = last if opt.resume else opt.weights #opt.weights = last if opt.resume else opt.weights
check_git_status() #check_git_status()
opt.cfg = check_file(opt.cfg) # check file opt.cfg = check_file(opt.cfg) # check file
opt.data = check_file(opt.data) # check file opt.data = check_file(opt.data) # check file
#print(opt) #print(opt)