MiniRes: Resin Usage Predictor for 3D Printed Miniatures
MiniRes is a small Python library + pretrained ensemble model that predicts resin usage in grams for pre-supported 3D printed miniatures.
It takes tabular features exported from your slicing & analysis pipeline (UVtools, PrusaSlicer, trimesh, etc.) and returns a single float per part: the estimated resin usage in grams.
Under the hood, MiniRes is an ensemble model with:
A Keras neural network +
An XGBoost regressor
The model weights are hosted on Hugging Face and downloaded/cached automatically.
Then add minires.py to your project (or install this repo as a package if you set it up that way).
Basic usage
python
1import pandas as pd
2from minires import minires
34# Load your data5df = pd.read_csv("my_miniatures_features.csv")67# Create the model (downloads weights from Hugging Face on first run)8model = minires(verbose=1)910# Predict resin usage (grams)11y_pred = model.predict(df)1213print(y_pred[:10])
verbose=1 prints the ensemble weights and Keras progress. You can pass the full dataframe; the model will select the features it needs.
Required features
The model expects a fixed set of feature columns (the same ones used in training).
You can inspect them at runtime:
python
1model = minires()2print(model.features)
Your dataframe must contain at least these columns. Extra columns are ignored. If any required columns are missing, minires will raise an error listing them.
After running the script, you’ll find stl_features.csv in the output_path folder, ready to be used as input for MiniRes or for your own analysis.
Script: mini-pricing.py
Open the file with a text editor and adjust the constants at the top:
python
1RESIN_COST_PER_GRAM =0.06# in your currency, e.g. 0.06 = €0.06/gram2OVERHEAD_PER_MINI =1.50# fixed overhead per miniature (packaging, time, etc.)3INPUT_CSV = Path("stl_features.csv")4OUTPUT_CSV = Path("mini_pricing.csv")
Run the script via terminal:
python mini-pricing.py
and inspect the resulting minipricing.csv for a list of all your miniatures, with their total cost.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.