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:
epochs: 600
batch-size: 8
epochs: 1200
batch-size: 3
cfg: ./cfg/yolov3-spp-19cls.cfg
data: ./data/widok_01_19.data
multi-scale: false
img-size: '512 960'
rect: false
resume: true
img-size: '512 1920'
rect: true
resume: false
nosave: false
notest: false
evolve: false
bucket:
cache-images: false
weights: /home/tomekb/yolov3/weights/last.pt
weights: /home/tomekb/yolov3/weights/yolov3-spp-ultralytics.pt
device: 1
adam: true
single-cls: false
save-every-nth-epoch: 50
# inne hiperparametry
other-hyps:
@ -42,7 +43,7 @@ experiments:
dir: ./experiments
detect:
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
iou-thres: 0.6
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(),
'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
torch.save(chkpt, last)
if (best_fitness == fi) and not final_epoch:
torch.save(chkpt, best)
del chkpt
# end epoch ----------------------------------------------------------------------------------------------------
# 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('--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('--save-every-nth-epoch', type=int, help='Saving every n-th epoth')
opt = parser.parse_args()
#opt.weights = last if opt.resume else opt.weights
check_git_status()
#check_git_status()
opt.cfg = check_file(opt.cfg) # check file
opt.data = check_file(opt.data) # check file
#print(opt)