当前位置:网站首页>Yolov7实战,实现网页端的实时目标检测
Yolov7实战,实现网页端的实时目标检测
2022-07-31 00:46:00 【计算机视觉研究院】
关注并星标
从此不迷路
计算机视觉研究院


计算机视觉研究院专栏
作者:Edison_G
今天给大家分享的是yolov7网络实践,并且可以做成web端,只要你输入图像,选择对应模型就可以输出检测结果。让我们开始代码吧!
01
概述
具体内容可以参考CSDN的he_eeeeeeeeeee,进入主页既可以或更加详细的操作流程。
源码:https://github.com/WongKinYiu/yolov7
论文:https://arxiv.org/abs/2207.02696
Yolov7:最新最快的实时检测框架,最详细分析解释(附源代码)
02
实验

搭建环境,这里直接用conda按照源码requirements.txt安装就行。
具体内容可以见下面链接:
接下来我们继续,怎么把训练好的模型部署到web端,这样后期就可以随时可以检测图像。
首先跟推理一样:
parser = argparse.ArgumentParser()
parser.add_argument('--weights', nargs='+', type=str, default=model+".pt", help='model.pt path(s)') parser.add_argument('--source', type=str, default='Inference/', help='source') # file/folder, 0 for webcam parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)') parser.add_argument('--conf-thres', type=float, default=0.25, help='object confidence threshold') parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS') parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu') parser.add_argument('--view-img', action='store_true', help='display results')
parser.add_argument('--save-txt', action='store_true', help='save results to *.txt')
parser.add_argument('--save-conf', action='store_true', help='save confidences in --save-txt labels') parser.add_argument('--nosave', action='store_true', help='do not save images/videos') parser.add_argument('--classes', nargs='+', type=int, help='filter by class: --class 0, or --class 0 2 3') parser.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS') parser.add_argument('--augment', action='store_true', help='augmented inference')
parser.add_argument('--update', action='store_true', help='update all models')
parser.add_argument('--project', default='runs/detect', help='save results to project/name') parser.add_argument('--name', default='exp', help='save results to project/name')
parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment') parser.add_argument('--trace', action='store_true', help='trace model')
opt = parser.parse_args()然后在代码开始增加训练模型pth的位置及一些依赖:
import gradio as gr
import os
os.system("wget https://github.com/***/yolov7.pt")
os.system("wget https://github.com/***/yolov7-e6e.pt")
os.system("wget https://github.com/***/yolov7-e6.pt")
import argparse
import time
from pathlib import Path
import cv2
import torch
import torch.backends.cudnn as cudnn
...接下来就是初始化、读取模型、读取数据、推理。
具体代码我这边会分享在知识星球。
THE END
转载请联系本公众号获得授权

计算机视觉研究院学习群等你加入!
ABOUT
计算机视觉研究院
计算机视觉研究院主要涉及深度学习领域,主要致力于人脸检测、人脸识别,多目标检测、目标跟踪、图像分割等研究方向。研究院接下来会不断分享最新的论文算法新框架,我们这次改革不同点就是,我们要着重”研究“。之后我们会针对相应领域分享实践过程,让大家真正体会摆脱理论的真实场景,培养爱动手编程爱动脑思考的习惯!
VX:2311123606

边栏推荐
- 场景之多数据源查询及数据下载问题
- BOM系列之Navigator对象
- Regular expression password policy and regular backtracking mechanism bypass
- [In-depth and easy-to-follow FPGA learning 14----------Test case design 2]
- 牛客网刷题训练(四)
- Unity2D horizontal version game tutorial 4 - item collection and physical materials
- ShardingSphere's unsharded table configuration combat (6)
- 埃拉托斯特尼筛法
- MySQL triggers
- 【c语言课程设计】C语言校园卡管理系统
猜你喜欢

xss bypass: prompt(1)

Jmeter parameter transfer method (token transfer, interface association, etc.)

Preparations for web vulnerabilities

Can deep learning solve the parameters of a specific function?

registers (assembly language)

Typescript18 - object type

Meeting OA project pending meeting, all meeting functions

Error ER_NOT_SUPPORTED_AUTH_MODE Client does not support authentication protocol requested by serv

typescript12 - union types

This project is so geeky
随机推荐
【Multithreading】
How to Add a Navigation Menu on Your WordPress Site
Image processing tool design
[In-depth and easy-to-follow FPGA learning 13---------Test case design 1]
解决:Parameter 0 of method ribbonServerList in com.alibaba.cloud.nacos.ribbon.NacosRibbonClientConfigu
牛客网刷题训练(四)
这个项目太有极客范儿了
MySQL master-slave replication and read-write separation script - pro test available
IOT cross-platform component design scheme
Restricted character bypass
ES6中 async 函数、await表达式 的基本用法
深度学习可以求解特定函数的参数么?
消息队列存储消息数据的MySQL表设计
typescript11 - data types
埃拉托斯特尼筛法
Strict Mode for Databases
MySQL笔记下
Go 学习笔记(84)— Go 项目目录结构
The client series of the DOM series
MySQL数据库约束,表的设计