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

工业仪表识别(一)环境安装

仪表识别环境安装

1.cuda

cuda 11.8 intall(cuda11.8、cuda12.6按照需求安装)

ref:

  • https://developer.nvidia.com/cuda-11-8-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_network
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
sudo sh cuda_11.8.0_520.61.05_linux.run

env setting

vim ~/.bashrc
export CUDA_HOME=/usr/local/cuda-11.8
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64
export PATH=${CUDA_HOME}/bin:${PATH}

anaconda

conda create -n cv_meter python=3.10 -y

2.PaddleOCR

ref:

  • paddlepaddle: https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html
  • paddleocr:
  • ppocrlabel(标注工具):

(1) install

#PaddlePaddle 3.0的GPU版本安装
# CUDA 11.8
python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/# paddleocr
python -m pip install paddleocr==3.0.0# 简单验证ocr功能
from paddleocr import PaddleOCRocr = PaddleOCR(use_doc_orientation_classify=False, use_doc_unwarping=False, use_textline_orientation=False) # 文本检测+文本识别
# ocr = PaddleOCR(use_doc_orientation_classify=True, use_doc_unwarping=True) # 文本图像预处理+文本检测+方向分类+文本识别
# ocr = PaddleOCR(use_doc_orientation_classify=False, use_doc_unwarping=False) # 文本检测+文本行方向分类+文本识别
# ocr = PaddleOCR(
#     text_detection_model_name="PP-OCRv5_mobile_det",
#     text_recognition_model_name="PP-OCRv5_mobile_rec",
#     use_doc_orientation_classify=False,
#     use_doc_unwarping=False,
#     use_textline_orientation=False) # 更换 PP-OCRv5_mobile 模型
result = ocr.predict("./general_ocr_002.png")
for res in result:res.print()res.save_to_img("output")res.save_to_json("output")

(2) ppocrlabel安装

# 安装python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/#通过whl包安装与运行
pip3 install PPOCRLabel
pip3 install trash-cli
# pyqt5和opencv版本不匹配,修改内容
pip uninstall opencv-contrib-python-headless
pip3 install opencv-contrib-python-headless==4.11.0.86
## 选择标签模式来启动
PPOCRLabel --lang ch  # 启动【普通模式】,用于打【检测+识别】场景的标签
PPOCRLabel --lang ch --kie True  # 启动 【KIE 模式】,用于打【检测+识别+关键字提取】场景的标签

3.YOLO

ref:

  • 使用:https://docs.ultralytics.com/zh/quickstart/#__tabbed_1_3
  • 环境依赖和限制:https://github.com/ultralytics/ultralytics/blob/main/pyproject.toml

install

# pip 安装
pip install ultralytics# 注意:
# 如果在CUDA 环境中安装,最佳做法是安装 ultralytics, pytorch和 pytorch-cuda 在同一命令中。这允许 conda 软件包管理器解决任何冲突。或者,安装 pytorch-cuda 最后覆盖CPU pytorch 如有必要,请将该程序包添加到"... "中。
# Install all packages together using conda
#conda install -c pytorch -c nvidia -c conda-forge pytorch torchvision pytorch-cuda=11.8 ultralytics# or 
# Install the ultralytics package using conda
#conda install -c conda-forge ultralytics

eval

from ultralytics import YOLO# Load a model
model = YOLO("yolo11n.pt")  # pretrained YOLO11n model# Run batched inference on a list of images
results = model(["image1.jpg", "image2.jpg"])  # return a list of Results objects# Process results list
for result in results:boxes = result.boxes  # Boxes object for bounding box outputsmasks = result.masks  # Masks object for segmentation masks outputskeypoints = result.keypoints  # Keypoints object for pose outputsprobs = result.probs  # Probs object for classification outputsobb = result.obb  # Oriented boxes object for OBB outputsresult.show()  # display to screenresult.save(filename="result.jpg")  # save to disk
http://www.dtcms.com/a/291226.html

相关文章:

  • 一个月掌握数据结构与算法:高效学习计划
  • boost::asio 中 io_service与线程的关系
  • 企业开发转型 | 前端AI化数字化自动化现状
  • TestCase Studio - 自动生成测试用例详解
  • 注册表清理优化丨Wise RegistryCleaner_v11.1.10.725(官方赠品)
  • C# --- 使用Redis分布式锁实现初始化任务
  • Navicat数据建模三模型高效用法详解
  • 淘宝获取商品分类接口操作指南
  • Java学习 ------BIO模型
  • 识别并计算滑块距离
  • 高性能I/O的终极武器:epoll深度解析与实战
  • 关于java8里边Collectors.toMap()的空限制
  • 使用 PyTorch 的 torchvision 库加载 CIFAR-10 数据集
  • python 中if/elif/else 是如何构建程序逻辑的?
  • 【初识数据结构】CS61B中的最小生成树问题
  • LLaMA-Factory 微调可配置的模型基本参数
  • jcmd用法总结
  • 完整的 SquareStudio 注册登录功能实现方案:已经烧录到开发板正常使用
  • 83、形式化方法
  • Unity VR多人手术系统恢复3:Agora语音通讯系统问题解决全记录
  • 【CAN】01.CAN简介硬件电路
  • 视网膜分支静脉阻塞(BRVO)及抗VEGF治疗的多模态影像学研究
  • 同步与异步?从一个卡顿的Java服务说起
  • 文字检测到文字识别
  • 如何用 Z.ai 生成PPT,一句话生成整套演示文档
  • 自反馈机制(Self-Feedback)在大模型中的原理、演进与应用
  • 【PTA数据结构 | C语言版】哥尼斯堡的“七桥问题”
  • 【ROS1】07-话题通信中使用自定义msg
  • (9)机器学习小白入门 YOLOv:YOLOv8-cls 技术解析与代码实现
  • 选择排序 冒泡排序