当前位置: 首页 > news >正文

目标检测与跟踪 (2)- YOLO V8配置与测试

系列文章目录


第一章 目标检测与跟踪 (1)- 机器人视觉与YOLO V8

目标检测与跟踪 (1)- 机器人视觉与YOLO V8_Techblog of HaoWANG的博客-CSDN博客3D物体实时检测、三维目标识别、6D位姿估计一直是机器人视觉领域的核心研究课题,最新的研究成果也广泛应用于工业信息化领域的方方面面。通过众多的传感器,例如激光扫描仪、深度摄像头、双目视觉传感即可获得三维物体的识别数据,以此为基础开展研究的计算机视觉方向领域也有着较为深入的发展。https://blog.csdn.net/hhaowang/article/details/131893371?spm=1001.2014.3001.5501


目录

系列文章目录

前言

一、安装CUDA&cuDNN

二、安装Pytorch

1.安装miniconda

2. 下载Pytorch &torchvision

3. 安装

三、工程源码安装

四、功能特性与测试

Detection

Segmentation

Classification

Pose

Conclusion

五、测试


前言

YOLOv8 算法的核心特性和改动可以归结为如下:

1.  提供了一个全新的 SOTA 模型,包括 P5 640 和 P6 1280 分辨率的目标检测网络和基于 YOLACT 的实例分割模型。和 YOLOv5 一样,基于缩放系数也提供了 N/S/M/L/X 尺度的不同大小模型,用于满足不同场景需求

2. Backbone:
骨干网络和 Neck 部分可能参考了 YOLOv7 ELAN 设计思想,将 YOLOv5 的 C3 结构换成了梯度流更丰富的 C2f 结构,并对不同尺度模型调整了不同的通道数。

在这里插入图片描述


YOLO timeline

一、安装CUDA&cuDNN

无论采用哪一种方式,首先都需要更新 Ubuntu 软件源和升级到最新版本的软件包。由于国内从 Ubuntu 官方软件源下载速度比较慢,所以,建议采用国内 Ubuntu 镜像源,比如阿里 Ubuntu 软件源或清华大学 Ubuntu 软件源。具体的配置方式是修改配置文件 /etc/apt/sources.list,将其中的 archive.ubuntu.com 替换为 mirrors.alibaba.com 或 mirrors.tuna.tsinghua.edu.cn 。也可以在图形界面应用 "Software & Update" 中,修改 Ubuntu Software 标签页中的 Download from 后的软件源地址。

 参考专题博客文章

Ubuntu 18.04/20.04 CV环境配置(上):CUDA11.1 + cudnn安装配置_ubuntu安装cuda11.1_Techblog of HaoWANG的博客-CSDN博客Ubuntu18.04 20.04 NVIDIA CUDA 环境配置与cudnn Tensorrt等配置与使用_ubuntu安装cuda11.1https://blog.csdn.net/hhaowang/article/details/125803582?spm=1001.2014.3001.5501


二、安装Pytorch

1.安装miniconda

参考:【YOLOV8训练检测模型(window+anaconda环境安装+部署)】_小虫啦啦啦的博客-CSDN博客YOLOv8https://blog.csdn.net/weixin_42511814/article/details/131802059

conda activate yolov8

2. 下载Pytorch &torchvision


        在pytorch版本查询页面,查看与自己的NVIDA Version相匹配的安装指令,从中查看匹配的pytorch和torchvision的版本号

Previous PyTorch Versions | PyTorchAn open source machine learning framework that accelerates the path from research prototyping to production deployment.https://pytorch.org/get-started/previous-versions/

    如下图所示可以看到Linux and Window环境下CUDA 11.1,所对应的pytorch版本是1.9.1,torchvision版本是0.10.1


        进入pytorch官网安装页面,找到对应的pytorch和torchvision的安装包(cp代表python版本,如果其中一个文件找不到对应版本,则重复上一步骤查询可匹配的其他版本

https://link.csdn.net/?target=https%3A%2F%2Fdownload.pytorch.org%2Fwhl%2Ftorch_stable.html

3. 安装


1. 激活配置环境,conda activate yolov8

2. 使用pip install进行配置

pip install torch-1.9.1+cu111-cp38-cp38-win_amd64.whl
pip install torchvision-0.10.1+cu111-cp38-cp38-win_amd64.whl

 安装完成提示

Successfully installed certifi-2023.7.22 charset-normalizer-3.2.0 contourpy-1.1.0 cycler-0.11.0 fonttools-4.41.1 idna-3.4 importlib-resources-6.0.0 kiwisolver-1.4.4 matplotlib-3.7.2 opencv-python-4.8.0.74 packaging-23.1 pandas-2.0.3 psutil-5.9.5 py-cpuinfo-9.0.0 pyparsing-3.0.9 python-dateutil-2.8.2 pytz-2023.3 pyyaml-6.0.1 requests-2.31.0 scipy-1.10.1 seaborn-0.12.2 six-1.16.0 tqdm-4.65.0 tzdata-2023.3 ultralytics-8.0.146 urllib3-2.0.4 zipp-3.16.2


三、工程源码安装

源码GitHub地址:https://docs.ultralytics.com/quickstart/#install-ultralytics

https://docs.ultralytics.com/quickstart/#understanding-settings

1. 源码安装:

Clone the ultralytics repository if you are interested in contributing to the development or wish to experiment with the latest source code. After cloning, navigate into the directory and install the package in editable mode -e using pip.

# Clone the ultralytics repository
git clone https://github.com/ultralytics/ultralytics# Navigate to the cloned directory
cd ultralytics# Install the package in editable mode for development
pip install -e .

2. pip安装

Install the ultralytics package using pip, or update an existing installation by running pip install -U ultralytics. Visit the Python Package Index (PyPI) for more details on the ultralytics package: https://pypi.org/project/ultralytics/.

注意:conda先激活虚拟环境,再进行pip install步骤

# Install the ultralytics package using pip
pip install ultralytics

四、功能特性与测试

Ultralytics YOLOv8 Tasks - Ultralytics YOLOv8 Docs

YOLOv8 is an AI framework that supports multiple computer vision tasks. The framework can be used to perform detection, segmentation, classification, and pose estimation. Each of these tasks has a different objective and use case.

Detection

Detection is the primary task supported by YOLOv8. It involves detecting objects in an image or video frame and drawing bounding boxes around them. The detected objects are classified into different categories based on their features. YOLOv8 can detect multiple objects in a single image or video frame with high accuracy and speed.

Detection Examples

Segmentation

Segmentation is a task that involves segmenting an image into different regions based on the content of the image. Each region is assigned a label based on its content. This task is useful in applications such as image segmentation and medical imaging. YOLOv8 uses a variant of the U-Net architecture to perform segmentation.

Segmentation Examples

Classification

Classification is a task that involves classifying an image into different categories. YOLOv8 can be used to classify images based on their content. It uses a variant of the EfficientNet architecture to perform classification.

Classification Examples

Pose

Pose/keypoint detection is a task that involves detecting specific points in an image or video frame. These points are referred to as keypoints and are used to track movement or pose estimation. YOLOv8 can detect keypoints in an image or video frame with high accuracy and speed.

Pose Examples

Conclusion

YOLOv8 supports multiple tasks, including detection, segmentation, classification, and keypoints detection. Each of these tasks has different objectives and use cases. By understanding the differences between these tasks, you can choose the appropriate task for your computer vision application.

Segment

Instance segmentation goes a step further than object detection and involves identifying individual objects in an image and segmenting them from the rest of the image.

The output of an instance segmentation model is a set of masks or contours that outline each object in the image, along with class labels and confidence scores for each object. Instance segmentation is useful when you need to know not only where objects are in an image, but also what their exact shape is.

​
YOLOv8 Segment models use the -seg suffix, i.e. yolov8n-seg.pt and are pretrained on COCO.​

五、测试

Ultralytics YOLOv8 supports several modes that can be used to perform different tasks. These modes are:

  • Train: For training a YOLOv8 model on a custom dataset.
  • Val: For validating a YOLOv8 model after it has been trained.
  • Predict: For making predictions using a trained YOLOv8 model on new images or videos.
  • Export: For exporting a YOLOv8 model to a format that can be used for deployment.
  • Track: For tracking objects in real-time using a YOLOv8 model.
  • Benchmark: For benchmarking YOLOv8 exports (ONNX, TensorRT, etc.) speed and accuracy.

CLI - Ultralytics YOLOv8 DocsLearn how to use Ultralytics YOLO through Command Line: train models, run predictions and exports models to different formats easily using terminal commands.https://docs.ultralytics.com/usage/cli/

yolo使用命令行(CLI)执行操作,进入虚拟环境后按照 yolo TASK MODE ARGS指令形式。

 参数解释如下:

 yolo TASK MODE ARGSWhere   TASK (optional) is one of ('detect', 'segment', 'classify', 'pose')MODE (required) is one of ('train', 'val', 'predict', 'export', 'track', 'benchmark')ARGS (optional) are any number of custom 'arg=value' pairs like 'imgsz=320' that override defaults.See all ARGS at https://docs.ultralytics.com/usage/cfg or with 'yolo cfg'

使用预训练模型进行测试:

yolo detect predict model=yolov8n-seg.pt source='https://ultralytics.com/images/bus.jpg'

执行单一图片的分割预测,使用预训练模型yolov8n-seg.pt

 

 注意:LooseVersion = distutils.version.LooseVersion报错

修改miniconda3/envs/yolov8/lib/python3.8/site-packages/torch/utils/tensorboard/__init__.py

import tensorboard
#from setuptools import distutils
from distutils.version import LooseVersion# LooseVersion = distutils.version.LooseVersionif not hasattr(tensorboard, '__version__') or LooseVersion(tensorboard.__version__) < LooseVersion('1.15'):raise ImportError('TensorBoard logging requires TensorBoard version 1.15 or above')#del distutils
del LooseVersion
del tensorboardfrom .writer import FileWriter, SummaryWriter  # noqa: F401
from tensorboard.summary.writer.record_writer import RecordWriter  # noqa: F401

相关文章:

目标检测与跟踪 (2)- YOLO V8配置与测试

系列文章目录 第一章 目标检测与跟踪 &#xff08;1&#xff09;- 机器人视觉与YOLO V8 目标检测与跟踪 &#xff08;1&#xff09;- 机器人视觉与YOLO V8_Techblog of HaoWANG的博客-CSDN博客3D物体实时检测、三维目标识别、6D位姿估计一直是机器人视觉领域的核心研究课题&a…...

【Leetcode】56.合并区间

一、题目 1、题目描述 以数组 intervals 表示若干个区间的集合,其中单个区间为 intervals[i] = [ s t a r t i start_i start...

设置系统编码 Beta

在yolov5环境搭建过程中会遇到如下的编码错误警告&#xff1a; 这时&#xff0c;按住“ctrlc”中止进程&#xff0c;然后设置系统编码&#xff1a; 电脑右键属性打开&#xff1a; 重启之后等安装好了&#xff0c;记得回去把bae键取消。...

phpunit

composer地址&#xff1a;phpunit/phpunit - Packagist 官方文档:PHPUnit文档 – PHP测试框架 PHPUnit是一个框架&#xff0c;最为hyperf学习的补充学习&#xff0c;就不写这么细了。 估计写下安装和使用&#xff0c;具体学习内容看文档。 一、安装 需安装扩展&#xff1a;…...

html学习9(脚本)

1、<script>标签用于定义客户端脚本&#xff0c;比如JavaScript&#xff0c;既可包含脚本语句&#xff0c;也可通过src属性指向外部文件。 2、JavaScript最常用于图片操作、表单验证及内容动图更新。 3、<noscript>标签用于在浏览器禁用脚本或浏览器不支持脚本&a…...

SpringBoot整合Caffeine

一、Caffeine介绍 1、缓存介绍 缓存(Cache)在代码世界中无处不在。从底层的CPU多级缓存&#xff0c;到客户端的页面缓存&#xff0c;处处都存在着缓存的身影。缓存从本质上来说&#xff0c;是一种空间换时间的手段&#xff0c;通过对数据进行一定的空间安排&#xff0c;使得下…...

元宇宙虚拟展厅的特点是什么呢?优势有哪些?

元宇宙是一个很广阔的虚拟世界&#xff0c;它可以创造出更为丰富、沉浸式的体验&#xff0c;这种全新的体验为展览和艺术领域带来了更多的可能性&#xff0c;元宇宙虚拟展厅以其多样化、互动性、沉浸式展示的特点&#xff0c;带领大家进入一个虚拟现实的全新世界。 元宇宙虚拟展…...

Day11-Webpack前端工程化开发

Webpack 一 webpack基本概念 遇到问题 开发中希望将文件分开来编写,比如CSS代码,可以分为头部尾部内容,公共的样式。 JS代码也希望拆分为多个文件,分别引入,以后代码比较好维护。 本地图片,希望可以实现小图片不用访问后端,保存在前端代码中就可以了 运行程序时我…...

什么是函数式编程,应用场景是什么

什么是函数式编程&#xff0c;应用场景是什么 函数式编程和面向对象编程一样&#xff0c;是一种编程规范。强调执行的过程而非结果&#xff0c;通过一系列的嵌套的函数调用&#xff0c;完成一个运算过程。它主要有以下几个特点&#xff1a; 1.函数是"一等公民"&…...

Vue3之路由认识

回顾&#xff1a; 原来的vue2路由是通过this. r o u t e 和 t h i s . route和this. route和this.router来控制的。现在vue3有所变化&#xff0c;useRoute相当于以前的this. r o u t e &#xff0c;而 u s e R o u t e r 相当于 t h i s . route&#xff0c;而useRouter相当于t…...

P1775 石子合并(弱化版)(内附封面)

石子合并&#xff08;弱化版&#xff09; 题目描述 设有 N ( N ≤ 300 ) N(N \le 300) N(N≤300) 堆石子排成一排&#xff0c;其编号为 1 , 2 , 3 , ⋯ , N 1,2,3,\cdots,N 1,2,3,⋯,N。每堆石子有一定的质量 m i ( m i ≤ 1000 ) m_i\ (m_i \le 1000) mi​ (mi​≤1000)。…...

jmeter之接口测试(http接口测试)

基础知识储备 一、了解jmeter接口测试请求接口的原理 客户端--发送一个请求动作--服务器响应--返回客户端 客户端--发送一个请求动作--jmeter代理服务器---服务器--jmeter代理服务器--服务器 二、了解基础接口知识&#xff1a; 1、什么是接口&#xff1a;前端与后台之间的…...

webpack基础知识二:说说webpack的构建流程?

一、运行流程 webpack 的运行流程是一个串行的过程&#xff0c;它的工作流程就是将各个插件串联起来 在运行过程中会广播事件&#xff0c;插件只需要监听它所关心的事件&#xff0c;就能加入到这条webpack机制中&#xff0c;去改变webpack的运作&#xff0c;使得整个系统扩展…...

PHP使用PhpSpreadsheet实现导出Excel时带下拉框列表 (可支持三级联动)

因项目需要导出Excel表 需要支持下拉 且 还需要支持三级联动功能 目前应为PHPExcel 不在维护&#xff0c;固采用 PhpSpreadsheet 效果如图&#xff1a; 第一步&#xff1a;首先 使用composer 获取PhpSpreadsheet 我这里PHP 版本 7.4 命令如下&#xff1a; composer r…...

Openssh高危漏洞CVE-2023-38408修复方案

0x01 漏洞简述 2023年07月21日&#xff0c;360CERT监测发现OpenSSH发布了OpenSSH的风险通告&#xff0c;漏洞编号为CVE-2023-38408&#xff0c;漏洞等级&#xff1a;高危&#xff0c;漏洞评分&#xff1a;8.1。 OpenSSH 是 Secure Shell (SSH) 协议的开源实现&#xff0c;提供…...

Android中的ContentProvider

Android中的ContentProvider 在Android中&#xff0c;ContentProvider是四大组件之一&#xff0c;用于在不同应用程序之间共享和管理数据。它提供了一种标准化的方式来访问和管理应用程序的数据&#xff0c;使得多个应用程序可以安全地共享数据&#xff0c;而无需直接访问彼此…...

if device is None and isinstance(net, torch.nn.Module):的含义?

这段代码的含义是&#xff0c;如果变量 device 为 None 并且 net 是 torch.nn.Module 的实例&#xff0c;那么执行后续的代码块。 解释一下其中的几个部分&#xff1a; device&#xff1a;这是一个代表设备的变量&#xff0c;通常用于指定在哪个设备上执行模型的计算&#xff…...

C++如何用OpenCV中实现图像的边缘检测和轮廓提取?

最近有个项目需要做细孔定位和孔距测量&#xff0c;需要做边缘检测和轮廓提取&#xff0c;先看初步效果图&#xff1a; 主要实现代码&#xff1a; int MainWindow::Test() {// 2.9 单个像素长度um 5倍double dbUnit 2.9/(1000*5);// 定义显示窗口namedWindow("src"…...

智慧水务和物联网智能水表在农村供水工程中的应用

摘 要&#xff1a;随着社会的进步和各项事业的飞速发展&#xff0c;人民生活水平的逐步提升&#xff0c;国家对农村饮水安全有了更高的要求&#xff0c;为了进一步提升农村供水服务的质量&#xff0c;利用现代化、信息化科学技术提升农村供水服务质量&#xff0c;提高用水管理效…...

机器学习笔记 - 了解 GitHub Copilot 如何通过提供自动完成式建议来帮助您编码

一、GitHub Copilot介绍 GitHub Copilot 是世界上第一个大规模 AI 开发人员工具,可以帮助您以更少的工作更快地编写代码。GitHub Copilot 从注释和代码中提取上下文,以立即建议单独的行和整个函数。 研究发现 GitHub Copilot 可以帮助开发人员更快地编码、专注于解决更大的问…...

nginx服务器的介绍

一、什么是主从复制至少两台数据库服务器&#xff0c;可以分别设置主服务器和从服务器&#xff0c;对主服务器的任何操作都会同步到从服务器上二、实现原理 mysql中有一种日志&#xff0c;叫做bin日志&#xff08;二进制日志&#xff09;&#xff0c;会记录下所有修改过数据库的…...

别再用Profiler看AI代码了!奇点大会宣布传统性能分析工具对LLM生成代码失效率高达83.6%

第一章&#xff1a;AI代码性能分析的范式危机与奇点宣告 2026奇点智能技术大会(https://ml-summit.org) 当LLM驱动的自动代码生成在37毫秒内完成CUDA核函数重写&#xff0c;而传统profiler仍卡在符号解析阶段时&#xff0c;性能分析的底层契约已然失效。我们正站在一个认知断…...

告别手动拼报文!用MThings调试Modbus设备,这5个高效功能让我效率翻倍

告别手动拼报文&#xff01;用MThings调试Modbus设备&#xff0c;这5个高效功能让我效率翻倍 调试Modbus设备时&#xff0c;你是否经历过这样的场景&#xff1a;盯着十六进制报文反复核对CRC校验码&#xff0c;手忙脚乱地切换计算器和串口助手&#xff0c;或是为了批量读取寄存…...

终极指南:如何用GPSTest精准测试手机卫星导航性能

终极指南&#xff1a;如何用GPSTest精准测试手机卫星导航性能 【免费下载链接】gpstest The #1 open-source Android GNSS/GPS test program 项目地址: https://gitcode.com/gh_mirrors/gp/gpstest 你的手机GPS到底有多准&#xff1f;&#x1f30d; 通过GPSTest这款顶级…...

Rust 编译器优化参数配置

Rust编译器优化参数配置指南 Rust以其出色的性能和安全性受到开发者青睐&#xff0c;而编译器优化参数配置是提升程序运行效率的关键。通过合理调整优化参数&#xff0c;开发者可以在编译时平衡构建速度与运行时性能&#xff0c;甚至针对特定场景&#xff08;如嵌入式或高性能…...

别再傻傻分不清了!嵌入式开发中IIC、SPI、CAN、IIS四大通信总线到底怎么选?

嵌入式开发四大通信总线实战选型指南&#xff1a;IIC、SPI、CAN、IIS深度对比 当你在设计一个需要连接温度传感器的智能家居终端&#xff0c;或是开发车载音响系统的音频模块时&#xff0c;面对琳琅满目的通信协议选项&#xff0c;是否曾陷入选择困难&#xff1f;IIC的简洁、S…...

植物大战僵尸修改器PvZ Toolkit:新手到高手的5大核心功能全解析

植物大战僵尸修改器PvZ Toolkit&#xff1a;新手到高手的5大核心功能全解析 【免费下载链接】pvztoolkit 植物大战僵尸 PC 版综合修改器 项目地址: https://gitcode.com/gh_mirrors/pv/pvztoolkit 植物大战僵尸这款经典游戏陪伴了无数玩家的童年&#xff0c;但你是否想过…...

阿里通义Z-Image-Turbo WebUI应用场景:电商海报、动漫角色一键生成

阿里通义Z-Image-Turbo WebUI应用场景&#xff1a;电商海报、动漫角色一键生成 1. 产品概述与技术优势 阿里通义Z-Image-Turbo WebUI是基于阿里通义实验室最新图像生成模型的二次开发版本&#xff0c;由开发者"科哥"封装为易用的Web界面。该系统专为商业设计场景优…...

O-LIB高级使用技巧:自定义搜索参数、批量下载与云书架集成

O-LIB高级使用技巧&#xff1a;自定义搜索参数、批量下载与云书架集成 【免费下载链接】o-lib O-lib is a free and open-source software application for PC 项目地址: https://gitcode.com/gh_mirrors/ol/o-lib O-LIB是一款免费开源的PC端软件&#xff0c;提供强大的…...

3分钟搞定B站视频转文字:智能高效免费工具bili2text全解析

3分钟搞定B站视频转文字&#xff1a;智能高效免费工具bili2text全解析 【免费下载链接】bili2text Bilibili视频转文字&#xff0c;一步到位&#xff0c;输入链接即可使用 项目地址: https://gitcode.com/gh_mirrors/bi/bili2text 你是否曾为整理B站学习视频内容而反复暂…...