This project addresses a common challenge in metal 3D printing: substrate deformation. When a metal substrate is placed on a perforated table for 3D printing, improper clamping can lead to deformation during the printing process, resulting in poor-quality prints.
Using computer vision and deep learning (DeepLabv3+), this solution:
- Analyzes top-down images of placed substrates
- Identifies the optimal positions for placing clamps
- Provides these recommendations through a simple API
In metal 3D printing, workers place a metal substrate on a perforated table and secure it with clamps. If not properly clamped, the substrate can deform during printing, causing defects in the final product. Manual clamp placement is often inconsistent and depends on worker experience.
Our two-stage approach:
- Substrate Detection: Using DeepLabv3+ to create a pixel-perfect mask of the substrate
- Optimal Clamp Positioning: Analyzing the substrate mask to determine ideal positions for clamps, considering:
- Even distribution around the substrate
- Proximity to available perforation holes
- Adequate support for areas prone to deformation
├── api/ # FastAPI implementation
│ ├── main.py # API endpoints
│ ├── models.py # Pydantic models
│ └── utils.py # API utility functions
├── models/ # Deep learning model definitions
│ ├── deeplabv3plus.py # DeepLabv3+ architecture
│ ├── substrate_model.py # Substrate detection model
│ └── clamp_model.py # Clamp position model
├── pipeline/ # Processing pipeline
│ ├── combined.py # End-to-end pipeline
│ ├── preprocessing.py # Image preprocessing
│ └── postprocessing.py # Results processing
├── utils/ # Utility functions
│ └── visualization.py # Visualization tools
├── examples/ # Example images and results
│ ├── input/ # Example input images
│ └── output/ # Example output visualizations
├── requirements.txt # Project dependencies
└── setup.py # Package setup script
- Python 3.10+
- TensorFlow/Keras for deep learning models
- OpenCV for image processing
- FastAPI for API implementation
- NumPy for numerical operations
- Python 3.10+
- pip/uv package manager
# Clone the repository
git clone https://github.com/yourusername/3d-print-clamp-optimizer.git
cd 3d-print-clamp-optimizer
# Create and activate virtual environment
uv venv --python 3.10
source .venv/bin/activate # On Windows: .venv\\Scripts\\activate
# Install dependencies
pip install -r requirements.txtpython -m api.mainThe API will be available at http://localhost:8000
POST /analyze: Submit an image for analysisGET /result/{job_id}: Get analysis results
# Submit an image for analysis
curl -X POST "http://localhost:8000/analyze" \
-F "image=@./examples/input/sample1.jpg"
# Response:
# {"job_id": "abcd1234", "status": "processing"}
# Get results
curl -X GET "http://localhost:8000/result/abcd1234"
# Response:
# {"status": "completed", "clamp_positions": [{"x": 10.5, "y": 15.2}, ...]}This project is licensed under the MIT License - see the LICENSE file for details.
This is a simplified version of a proprietary system. Dummy data and simplified models are used for demonstration purposes.