当前位置:   article > 正文

Ubuntu18.04配置yolov5目标检测_ubuntu 18.04 yolov5 物体检测

ubuntu 18.04 yolov5 物体检测

1. 拉取代码

  1. git clone https://github.com/ultralytics/yolov5
  2. cd yolov5
  3. pip install -r requirements.txt

2. 模型测试

  1. import torch
  2. # Model
  3. model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5m, yolov5x, custom
  4. # Images
  5. img = 'https://ultralytics.com/images/zidane.jpg' # or file, PIL, OpenCV, numpy, multiple
  6. # Inference
  7. results = model(img)
  8. # Results
  9. results.print() # or .show(), .save(), .crop(), .pandas(), etc.

3. 通过detect.py测试

  1. $ python detect.py --source 0 # webcam
  2. file.jpg # image
  3. file.mp4 # video
  4. path/ # directory
  5. path/*.jpg # glob
  6. 'https://youtu.be/NUsoVlDFqZg' # YouTube video
  7. 'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小桥流水78/article/detail/971861
推荐阅读
相关标签
  

闽ICP备14008679号