Skip to content

Commit

Permalink
Correct mutation adding the missing parameters
Browse files Browse the repository at this point in the history
Correct mutation considering the higher number of segmentation parameters compared to object detection.

Fixes ultralytics#9730

Signed-off-by: Iker Lluvia <iker.lluvia@tekniker.es>
  • Loading branch information
iker-lluvia committed Mar 3, 2023
1 parent 5c91dae commit 76f75bc
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions segment/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def main(opt, callbacks=Callbacks()):
while all(v == 1): # mutate until a change occurs (prevent duplicates)
v = (g * (npr.random(ng) < mp) * npr.randn(ng) * npr.random() * s + 1).clip(0.3, 3.0)
for i, k in enumerate(hyp.keys()): # plt.hist(v.ravel(), 300)
hyp[k] = float(x[i + 7] * v[i]) # mutate
hyp[k] = float(x[i + 12] * v[i]) # mutate

# Constrain to limits
for k, v in meta.items():
Expand All @@ -641,7 +641,21 @@ def main(opt, callbacks=Callbacks()):
results = train(hyp.copy(), opt, device, callbacks)
callbacks = Callbacks()
# Write mutation results
print_mutation(KEYS, results, hyp.copy(), save_dir, opt.bucket)
keys = (
'metrics/precision(B)',
'metrics/recall(B)',
'metrics/mAP_0.5(B)',
'metrics/mAP_0.5:0.95(B)', # metrics
'metrics/precision(M)',
'metrics/recall(M)',
'metrics/mAP_0.5(M)',
'metrics/mAP_0.5:0.95(M)', # metrics
'val/box_loss',
'val/obj_loss',
'val/cls_loss',
'val/seg_loss' # val loss
)
print_mutation(keys, results, hyp.copy(), save_dir, opt.bucket)

# Plot results
plot_evolve(evolve_csv)
Expand Down

0 comments on commit 76f75bc

Please sign in to comment.