Allow list for Comet artifact class 'names' field (#9654)

* Update __init__.py

In the Comet logger, when I run train.py, it wants to download the data artifact. It was requiring me to format the 'names' field in the data artifact metadata as a dictionary, so I've changed this so that it also accepts a list.

Signed-off-by: KristenKehrer <34010022+KristenKehrer@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update utils/loggers/comet/__init__.py

Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com>
Signed-off-by: KristenKehrer <34010022+KristenKehrer@users.noreply.github.com>

Signed-off-by: KristenKehrer <34010022+KristenKehrer@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
authored and GitHub committed 2022-10-03 00:25:10 +02:00
1 parent 1158a50abd
commit c98128fe71
1 file changed
+8 -1
+8 -1
View File
@@ -353,7 +353,14 @@ class CometLogger:
metadata = logged_artifact.metadata
data_dict = metadata.copy()
data_dict["path"] = artifact_save_dir
data_dict["names"] = {int(k): v for k, v in metadata.get("names").items()}
metadata_names = metadata.get("names")
if type(metadata_names) == dict:
data_dict["names"] = {int(k): v for k, v in metadata.get("names").items()}
elif type(metadata_names) == list:
data_dict["names"] = {int(k): v for k, v in zip(range(len(metadata_names)), metadata_names)}
else:
raise "Invalid 'names' field in dataset yaml file. Please use a list or dictionary"
data_dict = self.update_data_paths(data_dict)
return data_dict