Skip to main content

Automatic analog manometer reading using YOLO and angle regression

Project description

reader-manometer

📟 Leitura automática de manômetros analógicos usando YOLO (detecção) e regressão de ângulo, com conversão para porcentagem, pressão e volume.

Projetado para aplicações industriais, hospitalares e IoT, eliminando a necessidade de leitura manual.


✨ Principais recursos

  • Detecção do manômetro via YOLOv8
  • Regressão precisa do ângulo do ponteiro
  • Conversão de ângulo → porcentagem
  • Cálculo de pressão e volume
  • API simples e reutilizável
  • Compatível com pipelines de visão computacional

📦 Instalação

pip install reader-manometer

⚠️ O pacote inclui modelos treinados. Porem você pode fornecer seus próprios arquivos .pt.


🔧 Requisitos

  • Python 3.9+
  • PyTorch
  • Ultralytics (YOLOv8)
  • OpenCV
  • NumPy

📁 Arquivos necessários

Você precisa informar:

  • Modelo YOLO treinado (best.pt)
  • Modelo de regressão de ângulo (regressor.pt)

Exemplo:

reader_manometer/runs/detect/train2/weights/best.pt
reader_manometer/regressor.pt

🚀 Uso rápido

Exemplo completo

from reader_manometer import Manometer, angle_to_percent, get_volume

man = Manometer(
    model="reader_manometer/runs/detect/train2/weights/best.pt",
    regressor="reader_manometer/regressor.pt"
)
'''
retorna uma lista de angulos, muito util quando uma imagem possue mais
de um manometro
'''
angles = man.get_angle(
    filename="./image3.jpeg"
)

if angles:
    print("ângulos:", angles)

    man_pressure = angles[0]
    man_volume = angles[1]

    percent = angle_to_percent(man_pressure)
    print("porcentagem:", round(percent, 2))

    print("pressão:", round(get_volume(percent, 25), 2))

    vol_percent = angle_to_percent(man_volume)
    print("porcentagem volume:", round(vol_percent, 2))

    print("volume:", round(get_volume(vol_percent, 800), 2))

🧠 API

Manometer

Classe principal responsável pela inferência.

Manometer(model: str, regressor: str)

Parâmetros

  • model: caminho para o modelo YOLO (.pt)
  • regressor: caminho para o modelo de regressão de ângulo (.pt)

get_angle()

angles = man.get_angle(filename: str)

Retorno

[angulo_1, angulo_2]
  • Valores em graus
  • Retorna None se não detectar o manômetro

angle_to_percent()

percent = angle_to_percent(angle)

Converte o ângulo do ponteiro em porcentagem (0–100%), considerando a escala do manômetro.


get_volume()

value = get_volume(percent, max_value)

Usado para calcular:

  • Pressão (ex: 25 bar)
  • Volume (ex: 800 L)

🏭 Casos de uso

  • Monitoramento de oxigênio hospitalar
  • Leitura remota de tanques pressurizados
  • Automação industrial
  • Integração com ESP32, APIs REST e MQTT
  • Dashboards e sistemas SCADA

⚠️ Observações importantes

  • O modelo YOLO deve ser treinado especificamente para seu tipo de manômetro apesar de ja pussuir uma boa base
  • A regressão depende de imagens bem enquadradas
  • A escala angular precisa estar configurada corretamente no projeto

🛣️ Roadmap

  • Interface CLI (reader-manometer image.jpg)
  • API REST (FastAPI)
  • Suporte a múltiplos manômetros
  • Exportação MQTT / HTTP
  • Dashboard web

📄 Licença

MIT License


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reader_manometer-0.1.0.tar.gz (34.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reader_manometer-0.1.0-py3-none-any.whl (39.8 MB view details)

Uploaded Python 3

File details

Details for the file reader_manometer-0.1.0.tar.gz.

File metadata

  • Download URL: reader_manometer-0.1.0.tar.gz
  • Upload date:
  • Size: 34.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for reader_manometer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fd5b56fc18d412a3aada405c8d3ae67ca8604ac585797d14226770801604e18d
MD5 9b3001f7c1a352d603f517a1931d3230
BLAKE2b-256 9ea6128da0b0ab094915932fea36313ee73cce3b9bf0176340280e11151f9461

See more details on using hashes here.

File details

Details for the file reader_manometer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for reader_manometer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33becf7df0432c742f7ea87cd06f60b568cd7e568818c8fc4cc8d481eeeeec72
MD5 60ab0d4a245ffc87a1780ffef0d267ae
BLAKE2b-256 1307afcadfef010f495acea052e6f71457024f904ae5d60ba27dd0c3e746593d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page