Repository: ultralytics/yolov5

Issue:
DDP wandb utils not running check_file() on --data
## 🐛 Bug

@AyushExel I found a bit of a bug today on starting a DDP training with `--data coco.yaml`. All our main python files (train, test, detect) are set up so that files passed to the argparser are searched locally inside the yolov5 repo using `file = check_file(file)`. This allows for more concise commands like --cfg yolov5s.yaml rather than --cfg models/yolov5s.yaml, but it looks like opt.data got passed to the wandb utils before it had a chance to pass through check_file() first. Should be an easy fix, I think I can do this tomorrow.

<img width="1214" alt="Screenshot 2021-05-05 at 01 46 55" src="https://user-images.githubusercontent.com/26833433/117083255-94c12780-ad44-11eb-85c2-48bef8943717.png">

## To Reproduce (REQUIRED)

Start DDP training with `--data coco.yaml`
```
 python -m torch.distributed.launch --nproc_per_node 2 --master_port 1 train.py --batch 64 --cfg yolov5x.yaml --weights '' --data coco.yaml
```

Question about calculating mAP at test time
## ❔Question
Thank you for your work, I really enjoyed running the codes.

I was trying to understand the way we calculate mAP by reading the [test.py](https://github.com/ultralytics/yolov5/blob/master/test.py)
At line [197](https://github.com/ultralytics/yolov5/blob/master/test.py#L197), as I understood, the IoU values (`ious`) wasn't sorted before the further process (lines [199-211](https://github.com/ultralytics/yolov5/blob/master/test.py#L199-L211)).
Therefore, I think it doesn't guarantee that we find the best IoU (or a detected box) for a ground-truth box.
For example, a detected box is considered correct if the IoU with a ground-truth box is >= 0.5. However, there are possibilities that we detected multiple boxes with different IoU values. In this case, I think we should assign the box with the highest IoU as the correctly detected box.

Will the code affect the result of calculating mAP?

## Additional context
The comments in lines [191-192](https://github.com/ultralytics/yolov5/blob/master/test.py#L191-L192) (`# prediction indices`, `# target indices`) should be swapped, shouldn't they?


Discussion:

Resolving patch:
diff --git a/hubconf.py b/hubconf.py
--- a/hubconf.py
+++ b/hubconf.py
@@ -70,6 +70,11 @@ def custom(path='path/to/model.pt', autoshape=True, verbose=True, device=None):
     return _create(path, autoshape=autoshape, verbose=verbose, device=device)
 
 
+def yolov5n(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
+    # YOLOv5-nano model https://github.com/ultralytics/yolov5
+    return _create('yolov5n', pretrained, channels, classes, autoshape, verbose, device)
+
+
 def yolov5s(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
     # YOLOv5-small model https://github.com/ultralytics/yolov5
     return _create('yolov5s', pretrained, channels, classes, autoshape, verbose, device)
@@ -90,6 +95,11 @@ def yolov5x(pretrained=True, channels=3, classes=80, autoshape=True, verbose=Tru
     return _create('yolov5x', pretrained, channels, classes, autoshape, verbose, device)
 
 
+def yolov5n6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
+    # YOLOv5-nano-P6 model https://github.com/ultralytics/yolov5
+    return _create('yolov5n6', pretrained, channels, classes, autoshape, verbose, device)
+
+
 def yolov5s6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
     # YOLOv5-small-P6 model https://github.com/ultralytics/yolov5
     return _create('yolov5s6', pretrained, channels, classes, autoshape, verbose, device)


Test patch: