Giter Club home page Giter Club logo

yolov5-simple's Introduction

YoloV5模型简化部署(yolov5-simple)

[toc]

yolov5-simple是做啥的?

YoloV5 的工程包含很多内容,例如模型训练、模型评估、模型测试以及可视化相关的内容。在部署的时候只需要用到YoloV5中的模型推理相关的内容,其他的依赖用不到。另外YoloV5目标检测的代码,过于冗杂,需要进行裁剪。 因此阿凯帮大家开发了一个简易版本的YoloV5的库 yolov5-simple , 用最简单的方式来调用YoloV5目标检测模型。

image-20211207163507015

效果视频: Mirobot螺丝螺母分拣-深度学习机械臂抓取-YoloV5目标检测

配置YoloV5模型

yolov5/runs 里训练得到的模型文件重命名, 例如nut_and_screw_yolov5n.pt

然后将模型文件放置到yolov5_simple/weights/中。

修改模型配置文件

config/yolov5.yaml

####################################
## YoloV5模型卡片识别20类 配置文件
####################################
# YoloV5模型权重路径
weight:  "weights/nut_and_screw_yolov5n.pt"
# 输入图像的尺寸
input_size: 640
# 类别个数
class_num:  2
# 标签名称
class_name:  ["nut", "screw"]
# 标签类的中文名称
class_name_cn: ["螺母", "螺丝"]
# 阈值设置
threshold:
  iou: 0.8
  confidence: 0.6
# 计算设备
# - cpu
# - 0 <- 使用GPU
device: 'cpu'

配置相机参数

修改配置文件config/camera.yaml

#############################
## 相机的默认参数
#############################
# 摄像头的设备号
# 默认为 0:  /dev/video0
device: 0  
# 画面宽度
img_width: 1920
# 画面高度 
img_height: 1080
# 相机帧率
fps: 30
# 图像缓冲区的尺寸
buffer_size: 2

执行脚本

执行YoloV5的实验脚本

python yolov5.py

API使用说明

创建模型

# YOLOV5模型配置文件(YAML格式)的路径 yolov5_yaml_path
model = YoloV5(yolov5_yaml_path='config/yolov5.yaml')

目标检测

# YoloV5 目标检测
canvas, class_id_list, xyxy_list, conf_list  = model.detect(img)

联系阿凯

作者: 阿凯爱玩机器人

微信: xingshunkai | QQ:244561792 | 邮箱: [email protected]

yolov5-simple's People

Contributors

mushroom-x avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.