How upalx-mz/grommets-vision-artificial works
Purpose
grommets-Vision-Artificial is an industrial machine-vision repository for detecting/classifying grommets and related parts, with PLC/factory simulation assets. The minimal README provides no operating instructions; architecture is inferred from source, model, camera, and automation artifacts.
Primary Entry Point
• src/main.py is the likely application orchestrator.
• src/__init__.py defines the Python package boundary.
• pyproject.toml defines the Python project/runtime dependency boundary.
Vision and Inference Layer
• lib/analisys.py likely contains image-analysis and model-inference logic.
• Pretrained TensorFlow/Keras-style model assets are separated by product/domain:
- models/grommets/grommet_model.h5
- models/regco/regco_model.h5
• Class mappings are stored beside models:
- models/grommets/labels.txt
- models/regco/labels.txt
• models/modelos.txt likely provides a model registry or selection list.
Camera Acquisition Boundary
• lib/camaras.py is the camera/device integration layer.
• It should isolate live image capture from inference, allowing src/main.py to pass frames into lib/analisys.py without embedding device-specific behavior in model code.
Industrial Control and Simulation Integration
• Factory I/O simulation is represented by assets/Factory/OP180 -OP200 .factoryio.
• PLC logic/project configuration is represented by assets/Codesys/PLC Estadia.project.
• The likely control flow is: camera frame → visual classification/decision → PLC-facing signal or protocol update → Factory I/O simulation/actuation.
• sample/modbus.py indicates Modbus is the probable PLC communication protocol and an important external integration boundary.
Execution and Validation Examples
• sample/grommet.py, sample/regco.py, and sample/regco2.py appear to exercise model-specific inference paths.
• sample/sample1.py and sample/sample2.py likely provide general camera/vision experiments.
• These scripts are secondary entry points for manual validation rather than the main runtime.
Outputs and Operational Artifacts
• out/log.txt is the repository’s persisted runtime/log output location.
• img/ is the likely image capture, inspection, or visualization artifact directory.
• The architecture depends on local camera hardware, trained .h5 model files, and optionally a Modbus-connected PLC or Factory I/O/CODESYS simulation environment.
Main entry points: analisys.py Image analysis · main.py Application orchestrator · camaras.py Camera acquisition · __init__.py src package
Components 16
Python Runtime
- Python project · Defines the Python dependency boundary.
pyproject.toml - src package
src/__init__.py - Application orchestrator
src/main.py - Manual vision samples · Model-specific and camera/vision experiments.
Vision Pipeline
- Camera acquisition · Isolates live frame capture from inference.
lib/camaras.py - Image analysis · Runs image analysis and model inference.
lib/analisys.py
Trained Models
- Model selection
models/modelos.txt - Grommet model
models/grommets/grommet_model.h5 - Grommet labels
models/grommets/labels.txt - Regco model
models/regco/regco_model.h5 - Regco labels
models/regco/labels.txt
Industrial Integration
- Modbus PLC bridge · Probable control-signal integration boundary.
sample/modbus.py - CODESYS PLC logic
assets/Codesys/PLC Estadia.project - Factory I/O simulation
assets/Factory/OP180 -OP200 .factoryio
Other components
- Inspection images
- Runtime log
out/log.txt
Connections 17
- Python project → src package: defines runtime
- src package → Application orchestrator: contains
- Application orchestrator → Camera acquisition: acquires frames
- Camera acquisition → Image analysis: frames
- Application orchestrator → Image analysis: orchestrates
- Model selection → Image analysis: selects model
- Grommet model → Image analysis: inference weights
- Grommet labels → Image analysis: class names
- Regco model → Image analysis: inference weights
- Regco labels → Image analysis: class names
- Image analysis → Modbus PLC bridge: classification decision
- Modbus PLC bridge → CODESYS PLC logic: PLC signals
- CODESYS PLC logic → Factory I/O simulation: controls simulation
- Application orchestrator → Inspection images: captures or visualizes
- Application orchestrator → Runtime log: writes runtime events
- Manual vision samples → Camera acquisition: exercise capture
- Manual vision samples → Image analysis: exercise inference