updates
This commit is contained in:
parent
1c0d408fbf
commit
a8996d5d3a
14
train.py
14
train.py
|
@ -272,10 +272,16 @@ def train(cfg,
|
||||||
pbar.set_description(s)
|
pbar.set_description(s)
|
||||||
|
|
||||||
# Calculate mAP (always test final epoch, skip first 5 if opt.nosave)
|
# Calculate mAP (always test final epoch, skip first 5 if opt.nosave)
|
||||||
if not (opt.notest or (opt.nosave and epoch < 10)) or epoch == epochs - 1:
|
final_epoch = epoch + 1 == epochs
|
||||||
|
if not (opt.notest or (opt.nosave and epoch < 10)) or final_epoch:
|
||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
results, maps = test.test(cfg, data, batch_size=batch_size, img_size=opt.img_size, model=model,
|
results, maps = test.test(cfg,
|
||||||
conf_thres=0.1)
|
data,
|
||||||
|
batch_size=batch_size,
|
||||||
|
img_size=opt.img_size,
|
||||||
|
model=model,
|
||||||
|
conf_thres=0.001 if final_epoch else 0.1, # 0.1 for speed
|
||||||
|
save_json=final_epoch and 'coco.data' in data)
|
||||||
|
|
||||||
# Write epoch results
|
# Write epoch results
|
||||||
with open('results.txt', 'a') as file:
|
with open('results.txt', 'a') as file:
|
||||||
|
@ -295,7 +301,7 @@ def train(cfg,
|
||||||
best_fitness = fitness
|
best_fitness = fitness
|
||||||
|
|
||||||
# Save training results
|
# Save training results
|
||||||
save = (not opt.nosave) or ((not opt.evolve) and (epoch == epochs - 1))
|
save = (not opt.nosave) or ((not opt.evolve) and final_epoch)
|
||||||
if save:
|
if save:
|
||||||
with open('results.txt', 'r') as file:
|
with open('results.txt', 'r') as file:
|
||||||
# Create checkpoint
|
# Create checkpoint
|
||||||
|
|
Loading…
Reference in New Issue