Repository: ultralytics/yolov5

Issue:
it seems that check_wandb_resume don't support multiple input files of images.
it's just a minor bug about compatibility


## 🐛 Bug
for form2) or 3) in dataset yaml
```
# train and val data as 1) directory: path/images/, 2) file: path/images.txt, or 3) list: [path1/images/, path2/images/]
```

The `data_dict['train']`  and `data_dict['val']` are list in here.
```
if data_dict['train'].startswith(WANDB_ARTIFACT_PREFIX):
    ...

if data_dict['val'].startswith(WANDB_ARTIFACT_PREFIX):
   ...

```


## To Reproduce (REQUIRED)

Input:
```
train:
  [
    /path/image_list1.txt,
    /path/image_list2.txt,
    /path/image_list3.txt
  ]
```

Output:
```
YOLOv5 🚀 v4.0-185-g74276d5 torch 1.7.1+cu101 CUDA:0 (GeForce RTX 2080 Ti, 10989.4375MB)
                                             CUDA:1 (GeForce RTX 2080 Ti, 10989.4375MB)
                                             CUDA:2 (GeForce RTX 2080 Ti, 10989.4375MB)
                                             CUDA:3 (GeForce RTX 2080 Ti, 10989.4375MB)

    if data_dict['train'].startswith(WANDB_ARTIFACT_PREFIX):
AttributeError: 'list' object has no attribute 'startswith'
```


## Environment
If applicable, add screenshots to help explain your problem.

 - OS: [Ubuntu]
 - GPU [2080 Ti]



Discussion:

Resolving patch:
diff --git a/utils/wandb_logging/wandb_utils.py b/utils/wandb_logging/wandb_utils.py
--- a/utils/wandb_logging/wandb_utils.py
+++ b/utils/wandb_logging/wandb_utils.py
@@ -57,14 +57,14 @@ def process_wandb_config_ddp_mode(opt):
     with open(opt.data) as f:
         data_dict = yaml.load(f, Loader=yaml.SafeLoader)  # data dict
     train_dir, val_dir = None, None
-    if data_dict['train'].startswith(WANDB_ARTIFACT_PREFIX):
+    if isinstance(data_dict['train'], str) and data_dict['train'].startswith(WANDB_ARTIFACT_PREFIX):
         api = wandb.Api()
         train_artifact = api.artifact(remove_prefix(data_dict['train']) + ':' + opt.artifact_alias)
         train_dir = train_artifact.download()
         train_path = Path(train_dir) / 'data/images/'
         data_dict['train'] = str(train_path)
         
-    if data_dict['val'].startswith(WANDB_ARTIFACT_PREFIX):
+    if isinstance(data_dict['val'], str) and data_dict['val'].startswith(WANDB_ARTIFACT_PREFIX):
         api = wandb.Api()
         val_artifact = api.artifact(remove_prefix(data_dict['val']) + ':' + opt.artifact_alias)
         val_dir = val_artifact.download()
@@ -158,7 +158,7 @@ def setup_training(self, opt, data_dict):
         return data_dict
 
     def download_dataset_artifact(self, path, alias):
-        if path and path.startswith(WANDB_ARTIFACT_PREFIX):
+        if isinstance(path, str) and path.startswith(WANDB_ARTIFACT_PREFIX):
             dataset_artifact = wandb.use_artifact(remove_prefix(path, WANDB_ARTIFACT_PREFIX) + ":" + alias)
             assert dataset_artifact is not None, "'Error: W&B dataset artifact doesn\'t exist'"
             datadir = dataset_artifact.download()
@@ -229,7 +229,9 @@ def map_val_table_path(self):
     def create_dataset_table(self, dataset, class_to_id, name='dataset'):
         # TODO: Explore multiprocessing to slpit this loop parallely| This is essential for speeding up the the logging
         artifact = wandb.Artifact(name=name, type="dataset")
-        for img_file in tqdm([dataset.path]) if Path(dataset.path).is_dir() else tqdm(dataset.img_files):
+        img_files = tqdm([dataset.path]) if isinstance(dataset.path, str) and Path(dataset.path).is_dir() else None
+        img_files = tqdm(dataset.img_files) if not img_files else img_files
+        for img_file in img_files:
             if Path(img_file).is_dir():
                 artifact.add_dir(img_file, name='data/images')
                 labels_path = 'labels'.join(dataset.path.rsplit('images', 1))


Test patch: