We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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?

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `hubconf.py`
Content:
```
1 # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
2 """
3 PyTorch Hub models https://pytorch.org/hub/ultralytics_yolov5/
4 
5 Usage:
6     import torch
7     model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
8 """
9 
10 import torch
11 
12 
13 def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
14     """Creates a specified YOLOv5 model
15 
16     Arguments:
17         name (str): name of model, i.e. 'yolov5s'
18         pretrained (bool): load pretrained weights into the model
19         channels (int): number of input channels
20         classes (int): number of model classes
21         autoshape (bool): apply YOLOv5 .autoshape() wrapper to model
22         verbose (bool): print all information to screen
23         device (str, torch.device, None): device to use for model parameters
24 
25     Returns:
26         YOLOv5 pytorch model
27     """
28     from pathlib import Path
29 
30     from models.yolo import Model
31     from models.experimental import attempt_load
32     from utils.general import check_requirements, set_logging
33     from utils.downloads import attempt_download
34     from utils.torch_utils import select_device
35 
36     file = Path(__file__).resolve()
37     check_requirements(exclude=('tensorboard', 'thop', 'opencv-python'))
38     set_logging(verbose=verbose)
39 
40     save_dir = Path('') if str(name).endswith('.pt') else file.parent
41     path = (save_dir / name).with_suffix('.pt')  # checkpoint path
42     try:
43         device = select_device(('0' if torch.cuda.is_available() else 'cpu') if device is None else device)
44 
45         if pretrained and channels == 3 and classes == 80:
46             model = attempt_load(path, map_location=device)  # download/load FP32 model
47         else:
48             cfg = list((Path(__file__).parent / 'models').rglob(f'{name}.yaml'))[0]  # model.yaml path
49             model = Model(cfg, channels, classes)  # create model
50             if pretrained:
51                 ckpt = torch.load(attempt_download(path), map_location=device)  # load
52                 msd = model.state_dict()  # model state_dict
53                 csd = ckpt['model'].float().state_dict()  # checkpoint state_dict as FP32
54                 csd = {k: v for k, v in csd.items() if msd[k].shape == v.shape}  # filter
55                 model.load_state_dict(csd, strict=False)  # load
56                 if len(ckpt['model'].names) == classes:
57                     model.names = ckpt['model'].names  # set class names attribute
58         if autoshape:
59             model = model.autoshape()  # for file/URI/PIL/cv2/np inputs and NMS
60         return model.to(device)
61 
62     except Exception as e:
63         help_url = 'https://github.com/ultralytics/yolov5/issues/36'
64         s = 'Cache may be out of date, try `force_reload=True`. See %s for help.' % help_url
65         raise Exception(s) from e
66 
67 
68 def custom(path='path/to/model.pt', autoshape=True, verbose=True, device=None):
69     # YOLOv5 custom or local model
70     return _create(path, autoshape=autoshape, verbose=verbose, device=device)
71 
72 
73 def yolov5s(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
74     # YOLOv5-small model https://github.com/ultralytics/yolov5
75     return _create('yolov5s', pretrained, channels, classes, autoshape, verbose, device)
76 
77 
78 def yolov5m(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
79     # YOLOv5-medium model https://github.com/ultralytics/yolov5
80     return _create('yolov5m', pretrained, channels, classes, autoshape, verbose, device)
81 
82 
83 def yolov5l(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
84     # YOLOv5-large model https://github.com/ultralytics/yolov5
85     return _create('yolov5l', pretrained, channels, classes, autoshape, verbose, device)
86 
87 
88 def yolov5x(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
89     # YOLOv5-xlarge model https://github.com/ultralytics/yolov5
90     return _create('yolov5x', pretrained, channels, classes, autoshape, verbose, device)
91 
92 
93 def yolov5s6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
94     # YOLOv5-small-P6 model https://github.com/ultralytics/yolov5
95     return _create('yolov5s6', pretrained, channels, classes, autoshape, verbose, device)
96 
97 
98 def yolov5m6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
99     # YOLOv5-medium-P6 model https://github.com/ultralytics/yolov5
100     return _create('yolov5m6', pretrained, channels, classes, autoshape, verbose, device)
101 
102 
103 def yolov5l6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
104     # YOLOv5-large-P6 model https://github.com/ultralytics/yolov5
105     return _create('yolov5l6', pretrained, channels, classes, autoshape, verbose, device)
106 
107 
108 def yolov5x6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):
109     # YOLOv5-xlarge-P6 model https://github.com/ultralytics/yolov5
110     return _create('yolov5x6', pretrained, channels, classes, autoshape, verbose, device)
111 
112 
113 if __name__ == '__main__':
114     model = _create(name='yolov5s', pretrained=True, channels=3, classes=80, autoshape=True, verbose=True)  # pretrained
115     # model = custom(path='path/to/model.pt')  # custom
116 
117     # Verify inference
118     import cv2
119     import numpy as np
120     from PIL import Image
121     from pathlib import Path
122 
123     imgs = ['data/images/zidane.jpg',  # filename
124             Path('data/images/zidane.jpg'),  # Path
125             'https://ultralytics.com/images/zidane.jpg',  # URI
126             cv2.imread('data/images/bus.jpg')[:, :, ::-1],  # OpenCV
127             Image.open('data/images/bus.jpg'),  # PIL
128             np.zeros((320, 640, 3))]  # numpy
129 
130     results = model(imgs)  # batched inference
131     results.print()
132     results.save()
133
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/hubconf.py b/hubconf.py
--- a/hubconf.py
+++ b/hubconf.py
@@ -70,6 +70,11 @@
     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 @@
     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)

{"golden_diff": "diff --git a/hubconf.py b/hubconf.py\n--- a/hubconf.py\n+++ b/hubconf.py\n@@ -70,6 +70,11 @@\n     return _create(path, autoshape=autoshape, verbose=verbose, device=device)\n \n \n+def yolov5n(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n+    # YOLOv5-nano model https://github.com/ultralytics/yolov5\n+    return _create('yolov5n', pretrained, channels, classes, autoshape, verbose, device)\n+\n+\n def yolov5s(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n     # YOLOv5-small model https://github.com/ultralytics/yolov5\n     return _create('yolov5s', pretrained, channels, classes, autoshape, verbose, device)\n@@ -90,6 +95,11 @@\n     return _create('yolov5x', pretrained, channels, classes, autoshape, verbose, device)\n \n \n+def yolov5n6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n+    # YOLOv5-nano-P6 model https://github.com/ultralytics/yolov5\n+    return _create('yolov5n6', pretrained, channels, classes, autoshape, verbose, device)\n+\n+\n def yolov5s6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n     # YOLOv5-small-P6 model https://github.com/ultralytics/yolov5\n     return _create('yolov5s6', pretrained, channels, classes, autoshape, verbose, device)\n", "issue": "DDP wandb utils not running check_file() on --data\n## \ud83d\udc1b Bug\r\n\r\n@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.\r\n\r\n<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\">\r\n\r\n## To Reproduce (REQUIRED)\r\n\r\nStart DDP training with `--data coco.yaml`\r\n```\r\n python -m torch.distributed.launch --nproc_per_node 2 --master_port 1 train.py --batch 64 --cfg yolov5x.yaml --weights '' --data coco.yaml\r\n```\r\n\nQuestion about calculating mAP at test time\n## \u2754Question\r\nThank you for your work, I really enjoyed running the codes.\r\n\r\nI was trying to understand the way we calculate mAP by reading the [test.py](https://github.com/ultralytics/yolov5/blob/master/test.py)\r\nAt 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)).\r\nTherefore, I think it doesn't guarantee that we find the best IoU (or a detected box) for a ground-truth box.\r\nFor 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.\r\n\r\nWill the code affect the result of calculating mAP?\r\n\r\n## Additional context\r\nThe 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?\n", "before_files": [{"content": "# YOLOv5 \ud83d\ude80 by Ultralytics, GPL-3.0 license\n\"\"\"\nPyTorch Hub models https://pytorch.org/hub/ultralytics_yolov5/\n\nUsage:\n    import torch\n    model = torch.hub.load('ultralytics/yolov5', 'yolov5s')\n\"\"\"\n\nimport torch\n\n\ndef _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    \"\"\"Creates a specified YOLOv5 model\n\n    Arguments:\n        name (str): name of model, i.e. 'yolov5s'\n        pretrained (bool): load pretrained weights into the model\n        channels (int): number of input channels\n        classes (int): number of model classes\n        autoshape (bool): apply YOLOv5 .autoshape() wrapper to model\n        verbose (bool): print all information to screen\n        device (str, torch.device, None): device to use for model parameters\n\n    Returns:\n        YOLOv5 pytorch model\n    \"\"\"\n    from pathlib import Path\n\n    from models.yolo import Model\n    from models.experimental import attempt_load\n    from utils.general import check_requirements, set_logging\n    from utils.downloads import attempt_download\n    from utils.torch_utils import select_device\n\n    file = Path(__file__).resolve()\n    check_requirements(exclude=('tensorboard', 'thop', 'opencv-python'))\n    set_logging(verbose=verbose)\n\n    save_dir = Path('') if str(name).endswith('.pt') else file.parent\n    path = (save_dir / name).with_suffix('.pt')  # checkpoint path\n    try:\n        device = select_device(('0' if torch.cuda.is_available() else 'cpu') if device is None else device)\n\n        if pretrained and channels == 3 and classes == 80:\n            model = attempt_load(path, map_location=device)  # download/load FP32 model\n        else:\n            cfg = list((Path(__file__).parent / 'models').rglob(f'{name}.yaml'))[0]  # model.yaml path\n            model = Model(cfg, channels, classes)  # create model\n            if pretrained:\n                ckpt = torch.load(attempt_download(path), map_location=device)  # load\n                msd = model.state_dict()  # model state_dict\n                csd = ckpt['model'].float().state_dict()  # checkpoint state_dict as FP32\n                csd = {k: v for k, v in csd.items() if msd[k].shape == v.shape}  # filter\n                model.load_state_dict(csd, strict=False)  # load\n                if len(ckpt['model'].names) == classes:\n                    model.names = ckpt['model'].names  # set class names attribute\n        if autoshape:\n            model = model.autoshape()  # for file/URI/PIL/cv2/np inputs and NMS\n        return model.to(device)\n\n    except Exception as e:\n        help_url = 'https://github.com/ultralytics/yolov5/issues/36'\n        s = 'Cache may be out of date, try `force_reload=True`. See %s for help.' % help_url\n        raise Exception(s) from e\n\n\ndef custom(path='path/to/model.pt', autoshape=True, verbose=True, device=None):\n    # YOLOv5 custom or local model\n    return _create(path, autoshape=autoshape, verbose=verbose, device=device)\n\n\ndef yolov5s(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-small model https://github.com/ultralytics/yolov5\n    return _create('yolov5s', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5m(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-medium model https://github.com/ultralytics/yolov5\n    return _create('yolov5m', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5l(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-large model https://github.com/ultralytics/yolov5\n    return _create('yolov5l', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5x(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-xlarge model https://github.com/ultralytics/yolov5\n    return _create('yolov5x', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5s6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-small-P6 model https://github.com/ultralytics/yolov5\n    return _create('yolov5s6', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5m6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-medium-P6 model https://github.com/ultralytics/yolov5\n    return _create('yolov5m6', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5l6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-large-P6 model https://github.com/ultralytics/yolov5\n    return _create('yolov5l6', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5x6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-xlarge-P6 model https://github.com/ultralytics/yolov5\n    return _create('yolov5x6', pretrained, channels, classes, autoshape, verbose, device)\n\n\nif __name__ == '__main__':\n    model = _create(name='yolov5s', pretrained=True, channels=3, classes=80, autoshape=True, verbose=True)  # pretrained\n    # model = custom(path='path/to/model.pt')  # custom\n\n    # Verify inference\n    import cv2\n    import numpy as np\n    from PIL import Image\n    from pathlib import Path\n\n    imgs = ['data/images/zidane.jpg',  # filename\n            Path('data/images/zidane.jpg'),  # Path\n            'https://ultralytics.com/images/zidane.jpg',  # URI\n            cv2.imread('data/images/bus.jpg')[:, :, ::-1],  # OpenCV\n            Image.open('data/images/bus.jpg'),  # PIL\n            np.zeros((320, 640, 3))]  # numpy\n\n    results = model(imgs)  # batched inference\n    results.print()\n    results.save()\n", "path": "hubconf.py"}], "after_files": [{"content": "# YOLOv5 \ud83d\ude80 by Ultralytics, GPL-3.0 license\n\"\"\"\nPyTorch Hub models https://pytorch.org/hub/ultralytics_yolov5/\n\nUsage:\n    import torch\n    model = torch.hub.load('ultralytics/yolov5', 'yolov5s')\n\"\"\"\n\nimport torch\n\n\ndef _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    \"\"\"Creates a specified YOLOv5 model\n\n    Arguments:\n        name (str): name of model, i.e. 'yolov5s'\n        pretrained (bool): load pretrained weights into the model\n        channels (int): number of input channels\n        classes (int): number of model classes\n        autoshape (bool): apply YOLOv5 .autoshape() wrapper to model\n        verbose (bool): print all information to screen\n        device (str, torch.device, None): device to use for model parameters\n\n    Returns:\n        YOLOv5 pytorch model\n    \"\"\"\n    from pathlib import Path\n\n    from models.yolo import Model\n    from models.experimental import attempt_load\n    from utils.general import check_requirements, set_logging\n    from utils.downloads import attempt_download\n    from utils.torch_utils import select_device\n\n    file = Path(__file__).resolve()\n    check_requirements(exclude=('tensorboard', 'thop', 'opencv-python'))\n    set_logging(verbose=verbose)\n\n    save_dir = Path('') if str(name).endswith('.pt') else file.parent\n    path = (save_dir / name).with_suffix('.pt')  # checkpoint path\n    try:\n        device = select_device(('0' if torch.cuda.is_available() else 'cpu') if device is None else device)\n\n        if pretrained and channels == 3 and classes == 80:\n            model = attempt_load(path, map_location=device)  # download/load FP32 model\n        else:\n            cfg = list((Path(__file__).parent / 'models').rglob(f'{name}.yaml'))[0]  # model.yaml path\n            model = Model(cfg, channels, classes)  # create model\n            if pretrained:\n                ckpt = torch.load(attempt_download(path), map_location=device)  # load\n                msd = model.state_dict()  # model state_dict\n                csd = ckpt['model'].float().state_dict()  # checkpoint state_dict as FP32\n                csd = {k: v for k, v in csd.items() if msd[k].shape == v.shape}  # filter\n                model.load_state_dict(csd, strict=False)  # load\n                if len(ckpt['model'].names) == classes:\n                    model.names = ckpt['model'].names  # set class names attribute\n        if autoshape:\n            model = model.autoshape()  # for file/URI/PIL/cv2/np inputs and NMS\n        return model.to(device)\n\n    except Exception as e:\n        help_url = 'https://github.com/ultralytics/yolov5/issues/36'\n        s = 'Cache may be out of date, try `force_reload=True`. See %s for help.' % help_url\n        raise Exception(s) from e\n\n\ndef custom(path='path/to/model.pt', autoshape=True, verbose=True, device=None):\n    # YOLOv5 custom or local model\n    return _create(path, autoshape=autoshape, verbose=verbose, device=device)\n\n\ndef yolov5n(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-nano model https://github.com/ultralytics/yolov5\n    return _create('yolov5n', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5s(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-small model https://github.com/ultralytics/yolov5\n    return _create('yolov5s', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5m(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-medium model https://github.com/ultralytics/yolov5\n    return _create('yolov5m', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5l(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-large model https://github.com/ultralytics/yolov5\n    return _create('yolov5l', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5x(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-xlarge model https://github.com/ultralytics/yolov5\n    return _create('yolov5x', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5n6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-nano-P6 model https://github.com/ultralytics/yolov5\n    return _create('yolov5n6', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5s6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-small-P6 model https://github.com/ultralytics/yolov5\n    return _create('yolov5s6', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5m6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-medium-P6 model https://github.com/ultralytics/yolov5\n    return _create('yolov5m6', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5l6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-large-P6 model https://github.com/ultralytics/yolov5\n    return _create('yolov5l6', pretrained, channels, classes, autoshape, verbose, device)\n\n\ndef yolov5x6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=True, device=None):\n    # YOLOv5-xlarge-P6 model https://github.com/ultralytics/yolov5\n    return _create('yolov5x6', pretrained, channels, classes, autoshape, verbose, device)\n\n\nif __name__ == '__main__':\n    model = _create(name='yolov5s', pretrained=True, channels=3, classes=80, autoshape=True, verbose=True)  # pretrained\n    # model = custom(path='path/to/model.pt')  # custom\n\n    # Verify inference\n    import cv2\n    import numpy as np\n    from PIL import Image\n    from pathlib import Path\n\n    imgs = ['data/images/zidane.jpg',  # filename\n            Path('data/images/zidane.jpg'),  # Path\n            'https://ultralytics.com/images/zidane.jpg',  # URI\n            cv2.imread('data/images/bus.jpg')[:, :, ::-1],  # OpenCV\n            Image.open('data/images/bus.jpg'),  # PIL\n            np.zeros((320, 640, 3))]  # numpy\n\n    results = model(imgs)  # batched inference\n    results.print()\n    results.save()\n", "path": "hubconf.py"}]}