Unverified 提交 0a52ae16 authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

README Update (#1207)

* README Update * Update README.md * README Update * Update README.md
上级 8e9b3d02
...@@ -69,7 +69,7 @@ YOLOv5 may be run in any of the following up-to-date verified environments (with ...@@ -69,7 +69,7 @@ YOLOv5 may be run in any of the following up-to-date verified environments (with
## Inference ## Inference
Inference can be run on most common media formats. Model [checkpoints](https://drive.google.com/open?id=1Drs_Aiu7xx6S-ix95f9kNsA6ueKRpN2J) are downloaded automatically if available. Results are saved to `./inference/output`. detect.py runs inference on a variety of sources, downloading models automatically from the [latest YOLOv5 release](https://github.com/ultralytics/yolov5/releases) and saving results to `inference/output`.
```bash ```bash
$ python detect.py --source 0 # webcam $ python detect.py --source 0 # webcam
file.jpg # image file.jpg # image
...@@ -81,22 +81,43 @@ $ python detect.py --source 0 # webcam ...@@ -81,22 +81,43 @@ $ python detect.py --source 0 # webcam
http://112.50.243.8/PLTV/88888888/224/3221225900/1.m3u8 # http stream http://112.50.243.8/PLTV/88888888/224/3221225900/1.m3u8 # http stream
``` ```
To run inference on examples in the `./inference/images` folder: To run inference on example images in `inference/images`:
```bash ```bash
$ python detect.py --source ./inference/images/ --weights yolov5s.pt --conf 0.4 $ python detect.py --source inference/images --weights yolov5s.pt --conf 0.25
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='', fourcc='mp4v', half=False, img_size=640, iou_thres=0.5, output='inference/output', save_txt=False, source='./inference/images/', view_img=False, weights='yolov5s.pt') Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='', img_size=640, iou_thres=0.45, output='inference/output', save_conf=False, save_txt=False, source='inference/images', update=False, view_img=False, weights='yolov5s.pt')
Using CUDA device0 _CudaDeviceProperties(name='Tesla P100-PCIE-16GB', total_memory=16280MB) Using CUDA device0 _CudaDeviceProperties(name='Tesla V100-SXM2-16GB', total_memory=16160MB)
Downloading https://drive.google.com/uc?export=download&id=1R5T6rIyy3lLwgFXNms8whc-387H0tMQO as yolov5s.pt... Done (2.6s) Downloading https://github.com/ultralytics/yolov5/releases/download/v3.0/yolov5s.pt to yolov5s.pt... 100%|██████████████| 14.5M/14.5M [00:00<00:00, 21.3MB/s]
image 1/2 inference/images/bus.jpg: 640x512 3 persons, 1 buss, Done. (0.009s) Fusing layers...
image 2/2 inference/images/zidane.jpg: 384x640 2 persons, 2 ties, Done. (0.009s) Model Summary: 140 layers, 7.45958e+06 parameters, 0 gradients
Results saved to /content/yolov5/inference/output image 1/2 yolov5/inference/images/bus.jpg: 640x480 4 persons, 1 buss, 1 skateboards, Done. (0.013s)
image 2/2 yolov5/inference/images/zidane.jpg: 384x640 2 persons, 2 ties, Done. (0.013s)
Results saved to yolov5/inference/output
Done. (0.124s)
``` ```
<img src="https://user-images.githubusercontent.com/26833433/97107365-685a8d80-16c7-11eb-8c2e-83aac701d8b9.jpeg" width="500">
### PyTorch Hub
To run **batched inference** with YOLOv5 and [PyTorch Hub](https://github.com/ultralytics/yolov5/issues/36):
```python
import torch
from PIL import Image
<img src="https://user-images.githubusercontent.com/26833433/83082816-59e54880-a039-11ea-8abe-ab90cc1ec4b0.jpeg" width="500"> # Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True).fuse().eval() # yolov5s.pt
model = model.autoshape() # for autoshaping of PIL/cv2/np inputs and NMS
# Images
img1 = Image.open('zidane.jpg')
img2 = Image.open('bus.jpg')
imgs = [img1, img2] # batched list of images
# Inference
prediction = model(imgs, size=640) # includes NMS
```
## Training ## Training
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论