WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.18k stars 4.17k forks source link

Logging dataset artifact fails when using single class training (--upload-dataset --single-cls) #261

Open vnoblet-nanovare opened 2 years ago

vnoblet-nanovare commented 2 years ago

Maybe consider replacing: nc, names = (1, ['item']) if single_cls else (int(data['nc']), data['names']) by: nc, names = int(data['nc']), data['names'] in order to have the dataset tables conserve the original class

Or else consider fixing the followinf code

        box_data.append({"position": {"minX": xyxy[0], "minY": xyxy[1], "maxX": xyxy[2], "maxY": xyxy[3]},
                               "class_id": cls,
                               "box_caption": "%s" % (class_to_id[cls]),
                               "scores": {"acc": 1},
                               "domain": "pixel"})
              img_classes[cls] = class_to_id[cls]
vnoblet-nanovare commented 2 years ago

After fixing this part, I have another error :

Traceback (most recent call last): File "train.py", line 622, in <module> train(hyp, opt, device, tb_writer) File "train.py", line 72, in train wandb_logger = WandbLogger(opt, Path(opt.save_dir).stem, run_id, data_dict) File "/mnt/batch/tasks/shared/LS_root/jobs/workspace_test/azureml/coral_panda_cc10fxj3z2/wd/azureml/coral_panda_cc10fxj3z2/utils/wandb_logging/wandb_utils.py", line 107, in __init__ self.wandb_run.config.data_dict = wandb_data_dict File "/azureml-envs/pytorch-1.9/lib/python3.7/site-packages/wandb/sdk/wandb_config.py", line 147, in __setitem__ self._raise_value_error_on_nested_artifact(val, nested=True) File "/azureml-envs/pytorch-1.9/lib/python3.7/site-packages/wandb/sdk/wandb_config.py", line 266, in _raise_value_error_on_nested_artifact "Instances of wandb.Artifact and wandb.apis.public.Artifact" ValueError: Instances of wandb.Artifact and wandb.apis.public.Artifact can only be top level keys in wandb.config wandb: Waiting for W&B process to finish... (failed 1). Press Control-C to abort syncing.