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

中医舌象检测和识别2:基于深度学习YOLO26神经网络实现中医舌象检测和识别(含训练代码和数据集)

基于深度学习YOLO26神经网络实现中医舌象检测和识别,其能识别检测出5种中医舌象检测:names: ['Mirror-Approximated', 'White-Greasy', 'Thin-White', 'Yellow-Greasy', 'Grey-Black']

具体图片见如下:

第一步: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

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

第五步:运行预测代码

#coding:utf-8 from ultralytics import YOLO import cv2 # 所需加载的模型目录 path = 'models/best.pt' # 需要检测的图片地址 img_path = "TestFiles/000353.jpg" # 加载预训练模型 # conf 0.25 object confidence threshold for detection # iou 0.7 intersection over union (IoU) threshold for NMS model = YOLO(path, task='detect') results = model.predict(img_path, iou=0.5) # 检测图片 res = results[0].plot() cv2.imshow("YOLO26 Detection", res) cv2.waitKey(0)

第六步:整个工程的内容

包含数据集、训练代码和预测代码

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

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

http://www.jsqmd.com/news/1091449/

相关文章:

  • 基于HarmonyOS 7.0 跨端开发的节能小贴士挑战页面实战
  • 收银软件源头工厂深度测评:四款主流系统实测与选型指南
  • Windows更新故障终极修复指南:一键重置工具完整教程
  • QKeyMapper:5分钟掌握Windows按键映射神器,游戏办公效率翻倍
  • QKeyMapper:5分钟解决你的Windows按键映射烦恼,手柄玩PC游戏不是梦!
  • 如何零代码打造个性化小米手表表盘:开源工具Mi-Create终极指南
  • AO3镜像站完全指南:5分钟解锁全球同人创作宝库的终极解决方案
  • 告别通宵调图内卷:okbiye AI 科研绘图,给科研人一套轻量化学术可视化解决方案
  • 终极Windows 11优化指南:3分钟用Win11Debloat让你的系统重获新生
  • MiMo Code 使用大清单(适合小白)
  • Lightroom Classic下载教程Lightroom Classic 2026 保姆级安装步骤(附安装包)
  • 阿里云盘Refresh Token获取工具:三步扫码解锁云盘自动化
  • 如何免费解锁Adobe全家桶:Adobe-GenP完整使用指南
  • 【2026最新】WPS2025下载保姆级安装图文教程(全网最详细)【附安装包+长期使用】
  • 如何快速掌握GHelper:华硕ROG笔记本性能优化终极指南
  • 并行接口8255芯片
  • 从失败到成功:记录第11次ChatGPT Plus付费全过程——含OpenAI客服英文申诉模板+时效性凭证截图
  • 萍乡除甲醛划算吗,效果比通风好吗
  • 2026年AI论文软件实测精选:5款神器从选题到格式全流程护航
  • Java摄像头图像处理笔记
  • 【Java从入门到精通】第5篇:运算符与表达式——算术、关系、逻辑与位运算的优先级地图
  • 录屏天花板 Bandicam,低配电脑丝滑 4K!
  • text文件行列转置——r代码
  • 烟草进销存智慧转型:2026解决人工盘点不准与囤货损耗深度指南
  • 【QGIS实战】从高德坐标到WGS84:路网数据处理与空间分析全流程
  • 鸿蒙原生 ArkTS 布局实战:RelativeContainer + Panel 实现自适应面板
  • cci-job-client集成指南:如何与CI/CD流水线无缝对接
  • Navicat重置工具:3步实现Mac版无限试用,告别14天限制
  • 你的 AI Agent 需要提示词保护吗?一份实用判断指南
  • 深入探索NVIDIA Profile Inspector:解锁显卡隐藏潜能的专业指南