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 (YOLOv8) with graph-based analytics to transform P&ID workflows.
- Symbol Detection: Identify valves (gate, globe, check), pumps, tanks, and more using YOLOv8.
- Automated Counting: Generate counts for each symbol type in a P&ID.
- Graph-Based Analysis: Model P&IDs as networks to analyze connectivity, critical paths, and system dependencies.
- Export Results: Export detection results and connectivity graphs to CSV, PDF, or JSON.
- User-Friendly Interface: Simple CLI and scriptable API for integration into existing workflows.
-
Clone the Repository:
git clone https://github.com/your-username/GARNET.git cd GARNET
-
Install Dependencies:
pip install -r requirements.txt
Run the web interface to upload P&IDs, select models, and view results in real time:
-
Start the Web Server:
uvicorn main:app --reload
Access the app at
http://localhost:8000
. -
Using the Web Interface:
- Upload a P&ID: Select an image file (JPG/PNG).
- Model Configuration: Choose a model type (e.g., YOLOv5, YOLOv8) and upload custom weights (
.pt
file). - Run Inference: Click "Submit" to detect symbols and display results.
- Results: View annotated images, symbol counts, and download reports (CSV/JSON).
Run inference on multiple P&IDs in a folder using predict_images.py
:
-
Command-Line Arguments:
python predict_images.py \ --image_path path/to/pids_folder \ --model_type yolov8 \ --model_path path/to/model_weights.pt \ --output_path results/
-
Output:
- Annotated images (saved in output_path).
- CSV file with symbol counts (
output_path/symbol_counts.csv
).
Example code snippet:
from garnet.inference import predict_images
predict_images(
image_path="path/to/pids_folder",
model_type="yolov8",
model_path="path/to/model_weights.pt",
output_path="results/"
)
- Feature: Automatically generate connectivity graphs from P&IDs.
- Planned Workflow:
- Detect symbols and pipelines.
- Build a graph network using NetworkX.
- Analyze critical paths, cycles, and dependencies.
- Export graphs as PNG/PDF or integrate with CAD tools.
To train custom YOLO models for P&ID symbols:
yolo train \
data=data.yaml \
model=yolov8n.pt \
epochs=100 \
imgsz=640 \
batch=16
GARNET uses the YOLOv8 dataset format. Example structure:
dataset/
├── train/
│ ├── images/ # P&ID images (.jpg, .png)
│ └── labels/ # YOLO-format labels (.txt)
├── val/
│ ├── images/
│ └── labels/
└── data.yaml # Dataset config (class names, paths)
Example data.yaml
:
train: dataset/train/images
val: dataset/val/images
nc: 6 # Number of classes
names: ["valve", "gate_valve", "globe_valve", "check_valve", "pump", "tank"]
Detection | Graph Analysis |
---|---|
Example output: Symbol counts and connectivity graph for a P&ID.
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:
- Your Name - [email protected]
- GCME (GC Maintenance and Engineering Co., Ltd.) - www.gcme.com