File size: 777 Bytes
d74f6eb
 
 
e0008d0
 
d74f6eb
 
 
 
 
 
4d80170
 
d74f6eb
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

# Commented out IPython magic to ensure Python compatibility.
!git clone https://github.com/meituan/YOLOv6.git
%cd YOLOv6
%pip install -r requirements.txt

"""# Inference
First, download a pretrained model from the YOLOv6 [release](https://github.com/meituan/YOLOv6/releases).

### You can also use torch.hub style to load the pretrained model or custom model to inference.
"""
import gradio
from gradio.mix import Series 

# Download a pretrained model
import torch
torch.hub.download_url_to_file('https://github.com/meituan/YOLOv6/releases/download/0.3.0/yolov6s.pt', 'yolov6s.pt')

import torch 

model_local = torch.hub.load('.', 'yolov6n', source='local')

img_path = 'data/images/image1.jpg'
prediction = model_local.predict(img_path)

model_local.show_predict(img_path)