How azizamari/electrical_schema_recognition works
Project Type & Purpose
• This project is a specialized computer vision and machine learning system designed to detect and interpret handwritten electrical circuits. It applies image preprocessing, data augmentation, object detection (using YOLOv5), and image processing techniques for terminal detection. Additionally, there is a backend API (via FastAPI) for inference and a Dockerized deployment for use as a microservice.
• The project appears to be a full-stack application in its own right (with its own ML pipelines, API endpoints, and deployment support), though its main focus is on ML/Computer Vision tasks.
File Structure
• At the top level, the project includes files like Dockerfile, .gitignore, main.py, model (with a trained model file), requirements.txt, and several Python scripts.
• Supporting files like “adaptive_thresholding.py”, “augmentation_pipeline.py”, and “utils_functions.py” suggest standalone processing modules.
• The “yolov5” directory indicates that either the repository is using YOLOv5 as a library or directly referencing its implementation for object detection.
Components & Their Relationships
• Data Preprocessing & Augmentation:
• adaptive_thresholding.py — applies adaptive thresholding with OpenCV.
• augmentation_pipeline.py — augments images using the albumentations library.
• Model Training & Inference:
• main.py — likely the entry point coordinating the ingestion of an image, preprocessing, object detection using the pre-trained YOLOv5 model (model/modelv1.pt), and further processing.
• yolov5 directory — contains the YOLOv5 implementation for model training/inference.
• Terminal Recognition:
• Node Recognition:
• node_recognition/ — holds experimental scripts for future expansion regarding node/component connectivity or circuit topology analysis.
• Backend API & Deployment:
• The README mentions simple endpoints built using FastAPI; while explicit API code isn’t present in this file tree, it is referenced in the README and might be integrated within main.py or another module.
• Dockerfile — containerization for deployment as a microservice.
• Utility Functions:
• utils_functions.py — common helper methods supporting various processes.
Architectural Patterns & Technologies
• Modular design to separate responsibilities: preprocessing, data augmentation, ML model inference, and image processing based terminal recognition.
• Use of external libraries (OpenCV, albumentations, FastAPI, and YOLOv5) which are important to highlight.
• Containerization with Docker facilitates microservice deployment.
• The workflow exhibits a pipeline design where output from one stage is directly used by the next.