autoforge 1.1.2__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {autoforge-1.1.2 → autoforge-1.2.0}/PKG-INFO +41 -41
- {autoforge-1.1.2 → autoforge-1.2.0}/README.md +38 -36
- {autoforge-1.1.2 → autoforge-1.2.0}/pyproject.toml +3 -8
- {autoforge-1.1.2 → autoforge-1.2.0}/src/AutoForge.egg-info/PKG-INFO +41 -41
- autoforge-1.2.0/src/AutoForge.egg-info/SOURCES.txt +26 -0
- {autoforge-1.1.2 → autoforge-1.2.0}/src/AutoForge.egg-info/requires.txt +2 -5
- autoforge-1.2.0/src/autoforge/Helper/FilamentHelper.py +127 -0
- autoforge-1.2.0/src/autoforge/Helper/ImageHelper.py +13 -0
- autoforge-1.2.0/src/autoforge/Helper/OptimizerHelper.py +333 -0
- autoforge-1.2.0/src/autoforge/Helper/OutputHelper.py +341 -0
- autoforge-1.2.0/src/autoforge/Helper/PruningHelper.py +320 -0
- autoforge-1.2.0/src/autoforge/Loss/LossFunctions.py +98 -0
- autoforge-1.2.0/src/autoforge/Loss/PerceptionLoss.py +65 -0
- autoforge-1.2.0/src/autoforge/Loss/__init__.py +0 -0
- autoforge-1.2.0/src/autoforge/Modules/Optimizer.py +436 -0
- autoforge-1.2.0/src/autoforge/Modules/__init__.py +0 -0
- autoforge-1.2.0/src/autoforge/__init__.py +0 -0
- autoforge-1.2.0/src/autoforge/auto_forge.py +301 -0
- autoforge-1.2.0/src/autoforge/auto_forge_gradio.py +495 -0
- autoforge-1.2.0/src/autoforge/color_fit_bayesian.py +225 -0
- {autoforge-1.1.2 → autoforge-1.2.0}/src/autoforge/filamentcolors_library.py +2 -2
- autoforge-1.2.0/src/autoforge/old_jax_files.py +142 -0
- autoforge-1.1.2/src/AutoForge.egg-info/SOURCES.txt +0 -13
- autoforge-1.1.2/src/autoforge/auto_forge.py +0 -713
- autoforge-1.1.2/src/autoforge/helper_functions.py +0 -655
- {autoforge-1.1.2 → autoforge-1.2.0}/setup.cfg +0 -0
- {autoforge-1.1.2 → autoforge-1.2.0}/src/AutoForge.egg-info/dependency_links.txt +0 -0
- {autoforge-1.1.2 → autoforge-1.2.0}/src/AutoForge.egg-info/entry_points.txt +0 -0
- {autoforge-1.1.2 → autoforge-1.2.0}/src/AutoForge.egg-info/top_level.txt +0 -0
- {autoforge-1.1.2/src/autoforge → autoforge-1.2.0/src/autoforge/Helper}/__init__.py +0 -0
- {autoforge-1.1.2 → autoforge-1.2.0}/src/autoforge/__main__.py +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: AutoForge
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: AutoForge is a Python tool for generating 3D printed layered models from an input image.
|
|
5
5
|
Author-email: Hendric Voss <hvoss@techfak.uni-bielefeld.de>
|
|
6
6
|
License: CC BY-NC-SA 4.0
|
|
7
7
|
Requires-Python: >=3.9
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
9
|
Requires-Dist: numpy>=1.19.0
|
|
10
|
-
Requires-Dist:
|
|
11
|
-
Requires-Dist:
|
|
10
|
+
Requires-Dist: torch>=2.6.0
|
|
11
|
+
Requires-Dist: torchvision>=0.21.0
|
|
12
12
|
Requires-Dist: opencv-python>=4.2.0.32
|
|
13
13
|
Requires-Dist: matplotlib>=3.3.0
|
|
14
14
|
Requires-Dist: configargparse>=1.2.3
|
|
@@ -17,8 +17,6 @@ Requires-Dist: pandas>=1.1.0
|
|
|
17
17
|
Requires-Dist: scikit-image
|
|
18
18
|
Requires-Dist: scikit-learn
|
|
19
19
|
Requires-Dist: optax>=0.1.3
|
|
20
|
-
Provides-Extra: gpu
|
|
21
|
-
Requires-Dist: jax[cuda12]; extra == "gpu"
|
|
22
20
|
|
|
23
21
|
# AutoForge
|
|
24
22
|
|
|
@@ -27,25 +25,31 @@ AutoForge is a Python tool for generating 3D printed layered models from an inpu
|
|
|
27
25
|
**TLDR:** It uses a picture to generate a 3D layer image that you can print with a 3d printer. Similar to [Hueforge](https://shop.thehueforge.com/), but without the manual work (and without the artistic control).
|
|
28
26
|
|
|
29
27
|
|
|
28
|
+
## Important Information
|
|
30
29
|
|
|
30
|
+
We recently switched from JAX to PyTorch, to allow for a more streamlined development process. \
|
|
31
|
+
This can have some unforeseen consequences, so please report any bugs you find.
|
|
31
32
|
|
|
32
33
|
## Example
|
|
33
34
|
All examples use only the 13 BambuLab Basic filaments, currently available in Hueforge.
|
|
34
35
|
<div style="display: flex; justify-content: center; gap: 20px;">
|
|
35
36
|
<div style="text-align: center;">
|
|
36
37
|
<h3>Input Image</h3>
|
|
37
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi.jpg" width="
|
|
38
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature.jpg" width="
|
|
38
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi.jpg" width="200" />
|
|
39
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature.jpg" width="200" />
|
|
40
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/cat.jpg" width="200" />
|
|
39
41
|
</div>
|
|
40
42
|
<div style="text-align: center;">
|
|
41
43
|
<h3>Autoforge Output (75 color layers (3.0mm) + 10 gray background layers (0.4mm)) </h3>
|
|
42
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi_discretized.jpg" width="
|
|
43
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature_discretized.jpg" width="
|
|
44
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi_discretized.jpg" width="200" />
|
|
45
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature_discretized.jpg" width="200" />
|
|
46
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/cat_discretized.jpg" width="200" />
|
|
44
47
|
</div>
|
|
45
48
|
<div style="text-align: center;">
|
|
46
49
|
<h3>Imported Hueforge View</h3>
|
|
47
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi_hueforge.png" width="
|
|
48
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature_hueforge.png" width="
|
|
50
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi_hueforge.png" width="200" />
|
|
51
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature_hueforge.png" width="200" />
|
|
52
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/cat_hueforge.png" width="200" />
|
|
49
53
|
</div>
|
|
50
54
|
</div>
|
|
51
55
|
|
|
@@ -66,33 +70,17 @@ I would love to see what you made!
|
|
|
66
70
|
|
|
67
71
|
## Installation
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
cd AutoForge
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
2. **Set Up a Virtual Environment (Optional but Recommended)**
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
python -m venv venv
|
|
80
|
-
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
3. **Install Dependencies**
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
pip install -r requirements.txt
|
|
87
|
-
```
|
|
73
|
+
To install AutoForge, simply install the current version from PyPI:
|
|
74
|
+
```bash
|
|
75
|
+
pip install autoforge
|
|
76
|
+
```
|
|
88
77
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
If you have a GPU, you can install the GPU version of JAX by running:
|
|
78
|
+
The optimizer is built using JAX, which benefits from a CUDA-compatible GPU for optimal performance. \
|
|
79
|
+
Without a dedicated GPU the process can take significantly longer (up to 10-20x slower). \
|
|
80
|
+
If you have a GPU, you can install the GPU version of autoforge by running:\
|
|
93
81
|
|
|
94
82
|
```bash
|
|
95
|
-
pip install
|
|
83
|
+
pip install autoforge[gpu]
|
|
96
84
|
```
|
|
97
85
|
|
|
98
86
|
Currently, jax gpu support is only available under linux. \
|
|
@@ -108,7 +96,7 @@ The script is run from the command line and accepts several arguments. Below is
|
|
|
108
96
|
> If you want to limit the amount of colors the program can use, you can simply delete the colors you don't want from the CSV file.
|
|
109
97
|
|
|
110
98
|
```bash
|
|
111
|
-
|
|
99
|
+
autoforge --input_image path/to/input_image.jpg --csv_file path/to/materials.csv --output_folder outputs
|
|
112
100
|
```
|
|
113
101
|
|
|
114
102
|
### Command Line Arguments
|
|
@@ -117,18 +105,26 @@ python auto_forge.py --input_image path/to/input_image.jpg --csv_file path/to/ma
|
|
|
117
105
|
- `--input_image`: **(Required)** Path to the input image.
|
|
118
106
|
- `--csv_file`: **(Required)** Path to the CSV file containing material data. The CSV should include columns for the brand, name, color (hex code), and TD values.
|
|
119
107
|
- `--output_folder`: **(Required)** Folder where output files will be saved.
|
|
120
|
-
- `--iterations`: Number of optimization iterations (default:
|
|
121
|
-
- `--
|
|
108
|
+
- `--iterations`: Number of optimization iterations (default: 5000).
|
|
109
|
+
- `--best_loss_iterations`: Percentage of optimization iterations after which we start to record the best loss (default: 4000).
|
|
110
|
+
**Note:** We currently do this as we increase a penalty loss for color and color swaps as the time goes on. Without this the penalties would have no impact.
|
|
111
|
+
- `--learning_rate`: Learning rate for the optimizer (default: 1e-2).
|
|
122
112
|
- `--layer_height`: Layer thickness in millimeters (default: 0.04).
|
|
123
113
|
- `--max_layers`: Maximum number of layers (default: 75).
|
|
124
114
|
**Note:** This is about 3mm + the background height
|
|
125
115
|
- `--background_height`: Height of the background in millimeters (default: 0.4).
|
|
126
116
|
**Note:** The background height must be divisible by the layer height.
|
|
127
|
-
- `--background_color`: Background color in hexadecimal format (default: `#
|
|
128
|
-
|
|
117
|
+
- `--background_color`: Background color in hexadecimal format (default: `#000000` aka Black).
|
|
118
|
+
**Note:** The solver currently assumes that you have a solid color in the background, which means a color with a TD value of 4 or less (if you have a background height of 0.4)
|
|
119
|
+
- `--output_size`: Maximum dimension for target image (default: 1024).
|
|
120
|
+
- `--solver_size`: Maximum dimension for solver (fast) image (default: 128).
|
|
121
|
+
**Note:** We solve on a smaller size as this is many times faster, but also a bit less accurate. Increase if you need more accuracy.
|
|
129
122
|
- `--decay`: Final tau value for the Gumbel-Softmax formulation (default: 0.01).
|
|
130
|
-
- `--loss`: Loss function to use. Choices are `mse`, `perceptual`, or `perceptual_l1` (default: `mse`).
|
|
131
123
|
- `--visualize`: Flag to enable live visualization of the composite image during optimization.
|
|
124
|
+
- `--perform_pruning`: Perform pruning after optimization (default: True).
|
|
125
|
+
- `--pruning_max_colors`: Max number of colors allowed after pruning (default: 10).
|
|
126
|
+
- `--pruning_max_swaps`: Max number of swaps allowed after pruning (default: 20).
|
|
127
|
+
- `--random_seed`: Random seed for reproducibility (default: 0 (disabled) ).
|
|
132
128
|
|
|
133
129
|
## Outputs
|
|
134
130
|
|
|
@@ -154,6 +150,9 @@ Although I would love to be it fully color compatible with hueforge, I don't thi
|
|
|
154
150
|
## License
|
|
155
151
|
|
|
156
152
|
AutoForge © 2025 by Hendric Voss is licensed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).
|
|
153
|
+
The software is provided as-is and comes with no warranty or guarantee of support.
|
|
154
|
+
|
|
155
|
+
The
|
|
157
156
|
|
|
158
157
|
## Acknowledgements
|
|
159
158
|
|
|
@@ -174,5 +173,6 @@ AutoForge makes use of several open source libraries:
|
|
|
174
173
|
Example Images:
|
|
175
174
|
<a href="https://www.vecteezy.com/free-photos/anime-girl">Anime Girl Stock photos by Vecteezy</a>
|
|
176
175
|
<a href="https://www.vecteezy.com/free-photos/nature">Nature Stock photos by Vecteezy</a>
|
|
176
|
+
<a href="https://www.vecteezy.com/free-photos/ai-generated">Ai Generated Stock photos by Vecteezy</a>
|
|
177
177
|
|
|
178
178
|
Happy printing!
|
|
@@ -5,25 +5,31 @@ AutoForge is a Python tool for generating 3D printed layered models from an inpu
|
|
|
5
5
|
**TLDR:** It uses a picture to generate a 3D layer image that you can print with a 3d printer. Similar to [Hueforge](https://shop.thehueforge.com/), but without the manual work (and without the artistic control).
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
## Important Information
|
|
8
9
|
|
|
10
|
+
We recently switched from JAX to PyTorch, to allow for a more streamlined development process. \
|
|
11
|
+
This can have some unforeseen consequences, so please report any bugs you find.
|
|
9
12
|
|
|
10
13
|
## Example
|
|
11
14
|
All examples use only the 13 BambuLab Basic filaments, currently available in Hueforge.
|
|
12
15
|
<div style="display: flex; justify-content: center; gap: 20px;">
|
|
13
16
|
<div style="text-align: center;">
|
|
14
17
|
<h3>Input Image</h3>
|
|
15
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi.jpg" width="
|
|
16
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature.jpg" width="
|
|
18
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi.jpg" width="200" />
|
|
19
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature.jpg" width="200" />
|
|
20
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/cat.jpg" width="200" />
|
|
17
21
|
</div>
|
|
18
22
|
<div style="text-align: center;">
|
|
19
23
|
<h3>Autoforge Output (75 color layers (3.0mm) + 10 gray background layers (0.4mm)) </h3>
|
|
20
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi_discretized.jpg" width="
|
|
21
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature_discretized.jpg" width="
|
|
24
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi_discretized.jpg" width="200" />
|
|
25
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature_discretized.jpg" width="200" />
|
|
26
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/cat_discretized.jpg" width="200" />
|
|
22
27
|
</div>
|
|
23
28
|
<div style="text-align: center;">
|
|
24
29
|
<h3>Imported Hueforge View</h3>
|
|
25
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi_hueforge.png" width="
|
|
26
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature_hueforge.png" width="
|
|
30
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi_hueforge.png" width="200" />
|
|
31
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature_hueforge.png" width="200" />
|
|
32
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/cat_hueforge.png" width="200" />
|
|
27
33
|
</div>
|
|
28
34
|
</div>
|
|
29
35
|
|
|
@@ -44,33 +50,17 @@ I would love to see what you made!
|
|
|
44
50
|
|
|
45
51
|
## Installation
|
|
46
52
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
cd AutoForge
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
2. **Set Up a Virtual Environment (Optional but Recommended)**
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
python -m venv venv
|
|
58
|
-
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
3. **Install Dependencies**
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
pip install -r requirements.txt
|
|
65
|
-
```
|
|
53
|
+
To install AutoForge, simply install the current version from PyPI:
|
|
54
|
+
```bash
|
|
55
|
+
pip install autoforge
|
|
56
|
+
```
|
|
66
57
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
If you have a GPU, you can install the GPU version of JAX by running:
|
|
58
|
+
The optimizer is built using JAX, which benefits from a CUDA-compatible GPU for optimal performance. \
|
|
59
|
+
Without a dedicated GPU the process can take significantly longer (up to 10-20x slower). \
|
|
60
|
+
If you have a GPU, you can install the GPU version of autoforge by running:\
|
|
71
61
|
|
|
72
62
|
```bash
|
|
73
|
-
pip install
|
|
63
|
+
pip install autoforge[gpu]
|
|
74
64
|
```
|
|
75
65
|
|
|
76
66
|
Currently, jax gpu support is only available under linux. \
|
|
@@ -86,7 +76,7 @@ The script is run from the command line and accepts several arguments. Below is
|
|
|
86
76
|
> If you want to limit the amount of colors the program can use, you can simply delete the colors you don't want from the CSV file.
|
|
87
77
|
|
|
88
78
|
```bash
|
|
89
|
-
|
|
79
|
+
autoforge --input_image path/to/input_image.jpg --csv_file path/to/materials.csv --output_folder outputs
|
|
90
80
|
```
|
|
91
81
|
|
|
92
82
|
### Command Line Arguments
|
|
@@ -95,18 +85,26 @@ python auto_forge.py --input_image path/to/input_image.jpg --csv_file path/to/ma
|
|
|
95
85
|
- `--input_image`: **(Required)** Path to the input image.
|
|
96
86
|
- `--csv_file`: **(Required)** Path to the CSV file containing material data. The CSV should include columns for the brand, name, color (hex code), and TD values.
|
|
97
87
|
- `--output_folder`: **(Required)** Folder where output files will be saved.
|
|
98
|
-
- `--iterations`: Number of optimization iterations (default:
|
|
99
|
-
- `--
|
|
88
|
+
- `--iterations`: Number of optimization iterations (default: 5000).
|
|
89
|
+
- `--best_loss_iterations`: Percentage of optimization iterations after which we start to record the best loss (default: 4000).
|
|
90
|
+
**Note:** We currently do this as we increase a penalty loss for color and color swaps as the time goes on. Without this the penalties would have no impact.
|
|
91
|
+
- `--learning_rate`: Learning rate for the optimizer (default: 1e-2).
|
|
100
92
|
- `--layer_height`: Layer thickness in millimeters (default: 0.04).
|
|
101
93
|
- `--max_layers`: Maximum number of layers (default: 75).
|
|
102
94
|
**Note:** This is about 3mm + the background height
|
|
103
95
|
- `--background_height`: Height of the background in millimeters (default: 0.4).
|
|
104
96
|
**Note:** The background height must be divisible by the layer height.
|
|
105
|
-
- `--background_color`: Background color in hexadecimal format (default: `#
|
|
106
|
-
|
|
97
|
+
- `--background_color`: Background color in hexadecimal format (default: `#000000` aka Black).
|
|
98
|
+
**Note:** The solver currently assumes that you have a solid color in the background, which means a color with a TD value of 4 or less (if you have a background height of 0.4)
|
|
99
|
+
- `--output_size`: Maximum dimension for target image (default: 1024).
|
|
100
|
+
- `--solver_size`: Maximum dimension for solver (fast) image (default: 128).
|
|
101
|
+
**Note:** We solve on a smaller size as this is many times faster, but also a bit less accurate. Increase if you need more accuracy.
|
|
107
102
|
- `--decay`: Final tau value for the Gumbel-Softmax formulation (default: 0.01).
|
|
108
|
-
- `--loss`: Loss function to use. Choices are `mse`, `perceptual`, or `perceptual_l1` (default: `mse`).
|
|
109
103
|
- `--visualize`: Flag to enable live visualization of the composite image during optimization.
|
|
104
|
+
- `--perform_pruning`: Perform pruning after optimization (default: True).
|
|
105
|
+
- `--pruning_max_colors`: Max number of colors allowed after pruning (default: 10).
|
|
106
|
+
- `--pruning_max_swaps`: Max number of swaps allowed after pruning (default: 20).
|
|
107
|
+
- `--random_seed`: Random seed for reproducibility (default: 0 (disabled) ).
|
|
110
108
|
|
|
111
109
|
## Outputs
|
|
112
110
|
|
|
@@ -132,6 +130,9 @@ Although I would love to be it fully color compatible with hueforge, I don't thi
|
|
|
132
130
|
## License
|
|
133
131
|
|
|
134
132
|
AutoForge © 2025 by Hendric Voss is licensed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).
|
|
133
|
+
The software is provided as-is and comes with no warranty or guarantee of support.
|
|
134
|
+
|
|
135
|
+
The
|
|
135
136
|
|
|
136
137
|
## Acknowledgements
|
|
137
138
|
|
|
@@ -152,5 +153,6 @@ AutoForge makes use of several open source libraries:
|
|
|
152
153
|
Example Images:
|
|
153
154
|
<a href="https://www.vecteezy.com/free-photos/anime-girl">Anime Girl Stock photos by Vecteezy</a>
|
|
154
155
|
<a href="https://www.vecteezy.com/free-photos/nature">Nature Stock photos by Vecteezy</a>
|
|
156
|
+
<a href="https://www.vecteezy.com/free-photos/ai-generated">Ai Generated Stock photos by Vecteezy</a>
|
|
155
157
|
|
|
156
158
|
Happy printing!
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "AutoForge"
|
|
7
|
-
version="1.
|
|
7
|
+
version="1.2.0"
|
|
8
8
|
description = "AutoForge is a Python tool for generating 3D printed layered models from an input image."
|
|
9
9
|
authors = [{ name = "Hendric Voss", email = "hvoss@techfak.uni-bielefeld.de" }]
|
|
10
10
|
readme = "README.md"
|
|
@@ -12,8 +12,8 @@ requires-python = ">=3.9"
|
|
|
12
12
|
license = { text = "CC BY-NC-SA 4.0" }
|
|
13
13
|
dependencies = [
|
|
14
14
|
"numpy>=1.19.0",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"torch>=2.6.0",
|
|
16
|
+
"torchvision>=0.21.0",
|
|
17
17
|
"opencv-python>=4.2.0.32",
|
|
18
18
|
"matplotlib>=3.3.0",
|
|
19
19
|
"configargparse>=1.2.3",
|
|
@@ -27,10 +27,5 @@ dependencies = [
|
|
|
27
27
|
[tool.setuptools]
|
|
28
28
|
package-dir = {"" = "src"}
|
|
29
29
|
|
|
30
|
-
[project.optional-dependencies]
|
|
31
|
-
gpu = [
|
|
32
|
-
"jax[cuda12]",
|
|
33
|
-
]
|
|
34
|
-
|
|
35
30
|
[project.scripts]
|
|
36
31
|
autoforge = "autoforge.auto_forge:main"
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: AutoForge
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: AutoForge is a Python tool for generating 3D printed layered models from an input image.
|
|
5
5
|
Author-email: Hendric Voss <hvoss@techfak.uni-bielefeld.de>
|
|
6
6
|
License: CC BY-NC-SA 4.0
|
|
7
7
|
Requires-Python: >=3.9
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
9
|
Requires-Dist: numpy>=1.19.0
|
|
10
|
-
Requires-Dist:
|
|
11
|
-
Requires-Dist:
|
|
10
|
+
Requires-Dist: torch>=2.6.0
|
|
11
|
+
Requires-Dist: torchvision>=0.21.0
|
|
12
12
|
Requires-Dist: opencv-python>=4.2.0.32
|
|
13
13
|
Requires-Dist: matplotlib>=3.3.0
|
|
14
14
|
Requires-Dist: configargparse>=1.2.3
|
|
@@ -17,8 +17,6 @@ Requires-Dist: pandas>=1.1.0
|
|
|
17
17
|
Requires-Dist: scikit-image
|
|
18
18
|
Requires-Dist: scikit-learn
|
|
19
19
|
Requires-Dist: optax>=0.1.3
|
|
20
|
-
Provides-Extra: gpu
|
|
21
|
-
Requires-Dist: jax[cuda12]; extra == "gpu"
|
|
22
20
|
|
|
23
21
|
# AutoForge
|
|
24
22
|
|
|
@@ -27,25 +25,31 @@ AutoForge is a Python tool for generating 3D printed layered models from an inpu
|
|
|
27
25
|
**TLDR:** It uses a picture to generate a 3D layer image that you can print with a 3d printer. Similar to [Hueforge](https://shop.thehueforge.com/), but without the manual work (and without the artistic control).
|
|
28
26
|
|
|
29
27
|
|
|
28
|
+
## Important Information
|
|
30
29
|
|
|
30
|
+
We recently switched from JAX to PyTorch, to allow for a more streamlined development process. \
|
|
31
|
+
This can have some unforeseen consequences, so please report any bugs you find.
|
|
31
32
|
|
|
32
33
|
## Example
|
|
33
34
|
All examples use only the 13 BambuLab Basic filaments, currently available in Hueforge.
|
|
34
35
|
<div style="display: flex; justify-content: center; gap: 20px;">
|
|
35
36
|
<div style="text-align: center;">
|
|
36
37
|
<h3>Input Image</h3>
|
|
37
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi.jpg" width="
|
|
38
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature.jpg" width="
|
|
38
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi.jpg" width="200" />
|
|
39
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature.jpg" width="200" />
|
|
40
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/cat.jpg" width="200" />
|
|
39
41
|
</div>
|
|
40
42
|
<div style="text-align: center;">
|
|
41
43
|
<h3>Autoforge Output (75 color layers (3.0mm) + 10 gray background layers (0.4mm)) </h3>
|
|
42
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi_discretized.jpg" width="
|
|
43
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature_discretized.jpg" width="
|
|
44
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi_discretized.jpg" width="200" />
|
|
45
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature_discretized.jpg" width="200" />
|
|
46
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/cat_discretized.jpg" width="200" />
|
|
44
47
|
</div>
|
|
45
48
|
<div style="text-align: center;">
|
|
46
49
|
<h3>Imported Hueforge View</h3>
|
|
47
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi_hueforge.png" width="
|
|
48
|
-
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature_hueforge.png" width="
|
|
50
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/lofi_hueforge.png" width="200" />
|
|
51
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/nature_hueforge.png" width="200" />
|
|
52
|
+
<img src="https://github.com/hvoss-techfak/AutoForge/blob/main/images/cat_hueforge.png" width="200" />
|
|
49
53
|
</div>
|
|
50
54
|
</div>
|
|
51
55
|
|
|
@@ -66,33 +70,17 @@ I would love to see what you made!
|
|
|
66
70
|
|
|
67
71
|
## Installation
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
cd AutoForge
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
2. **Set Up a Virtual Environment (Optional but Recommended)**
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
python -m venv venv
|
|
80
|
-
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
3. **Install Dependencies**
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
pip install -r requirements.txt
|
|
87
|
-
```
|
|
73
|
+
To install AutoForge, simply install the current version from PyPI:
|
|
74
|
+
```bash
|
|
75
|
+
pip install autoforge
|
|
76
|
+
```
|
|
88
77
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
If you have a GPU, you can install the GPU version of JAX by running:
|
|
78
|
+
The optimizer is built using JAX, which benefits from a CUDA-compatible GPU for optimal performance. \
|
|
79
|
+
Without a dedicated GPU the process can take significantly longer (up to 10-20x slower). \
|
|
80
|
+
If you have a GPU, you can install the GPU version of autoforge by running:\
|
|
93
81
|
|
|
94
82
|
```bash
|
|
95
|
-
pip install
|
|
83
|
+
pip install autoforge[gpu]
|
|
96
84
|
```
|
|
97
85
|
|
|
98
86
|
Currently, jax gpu support is only available under linux. \
|
|
@@ -108,7 +96,7 @@ The script is run from the command line and accepts several arguments. Below is
|
|
|
108
96
|
> If you want to limit the amount of colors the program can use, you can simply delete the colors you don't want from the CSV file.
|
|
109
97
|
|
|
110
98
|
```bash
|
|
111
|
-
|
|
99
|
+
autoforge --input_image path/to/input_image.jpg --csv_file path/to/materials.csv --output_folder outputs
|
|
112
100
|
```
|
|
113
101
|
|
|
114
102
|
### Command Line Arguments
|
|
@@ -117,18 +105,26 @@ python auto_forge.py --input_image path/to/input_image.jpg --csv_file path/to/ma
|
|
|
117
105
|
- `--input_image`: **(Required)** Path to the input image.
|
|
118
106
|
- `--csv_file`: **(Required)** Path to the CSV file containing material data. The CSV should include columns for the brand, name, color (hex code), and TD values.
|
|
119
107
|
- `--output_folder`: **(Required)** Folder where output files will be saved.
|
|
120
|
-
- `--iterations`: Number of optimization iterations (default:
|
|
121
|
-
- `--
|
|
108
|
+
- `--iterations`: Number of optimization iterations (default: 5000).
|
|
109
|
+
- `--best_loss_iterations`: Percentage of optimization iterations after which we start to record the best loss (default: 4000).
|
|
110
|
+
**Note:** We currently do this as we increase a penalty loss for color and color swaps as the time goes on. Without this the penalties would have no impact.
|
|
111
|
+
- `--learning_rate`: Learning rate for the optimizer (default: 1e-2).
|
|
122
112
|
- `--layer_height`: Layer thickness in millimeters (default: 0.04).
|
|
123
113
|
- `--max_layers`: Maximum number of layers (default: 75).
|
|
124
114
|
**Note:** This is about 3mm + the background height
|
|
125
115
|
- `--background_height`: Height of the background in millimeters (default: 0.4).
|
|
126
116
|
**Note:** The background height must be divisible by the layer height.
|
|
127
|
-
- `--background_color`: Background color in hexadecimal format (default: `#
|
|
128
|
-
|
|
117
|
+
- `--background_color`: Background color in hexadecimal format (default: `#000000` aka Black).
|
|
118
|
+
**Note:** The solver currently assumes that you have a solid color in the background, which means a color with a TD value of 4 or less (if you have a background height of 0.4)
|
|
119
|
+
- `--output_size`: Maximum dimension for target image (default: 1024).
|
|
120
|
+
- `--solver_size`: Maximum dimension for solver (fast) image (default: 128).
|
|
121
|
+
**Note:** We solve on a smaller size as this is many times faster, but also a bit less accurate. Increase if you need more accuracy.
|
|
129
122
|
- `--decay`: Final tau value for the Gumbel-Softmax formulation (default: 0.01).
|
|
130
|
-
- `--loss`: Loss function to use. Choices are `mse`, `perceptual`, or `perceptual_l1` (default: `mse`).
|
|
131
123
|
- `--visualize`: Flag to enable live visualization of the composite image during optimization.
|
|
124
|
+
- `--perform_pruning`: Perform pruning after optimization (default: True).
|
|
125
|
+
- `--pruning_max_colors`: Max number of colors allowed after pruning (default: 10).
|
|
126
|
+
- `--pruning_max_swaps`: Max number of swaps allowed after pruning (default: 20).
|
|
127
|
+
- `--random_seed`: Random seed for reproducibility (default: 0 (disabled) ).
|
|
132
128
|
|
|
133
129
|
## Outputs
|
|
134
130
|
|
|
@@ -154,6 +150,9 @@ Although I would love to be it fully color compatible with hueforge, I don't thi
|
|
|
154
150
|
## License
|
|
155
151
|
|
|
156
152
|
AutoForge © 2025 by Hendric Voss is licensed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).
|
|
153
|
+
The software is provided as-is and comes with no warranty or guarantee of support.
|
|
154
|
+
|
|
155
|
+
The
|
|
157
156
|
|
|
158
157
|
## Acknowledgements
|
|
159
158
|
|
|
@@ -174,5 +173,6 @@ AutoForge makes use of several open source libraries:
|
|
|
174
173
|
Example Images:
|
|
175
174
|
<a href="https://www.vecteezy.com/free-photos/anime-girl">Anime Girl Stock photos by Vecteezy</a>
|
|
176
175
|
<a href="https://www.vecteezy.com/free-photos/nature">Nature Stock photos by Vecteezy</a>
|
|
176
|
+
<a href="https://www.vecteezy.com/free-photos/ai-generated">Ai Generated Stock photos by Vecteezy</a>
|
|
177
177
|
|
|
178
178
|
Happy printing!
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/AutoForge.egg-info/PKG-INFO
|
|
4
|
+
src/AutoForge.egg-info/SOURCES.txt
|
|
5
|
+
src/AutoForge.egg-info/dependency_links.txt
|
|
6
|
+
src/AutoForge.egg-info/entry_points.txt
|
|
7
|
+
src/AutoForge.egg-info/requires.txt
|
|
8
|
+
src/AutoForge.egg-info/top_level.txt
|
|
9
|
+
src/autoforge/__init__.py
|
|
10
|
+
src/autoforge/__main__.py
|
|
11
|
+
src/autoforge/auto_forge.py
|
|
12
|
+
src/autoforge/auto_forge_gradio.py
|
|
13
|
+
src/autoforge/color_fit_bayesian.py
|
|
14
|
+
src/autoforge/filamentcolors_library.py
|
|
15
|
+
src/autoforge/old_jax_files.py
|
|
16
|
+
src/autoforge/Helper/FilamentHelper.py
|
|
17
|
+
src/autoforge/Helper/ImageHelper.py
|
|
18
|
+
src/autoforge/Helper/OptimizerHelper.py
|
|
19
|
+
src/autoforge/Helper/OutputHelper.py
|
|
20
|
+
src/autoforge/Helper/PruningHelper.py
|
|
21
|
+
src/autoforge/Helper/__init__.py
|
|
22
|
+
src/autoforge/Loss/LossFunctions.py
|
|
23
|
+
src/autoforge/Loss/PerceptionLoss.py
|
|
24
|
+
src/autoforge/Loss/__init__.py
|
|
25
|
+
src/autoforge/Modules/Optimizer.py
|
|
26
|
+
src/autoforge/Modules/__init__.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
numpy>=1.19.0
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
torch>=2.6.0
|
|
3
|
+
torchvision>=0.21.0
|
|
4
4
|
opencv-python>=4.2.0.32
|
|
5
5
|
matplotlib>=3.3.0
|
|
6
6
|
configargparse>=1.2.3
|
|
@@ -9,6 +9,3 @@ pandas>=1.1.0
|
|
|
9
9
|
scikit-image
|
|
10
10
|
scikit-learn
|
|
11
11
|
optax>=0.1.3
|
|
12
|
-
|
|
13
|
-
[gpu]
|
|
14
|
-
jax[cuda12]
|