YOLOv6n / копия_блокнота__turtorial_ipynb_ (3).py
kisa-misa's picture
Update копия_блокнота__turtorial_ipynb_ (3).py
e0008d0
# 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)