当前位置:网站首页>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

边栏推荐
- Xss target drone training [success when pop-up window is realized]
- typescript12-联合类型
- MySQL master-slave replication and read-write separation script - pro test available
- WEB Security Basics - - - Vulnerability Scanner
- MySQL notes under
- DOM系列之scroll系列
- MySQL database (basic)
- [In-depth and easy-to-follow FPGA learning 13---------Test case design 1]
- The difference between h264 and h265 decoding
- Image processing tool design
猜你喜欢

什么是Promise?Promise的原理是什么?Promise怎么用?

MySQL table design for message queue to store message data

typescript16-void

Neural Network (ANN)

MySQL database advanced articles

Regular expression password policy and regular backtracking mechanism bypass

typescript11 - data types

typescript15- (specify both parameter and return value types)

WEB Security Basics - - - Vulnerability Scanner

Kotlin协程:协程上下文与上下文元素
随机推荐
[In-depth and easy-to-follow FPGA learning 15---------- Timing analysis basics]
DOM系列之动画函数封装
[Deep learning] Detailed explanation of Transformer model
[Yugong Series] July 2022 Go Teaching Course 016-Logical Operators and Other Operators of Operators
WEB Security Basics - - - Vulnerability Scanner
mysql索引失效的常见9种原因详解
【愚公系列】2022年07月 Go教学课程 013-常量、指针
【愚公系列】2022年07月 Go教学课程 019-循环结构之for
[In-depth and easy-to-follow FPGA learning 14----------Test case design 2]
ShardingSphere之未分片表配置实战(六)
ES6中 async 函数、await表达式 的基本用法
typescript12-联合类型
A complete guide to avoiding pitfalls for the time-date type "yyyy-MM-dd HHmmss" in ES
【Multithreading】
Consistency and Consensus of Distributed Systems (1) - Overview
MySQL database constraints, table design
Bypass of xss
typescript18-对象类型
Shell编程之条件语句
typescript14-(单独指定参数和返回值的类型)