From 025694f22cadaf9010dbd2c816b095ea07b5766e Mon Sep 17 00:00:00 2001 From: Le0v1n Date: Tue, 21 May 2024 10:45:07 +0800 Subject: [PATCH 1/4] Added warning message when --single-cls is used incorrectly --- train.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/train.py b/train.py index df0972a67c70..35e5fd6ccdf0 100644 --- a/train.py +++ b/train.py @@ -176,7 +176,14 @@ def train(hyp, opt, device, callbacks): data_dict = data_dict or check_dataset(data) # check if None train_path, val_path = data_dict["train"], data_dict["val"] nc = 1 if single_cls else int(data_dict["nc"]) # number of classes - names = {0: "item"} if single_cls and len(data_dict["names"]) != 1 else data_dict["names"] # class names + if single_cls and len(data_dict["names"]) != 1: + LOGGER.warning( + "WARNING ⚠️ Please check the dataset to ensure that when --single-cls is enabled, " + "the number of classes in the dataset is 1." + ) + names = {0: "item"} # combine all classes into a single class + else: + names = data_dict["names"] # class names is_coco = isinstance(val_path, str) and val_path.endswith("coco/val2017.txt") # COCO dataset # Model From c2b7d7291ef19a4dfb91e3598f59346e10947efa Mon Sep 17 00:00:00 2001 From: Le0v1n Date: Fri, 24 May 2024 20:34:11 +0800 Subject: [PATCH 2/4] Trigger retest From 5bd14765161289e2b59c7092467724d8915266cb Mon Sep 17 00:00:00 2001 From: Le0v1n Date: Fri, 24 May 2024 20:35:00 +0800 Subject: [PATCH 3/4] re-CI --- train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train.py b/train.py index 35e5fd6ccdf0..e39215501206 100644 --- a/train.py +++ b/train.py @@ -179,7 +179,7 @@ def train(hyp, opt, device, callbacks): if single_cls and len(data_dict["names"]) != 1: LOGGER.warning( "WARNING ⚠️ Please check the dataset to ensure that when --single-cls is enabled, " - "the number of classes in the dataset is 1." + "the number of classes in the dataset is 1." ) names = {0: "item"} # combine all classes into a single class else: From 227789d7dde3a5a77d39d5913f3d35c3a78c39ef Mon Sep 17 00:00:00 2001 From: UltralyticsAssistant Date: Fri, 24 May 2024 12:37:49 +0000 Subject: [PATCH 4/4] Auto-format by https://ultralytics.com/actions --- train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train.py b/train.py index e39215501206..35e5fd6ccdf0 100644 --- a/train.py +++ b/train.py @@ -179,7 +179,7 @@ def train(hyp, opt, device, callbacks): if single_cls and len(data_dict["names"]) != 1: LOGGER.warning( "WARNING ⚠️ Please check the dataset to ensure that when --single-cls is enabled, " - "the number of classes in the dataset is 1." + "the number of classes in the dataset is 1." ) names = {0: "item"} # combine all classes into a single class else: