From 76f75bc64c59ab309828be7079cc77d6c1747d91 Mon Sep 17 00:00:00 2001 From: Iker Lluvia Date: Fri, 3 Mar 2023 14:17:23 +0100 Subject: [PATCH 1/2] Correct mutation adding the missing parameters Correct mutation considering the higher number of segmentation parameters compared to object detection. Fixes #9730 Signed-off-by: Iker Lluvia --- segment/train.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/segment/train.py b/segment/train.py index 2e71de131a8d..fe83840eff81 100644 --- a/segment/train.py +++ b/segment/train.py @@ -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(): @@ -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) From 4790dd82c01c8c0c5851566dc879d29ec1a62998 Mon Sep 17 00:00:00 2001 From: Iker Lluvia Date: Tue, 7 Mar 2023 09:13:54 +0100 Subject: [PATCH 2/2] Use already defined segmentation keys from segment/metrics.py --- segment/train.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/segment/train.py b/segment/train.py index 49615ed69189..8ed75ba63e7c 100644 --- a/segment/train.py +++ b/segment/train.py @@ -641,21 +641,7 @@ def main(opt, callbacks=Callbacks()): results = train(hyp.copy(), opt, device, callbacks) callbacks = Callbacks() # Write mutation results - 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) + print_mutation(KEYS[4:16], results, hyp.copy(), save_dir, opt.bucket) # Plot results plot_evolve(evolve_csv)