GCME AI-Recognition Network for Engineering Technology
Precision in Every Connection
GARNET is an AI-powered tool designed to automate symbol detection, classification, and connectivity analysis in Piping and Instrumentation Diagrams (P&IDs). Built for engineers and maintenance teams, it combines state-of-the-art object detection (YOLOv11/YOLOv8) with graph-based analytics to transform P&ID workflows.
- Symbol Detection: Identify valves (gate, globe, check), pumps, tanks, and more using YOLOv11/YOLOv8
- SAHI Integration: Slicing Aided Hyper Inference for accurate detection on large images
- Text Recognition (OCR): Extract text annotations from symbols using multiple OCR engines
- Graph Construction: Build connectivity graphs from detected symbols and pipes
- Interactive Review: Human-in-the-loop validation and correction of results
- Export Options: Results available in JSON, YOLO, COCO, LabelMe, or PDF formats
- Interactive canvas with pan/zoom and minimap support
- Object detection visualization with color-coded bounding boxes
- Object editing (create, update, delete) directly on canvas
- Review workflow with accept/reject and visual status indicators
- Batch processing with queue management and progress tracking
- Undo/redo support for all editing operations
- Keyboard shortcuts for efficient navigation
- Dark/light theme toggle
- Confidence filtering and class visibility controls
- Automated counting and symbol type classification
- Model caching for faster subsequent detections
- Results caching with TTL for improved performance
- Automatic cleanup of temporary files
- Health monitoring endpoint
- Environment-configurable for development and production
- Python 3.9+
- Node.js 18+ (for frontend)
- Bun or npm (package manager)
- Git
-
Clone the Repository
git clone https://github.com/may3rd/GARNET.git cd GARNET -
Install Dependencies
# Backend cd backend pip install -r requirements.txt cd .. # Frontend cd frontend bun install # or: npm install cd ..
-
Configure Environment
# Backend cp .env.example .env # Edit .env as needed # Frontend cd frontend cp .env.example .env.local # Edit .env.local as needed cd ..
-
Start the Application
# Terminal 1 - Start API backend cd backend uvicorn api:app --reload --port 8001 # Terminal 2 - Start React frontend cd frontend bun run dev # or: npm run dev
This is the primary mode for interactive P&ID analysis. The React frontend provides a modern UI for uploading images, configuring detection parameters, reviewing results, and exporting data.
| Component | Technology | Version |
|---|---|---|
| Frontend | React + TypeScript | 18.3.1 |
| Build Tool | Vite | 6.4.3 |
| Styling | Tailwind CSS | 3.4.19 |
| State | Zustand | 5.0.14 |
| Backend | FastAPI | Latest |
| AI Engine | SAHI + Ultralytics | Latest |
- Detection Mode: Symbol detection and OCR with interactive review
- Pipeline Mode: End-to-end P&ID digitization including connectivity analysis
Run inference on multiple P&IDs using garnet/predict_images.py:
python garnet/predict_images.py \
--image_path path/to/pids_folder \
--model_type yolov8 \
--model_path path/to/model_weights.pt \
--output_path results/Comprehensive P&ID analysis pipeline available in garnet/pid_extractor.py:
python garnet/pid_extractor.py \
--image path/to/pid_image.png \
--out output/ \
--stop-after 11Detailed documentation is available in the docs/ directory:
- Frontend Structure
- Backend Structure
- API Endpoints
- Data Flow
- Pipeline Stages
- Environment Variables
- Model Training
- Dataset Format
Additional planned outcomes from the GARNET project include:
- MTO for Valves: Automated generation of material take-off lists for all detected valve types
- Line List: Extraction and tabulation of pipeline data including line tags, sizes, service, and connected equipment
Contributions are welcome! Please fork the repository and submit a pull request. For major changes, open an issue first to discuss your ideas.
This project is licensed under the MIT License. See LICENSE for details.
For questions or collaborations, contact:
- Maetee Lorprajuksiri - may3rd@gmail.com
- GCME (GC Maintenance and Engineering Co., Ltd.) - www.gcme.com