当前位置:网站首页>Target detection using Yolo V5

Target detection using Yolo V5

2021-08-08 15:41:29 wx610213d5aa4a5

 

 

One 、 The premise to prepare Two 、 Download the code and configure the environment

linux You can use the following command to configure the environment , Of course, if it is windows Next , Download the compressed package directly , Decompression can be .

git clone https://github.com/ultralytics/yolov5  # clone repo
cd yolov5
pip install -qr requirements.txt  # install dependencies

   
  • 1.
  • 2.
  • 3.

among requirements.txt Contains the necessary configuration environment :
It is basically as follows :

python>=3.6
torch>=1.7.0

   
  • 1.
  • 2.

If you have NVIDIA's graphics card , Can install GPU Version of Pytorch, Reference resources :
pytorch Install and uninstall

Test whether the environment is configured successfully :

import torch
from IPython.display import Image, clear_output  # to display images

print(torch.__version__)
print(torch.cuda.is_available())
clear_output()
print(f"Setup complete. Using torch {torch.__version__} ({torch.cuda.get_device_properties(0).name if torch.cuda.is_available() else 'CPU'})")

   
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
3、 ... and 、 Download pre training model

To yolo official github Download four versions of the model ,  Model download ,
 Insert picture description here
Download the model to and detect.py Same directory .

Four 、 forecast

Camera real-time detection

python detect.py --source 0  # webcam

   
  • 1.

Detect single picture

 python detect.py --source  file.jpg  # image 
 

   
  • 1.
  • 2.

Detect local video

 python detect.py --source  file.mp4  # video

   
  • 1.

Other tests

 python detect.py --source   path/  # directory
 python detect.py --source   path/*.jpg  # glob
 python detect.py --source   'https://youtu.be/NUsoVlDFqZg'  # YouTube video
 python detect.py --source   'rtsp://example.com/media.mp4'  # RTSP, RTMP, HTTP stream

   
  • 1.
  • 2.
  • 3.
  • 4.

Specify a model

python detect.py --weights yolov5s.pt  # P5 models
                           yolov5m.pt
                           yolov5l.pt
                           yolov5x.pt


   
  • 1.
  • 2.
  • 3.
  • 4.
5、 ... and 、 Training

Data set preparation

Data read successful
 Insert picture description here

 

版权声明
本文为[wx610213d5aa4a5]所创,转载请带上原文链接,感谢
https://chowdera.com/2021/08/20210808153459056t.html

随机推荐