A machine learning system for analyzing Charpy impact test specimens, featuring automated fracture surface detection, shear percentage prediction, and human-in-the-loop continuous learning.
- YOLO Object Detection: Automatic detection of Charpy specimens in images
- Shear Percentage Prediction: ML-based regression model for shear analysis
- Lateral Expansion Measurement: Physical measurement capabilities with calibration
- Web Interface: User-friendly interface for image upload and analysis
- Human-in-the-Loop Labeling: Technician feedback system for model improvement
- Online Learning: Continuous model retraining from user corrections
- Performance Monitoring: Real-time metrics tracking (MAE, RMSE, R²)
MLMCSC/
├── src/
│ ├── mlmcsc/ # Core ML package (detection, classification, measurement)
│ ├── web/ # Web interface (FastAPI, database, online learning)
│ ├── apps/ # Training and analysis applications
│ └── camera/ # Camera interface and calibration
├── data/ # Datasets and calibration files
├── models/ # Trained models (YOLO, classification)
├── docs/ # Documentation and guides
├── tests/ # Test suite
├── tools/ # Utility scripts
├── app.py # Main application entry point
└── requirements.txt # Dependencies
- Python 3.8+
- CUDA-compatible GPU (optional, for training)
# Clone the repository
git clone https://github.com/yourusername/MLMCSC.git
cd MLMCSC
# Install dependencies
pip install -r requirements.txt# Start the application
python app.pyThe application will:
- Launch the web server on port 8000
- Automatically open your browser to http://localhost:8000
- Provide an interactive interface for image analysis and labeling
- Upload Charpy specimen images
- View YOLO detection results with bounding boxes
- Get shear percentage predictions
- Provide technician corrections for continuous learning
- Monitor model performance metrics
- Export labeling history
Edit config/config.yaml to customize:
app:
host: "0.0.0.0"
port: 8000
models:
yolo_model_path: "models/detection/best.pt"
classification_model_path: "models/classification/charpy_shear_regressor.pkl"
online_learning:
enabled: true
update_threshold: 10 # Number of labels before retrainingThe web interface provides a REST API for integration:
POST /predict- Analyze uploaded image and return predictionsPOST /submit_label- Submit technician corrections for trainingGET /get_metrics- Retrieve model performance metricsGET /get_history- Get labeling history with paginationGET /export_history- Export complete history as CSVGET /health- Health check endpoint
For detailed API documentation, see src/web/README.md.
Train a new YOLO detection model:
python src/apps/trainer/train_specimen_detector.py --data data/raw/charpy_datasetTrain a new classification model:
python src/apps/trainer/main_shiny_trainer.py --data data/processed/shiny_training_data# Detection
from src.models.object_detector import ObjectDetector
detector = ObjectDetector("models/detection/best.pt")
detections = detector.detect(image)
# Classification
from src.mlmcsc.regression import ShinyRegionBasedClassifier
classifier = ShinyRegionBasedClassifier()
classifier.load_model("models/classification/charpy_shear_regressor.pkl")
result = classifier.predict(image)pytest tests/- Quick Start Guide
- Architecture Overview
- Web Interface Details
- Calibration Guide
- Measurement Guide
- Deployment Guide
- Image Upload: Technician uploads Charpy specimen image via web interface
- Detection: YOLO model locates the specimen in the image
- Feature Extraction: Analyzes shear characteristics and physical properties
- Prediction: Regression model predicts shear percentage
- Human Review: Technician reviews and corrects prediction if needed
- Online Learning: System retrains model periodically with new labeled data
- Metrics Tracking: Performance metrics (MAE, RMSE) continuously monitored
- YOLO Detection: Pre-trained object detector for specimen localization
- Shear Classifier: Regression model for shear percentage prediction
- Online Learning System: Automated model retraining pipeline
- Web Interface: FastAPI backend with responsive frontend
- Database: SQLite for predictions, labels, and metrics storage
This project is licensed under the MIT License.
- YOLOv8 (Ultralytics) for object detection
- scikit-learn for ML utilities
- FastAPI for web framework
Version 2.0 - Clean architecture with human-in-the-loop learning