news 2026/7/12 10:05:02

药品名字检测和识别3:基于深度学习YOLO26神经网络实现药品名字检测和识别(含训练代码、数据集和GUI交互界面)

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
药品名字检测和识别3:基于深度学习YOLO26神经网络实现药品名字检测和识别(含训练代码、数据集和GUI交互界面)

基于深度学习YOLO26神经网络实现药品名字检测和识别,其能识别检测出1种药品名字检测:names = {0:'drug-name'}

具体图片见如下:

第一步:YOLO26介绍

YOLO26采用了端到端无NMS推理,直接生成预测结果,无需非极大值抑制(NMS)后处理。这种设计减少了延迟,简化了集成,并提高了部署效率。此外,YOLO26移除了分布焦点损失(DFL),从而增强了硬件兼容性,特别是在边缘设备上的表现。

模型还引入了ProgLoss小目标感知标签分配(STAL),显著提升了小目标检测的精度。这对于物联网、机器人技术和航空影像等应用至关重要。同时,YOLO26采用了全新的MuSGD优化器,结合了SGD和Muon优化技术,提供更稳定的训练和更快的收敛速度。

第二步:YOLO26网络结构

第三步:代码展示

# Ultralytics YOLO 🚀, AGPL-3.0 license from pathlib import Path from ultralytics.engine.model import Model from ultralytics.models import yolo from ultralytics.nn.tasks import ClassificationModel, DetectionModel, OBBModel, PoseModel, SegmentationModel, WorldModel from ultralytics.utils import ROOT, yaml_load class YOLO(Model): """YOLO (You Only Look Once) object detection model.""" def __init__(self, model="yolo11n.pt", task=None, verbose=False): """Initialize YOLO model, switching to YOLOWorld if model filename contains '-world'.""" path = Path(model) if "-world" in path.stem and path.suffix in {".pt", ".yaml", ".yml"}: # if YOLOWorld PyTorch model new_instance = YOLOWorld(path, verbose=verbose) self.__class__ = type(new_instance) self.__dict__ = new_instance.__dict__ else: # Continue with default YOLO initialization super().__init__(model=model, task=task, verbose=verbose) @property def task_map(self): """Map head to model, trainer, validator, and predictor classes.""" return { "classify": { "model": ClassificationModel, "trainer": yolo.classify.ClassificationTrainer, "validator": yolo.classify.ClassificationValidator, "predictor": yolo.classify.ClassificationPredictor, }, "detect": { "model": DetectionModel, "trainer": yolo.detect.DetectionTrainer, "validator": yolo.detect.DetectionValidator, "predictor": yolo.detect.DetectionPredictor, }, "segment": { "model": SegmentationModel, "trainer": yolo.segment.SegmentationTrainer, "validator": yolo.segment.SegmentationValidator, "predictor": yolo.segment.SegmentationPredictor, }, "pose": { "model": PoseModel, "trainer": yolo.pose.PoseTrainer, "validator": yolo.pose.PoseValidator, "predictor": yolo.pose.PosePredictor, }, "obb": { "model": OBBModel, "trainer": yolo.obb.OBBTrainer, "validator": yolo.obb.OBBValidator, "predictor": yolo.obb.OBBPredictor, }, } class YOLOWorld(Model): """YOLO-World object detection model.""" def __init__(self, model="yolov8s-world.pt", verbose=False) -> None: """ Initialize YOLOv8-World model with a pre-trained model file. Loads a YOLOv8-World model for object detection. If no custom class names are provided, it assigns default COCO class names. Args: model (str | Path): Path to the pre-trained model file. Supports *.pt and *.yaml formats. verbose (bool): If True, prints additional information during initialization. """ super().__init__(model=model, task="detect", verbose=verbose) # Assign default COCO class names when there are no custom names if not hasattr(self.model, "names"): self.model.names = yaml_load(ROOT / "cfg/datasets/coco8.yaml").get("names") @property def task_map(self): """Map head to model, validator, and predictor classes.""" return { "detect": { "model": WorldModel, "validator": yolo.detect.DetectionValidator, "predictor": yolo.detect.DetectionPredictor, "trainer": yolo.world.WorldTrainer, } } def set_classes(self, classes): """ Set classes. Args: classes (List(str)): A list of categories i.e. ["person"]. """ self.model.set_classes(classes) # Remove background if it's given background = " " if background in classes: classes.remove(background) self.model.names = classes # Reset method class names # self.predictor = None # reset predictor otherwise old names remain if self.predictor: self.predictor.model.names = classes

第四步:统计训练过程的一些指标,相关指标都有

第五步:运行(支持图片、文件夹、摄像头和视频功能)

第六步:整个工程的内容

有训练代码和训练好的模型以及训练过程,提供数据,提供GUI界面代码

项目完整文件下载请见演示与介绍视频的简介处给出:➷➷➷

https://www.bilibili.com/video/BV1ChNs6dExE/

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/7/12 10:04:01

Seedance 2.0 AI视频生成教程:多模态控制与1700+提示词实战

这次我们来看一个关于即梦AI Seedance 2.0的完整教程。作为字节跳动推出的AI视频生成模型,Seedance 2.0在影视级视频生成方面表现突出,特别是支持多模态输入和精细的提示词控制。对于想要快速上手AI视频制作的内容创作者来说,这个工具值得重点…

作者头像 李华
网站建设 2026/7/12 10:02:58

TDA7468音频处理器与PIC18F2682微控制器的音频路由系统设计

1. 项目背景与核心价值 在音频处理领域,如何高效地实现多路音频输入选择和音质调节一直是个经典问题。传统解决方案要么过于复杂昂贵,要么功能单一难以满足定制化需求。这个项目通过TDA7468音频处理器与PIC18F2682微控制器的组合,打造了一个兼…

作者头像 李华
网站建设 2026/7/12 10:02:57

Godot引擎全流程进阶指南:从节点化设计到跨平台发布

1. 为什么你需要这份“轻量化”指南?如果你正在独立游戏开发的道路上摸索,或者对Unity、Unreal Engine这类“巨无霸”感到力不从心,那么“Godot”这个名字很可能已经出现在你的雷达上。它不仅仅是一个开源免费的引擎,更代表了一种…

作者头像 李华
网站建设 2026/7/12 9:59:26

三步掌握猫抓浏览器扩展:专业级网页资源嗅探与下载方案

三步掌握猫抓浏览器扩展:专业级网页资源嗅探与下载方案 【免费下载链接】cat-catch 猫抓 浏览器资源嗅探扩展 / cat-catch Browser Resource Sniffing Extension 项目地址: https://gitcode.com/GitHub_Trending/ca/cat-catch 在现代网络浏览体验中&#xff…

作者头像 李华