autoforge 1.2.1__tar.gz → 1.3.1__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.
Files changed (29) hide show
  1. {autoforge-1.2.1 → autoforge-1.3.1}/PKG-INFO +32 -11
  2. {autoforge-1.2.1 → autoforge-1.3.1}/README.md +30 -10
  3. {autoforge-1.2.1 → autoforge-1.3.1}/pyproject.toml +2 -1
  4. {autoforge-1.2.1 → autoforge-1.3.1}/src/AutoForge.egg-info/PKG-INFO +32 -11
  5. {autoforge-1.2.1 → autoforge-1.3.1}/src/AutoForge.egg-info/requires.txt +1 -0
  6. autoforge-1.3.1/src/autoforge/Helper/OptimizerHelper.py +664 -0
  7. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/Helper/OutputHelper.py +65 -52
  8. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/Helper/PruningHelper.py +192 -13
  9. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/Loss/LossFunctions.py +2 -0
  10. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/Modules/Optimizer.py +32 -5
  11. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/auto_forge.py +98 -29
  12. autoforge-1.2.1/src/autoforge/Helper/OptimizerHelper.py +0 -333
  13. {autoforge-1.2.1 → autoforge-1.3.1}/setup.cfg +0 -0
  14. {autoforge-1.2.1 → autoforge-1.3.1}/src/AutoForge.egg-info/SOURCES.txt +0 -0
  15. {autoforge-1.2.1 → autoforge-1.3.1}/src/AutoForge.egg-info/dependency_links.txt +0 -0
  16. {autoforge-1.2.1 → autoforge-1.3.1}/src/AutoForge.egg-info/entry_points.txt +0 -0
  17. {autoforge-1.2.1 → autoforge-1.3.1}/src/AutoForge.egg-info/top_level.txt +0 -0
  18. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/Helper/FilamentHelper.py +0 -0
  19. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/Helper/ImageHelper.py +0 -0
  20. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/Helper/__init__.py +0 -0
  21. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/Loss/PerceptionLoss.py +0 -0
  22. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/Loss/__init__.py +0 -0
  23. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/Modules/__init__.py +0 -0
  24. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/__init__.py +0 -0
  25. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/__main__.py +0 -0
  26. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/auto_forge_gradio.py +0 -0
  27. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/color_fit_bayesian.py +0 -0
  28. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/filamentcolors_library.py +0 -0
  29. {autoforge-1.2.1 → autoforge-1.3.1}/src/autoforge/old_jax_files.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: AutoForge
3
- Version: 1.2.1
3
+ Version: 1.3.1
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
@@ -9,6 +9,7 @@ Description-Content-Type: text/markdown
9
9
  Requires-Dist: numpy>=1.19.0
10
10
  Requires-Dist: torch>=2.6.0
11
11
  Requires-Dist: torchvision>=0.21.0
12
+ Requires-Dist: transformers>=4.48.1
12
13
  Requires-Dist: opencv-python>=4.2.0.32
13
14
  Requires-Dist: matplotlib>=3.3.0
14
15
  Requires-Dist: configargparse>=1.2.3
@@ -29,6 +30,10 @@ AutoForge is a Python tool for generating 3D printed layered models from an inpu
29
30
  We recently switched from JAX to PyTorch, to allow for a more streamlined development process. \
30
31
  This can have some unforeseen consequences, so please report any bugs you find.
31
32
 
33
+ This release should give better gpu support for more users, especially on windows. \
34
+ If you have problems running the code on your gpu, please refer to the [Pytorch Homepage](https://pytorch.org/) for help. \
35
+ Both CUDA and ROCm are supported, but you need to install the correct version of pytorch for your system.
36
+
32
37
  ## Example
33
38
  All examples use only the 13 BambuLab Basic filaments, currently available in Hueforge.
34
39
  <div style="display: flex; justify-content: center; gap: 20px;">
@@ -92,28 +97,44 @@ autoforge --input_image path/to/input_image.jpg --csv_file path/to/materials.csv
92
97
  - `--config`: *(Optional)* Path to a configuration file with the settings.
93
98
  - `--input_image`: **(Required)** Path to the input image.
94
99
  - `--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.
95
- - `--output_folder`: **(Required)** Folder where output files will be saved.
100
+ - `--output_folder`: Folder where output files will be saved. (default: `./outputs`).
96
101
  - `--iterations`: Number of optimization iterations (default: 5000).
97
- - `--best_loss_iterations`: Percentage of optimization iterations after which we start to record the best loss (default: 4000).
98
- **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.
99
102
  - `--learning_rate`: Learning rate for the optimizer (default: 1e-2).
100
103
  - `--layer_height`: Layer thickness in millimeters (default: 0.04).
101
- - `--max_layers`: Maximum number of layers (default: 75).
104
+ - `--max_layers`: Maximum number of layers (default: 75). \
102
105
  **Note:** This is about 3mm + the background height
103
- - `--background_height`: Height of the background in millimeters (default: 0.4).
106
+ - `--background_height`: Height of the background in millimeters (default: 0.4). \
104
107
  **Note:** The background height must be divisible by the layer height.
105
- - `--background_color`: Background color in hexadecimal format (default: `#000000` aka Black).
108
+ - `--background_color`: Background color in hexadecimal format (default: `#000000` aka Black). \
106
109
  **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)
107
110
  - `--output_size`: Maximum dimension for target image (default: 1024).
108
- - `--solver_size`: Maximum dimension for solver (fast) image (default: 128).
111
+ - `--solver_size`: Maximum dimension for solver (fast) image (default: 128). \
109
112
  **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.
110
113
  - `--decay`: Final tau value for the Gumbel-Softmax formulation (default: 0.01).
111
114
  - `--visualize`: Flag to enable live visualization of the composite image during optimization.
112
- - `--perform_pruning`: Perform pruning after optimization (default: True).
113
- - `--pruning_max_colors`: Max number of colors allowed after pruning (default: 10).
114
- - `--pruning_max_swaps`: Max number of swaps allowed after pruning (default: 20).
115
+ - `--perform_pruning`: Perform pruning after optimization (default: True). \
116
+ **Note:** This is highly recommended even if you don't have a color/color swap limit, as it actually increases the quality of the output.
117
+ - `--pruning_max_colors`: Max number of colors allowed after pruning (default: 100).
118
+ - `--pruning_max_swaps`: Max number of swaps allowed after pruning (default: 100).
115
119
  - `--random_seed`: Random seed for reproducibility (default: 0 (disabled) ).
116
120
 
121
+ ### Experimental Deph Anything V2 parameters
122
+ I got a request to add a initializing function that takes the original deph of the image into account when initializing. \
123
+ In theory this should give you a nice background/foreground separation, but in practice it can degrade the quality of the output. \
124
+ In addition you need the VRAM to run the depth model. \
125
+ I currently don't recommend it as the output is not as good as without it, but I will leave it in for now. \
126
+
127
+ - `--use_depth_anything`: Use a depth anything v2 model to initialize the height map (default: False).
128
+ **Note:** This will give you a nice background/foreground separation, but will could degrade quality in some cases.
129
+ **Note:** In addition you need the VRAM to run the depth model.
130
+
131
+ - `--depth_strength`: Weight for blending even spacing with the cluster’s average depth when using depth initialization. (default: 0.25)
132
+ - `--depth_threshold`: Threshold for splitting two distinct colors based on depth. (default: 0.05)
133
+ - `--min_cluster_value`: Minimum normalized value for the lowest cluster (to avoid pure black). (default: 0.1)
134
+ - `--w_depth`: Weight for depth difference in ordering. (default: 0.5)
135
+ - `--w_lum`: Weight for luminance difference in ordering. (default: 1.0)
136
+ - `--order_blend`: Blending factor between original luminance ordering (0) and depth-informed ordering (1). (default: 0.1)
137
+
117
138
 
118
139
  ## Outputs
119
140
 
@@ -10,6 +10,10 @@ AutoForge is a Python tool for generating 3D printed layered models from an inpu
10
10
  We recently switched from JAX to PyTorch, to allow for a more streamlined development process. \
11
11
  This can have some unforeseen consequences, so please report any bugs you find.
12
12
 
13
+ This release should give better gpu support for more users, especially on windows. \
14
+ If you have problems running the code on your gpu, please refer to the [Pytorch Homepage](https://pytorch.org/) for help. \
15
+ Both CUDA and ROCm are supported, but you need to install the correct version of pytorch for your system.
16
+
13
17
  ## Example
14
18
  All examples use only the 13 BambuLab Basic filaments, currently available in Hueforge.
15
19
  <div style="display: flex; justify-content: center; gap: 20px;">
@@ -73,28 +77,44 @@ autoforge --input_image path/to/input_image.jpg --csv_file path/to/materials.csv
73
77
  - `--config`: *(Optional)* Path to a configuration file with the settings.
74
78
  - `--input_image`: **(Required)** Path to the input image.
75
79
  - `--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.
76
- - `--output_folder`: **(Required)** Folder where output files will be saved.
80
+ - `--output_folder`: Folder where output files will be saved. (default: `./outputs`).
77
81
  - `--iterations`: Number of optimization iterations (default: 5000).
78
- - `--best_loss_iterations`: Percentage of optimization iterations after which we start to record the best loss (default: 4000).
79
- **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.
80
82
  - `--learning_rate`: Learning rate for the optimizer (default: 1e-2).
81
83
  - `--layer_height`: Layer thickness in millimeters (default: 0.04).
82
- - `--max_layers`: Maximum number of layers (default: 75).
84
+ - `--max_layers`: Maximum number of layers (default: 75). \
83
85
  **Note:** This is about 3mm + the background height
84
- - `--background_height`: Height of the background in millimeters (default: 0.4).
86
+ - `--background_height`: Height of the background in millimeters (default: 0.4). \
85
87
  **Note:** The background height must be divisible by the layer height.
86
- - `--background_color`: Background color in hexadecimal format (default: `#000000` aka Black).
88
+ - `--background_color`: Background color in hexadecimal format (default: `#000000` aka Black). \
87
89
  **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)
88
90
  - `--output_size`: Maximum dimension for target image (default: 1024).
89
- - `--solver_size`: Maximum dimension for solver (fast) image (default: 128).
91
+ - `--solver_size`: Maximum dimension for solver (fast) image (default: 128). \
90
92
  **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.
91
93
  - `--decay`: Final tau value for the Gumbel-Softmax formulation (default: 0.01).
92
94
  - `--visualize`: Flag to enable live visualization of the composite image during optimization.
93
- - `--perform_pruning`: Perform pruning after optimization (default: True).
94
- - `--pruning_max_colors`: Max number of colors allowed after pruning (default: 10).
95
- - `--pruning_max_swaps`: Max number of swaps allowed after pruning (default: 20).
95
+ - `--perform_pruning`: Perform pruning after optimization (default: True). \
96
+ **Note:** This is highly recommended even if you don't have a color/color swap limit, as it actually increases the quality of the output.
97
+ - `--pruning_max_colors`: Max number of colors allowed after pruning (default: 100).
98
+ - `--pruning_max_swaps`: Max number of swaps allowed after pruning (default: 100).
96
99
  - `--random_seed`: Random seed for reproducibility (default: 0 (disabled) ).
97
100
 
101
+ ### Experimental Deph Anything V2 parameters
102
+ I got a request to add a initializing function that takes the original deph of the image into account when initializing. \
103
+ In theory this should give you a nice background/foreground separation, but in practice it can degrade the quality of the output. \
104
+ In addition you need the VRAM to run the depth model. \
105
+ I currently don't recommend it as the output is not as good as without it, but I will leave it in for now. \
106
+
107
+ - `--use_depth_anything`: Use a depth anything v2 model to initialize the height map (default: False).
108
+ **Note:** This will give you a nice background/foreground separation, but will could degrade quality in some cases.
109
+ **Note:** In addition you need the VRAM to run the depth model.
110
+
111
+ - `--depth_strength`: Weight for blending even spacing with the cluster’s average depth when using depth initialization. (default: 0.25)
112
+ - `--depth_threshold`: Threshold for splitting two distinct colors based on depth. (default: 0.05)
113
+ - `--min_cluster_value`: Minimum normalized value for the lowest cluster (to avoid pure black). (default: 0.1)
114
+ - `--w_depth`: Weight for depth difference in ordering. (default: 0.5)
115
+ - `--w_lum`: Weight for luminance difference in ordering. (default: 1.0)
116
+ - `--order_blend`: Blending factor between original luminance ordering (0) and depth-informed ordering (1). (default: 0.1)
117
+
98
118
 
99
119
  ## Outputs
100
120
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "AutoForge"
7
- version="1.2.1"
7
+ version="1.3.1"
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"
@@ -14,6 +14,7 @@ dependencies = [
14
14
  "numpy>=1.19.0",
15
15
  "torch>=2.6.0",
16
16
  "torchvision>=0.21.0",
17
+ "transformers>=4.48.1",
17
18
  "opencv-python>=4.2.0.32",
18
19
  "matplotlib>=3.3.0",
19
20
  "configargparse>=1.2.3",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: AutoForge
3
- Version: 1.2.1
3
+ Version: 1.3.1
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
@@ -9,6 +9,7 @@ Description-Content-Type: text/markdown
9
9
  Requires-Dist: numpy>=1.19.0
10
10
  Requires-Dist: torch>=2.6.0
11
11
  Requires-Dist: torchvision>=0.21.0
12
+ Requires-Dist: transformers>=4.48.1
12
13
  Requires-Dist: opencv-python>=4.2.0.32
13
14
  Requires-Dist: matplotlib>=3.3.0
14
15
  Requires-Dist: configargparse>=1.2.3
@@ -29,6 +30,10 @@ AutoForge is a Python tool for generating 3D printed layered models from an inpu
29
30
  We recently switched from JAX to PyTorch, to allow for a more streamlined development process. \
30
31
  This can have some unforeseen consequences, so please report any bugs you find.
31
32
 
33
+ This release should give better gpu support for more users, especially on windows. \
34
+ If you have problems running the code on your gpu, please refer to the [Pytorch Homepage](https://pytorch.org/) for help. \
35
+ Both CUDA and ROCm are supported, but you need to install the correct version of pytorch for your system.
36
+
32
37
  ## Example
33
38
  All examples use only the 13 BambuLab Basic filaments, currently available in Hueforge.
34
39
  <div style="display: flex; justify-content: center; gap: 20px;">
@@ -92,28 +97,44 @@ autoforge --input_image path/to/input_image.jpg --csv_file path/to/materials.csv
92
97
  - `--config`: *(Optional)* Path to a configuration file with the settings.
93
98
  - `--input_image`: **(Required)** Path to the input image.
94
99
  - `--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.
95
- - `--output_folder`: **(Required)** Folder where output files will be saved.
100
+ - `--output_folder`: Folder where output files will be saved. (default: `./outputs`).
96
101
  - `--iterations`: Number of optimization iterations (default: 5000).
97
- - `--best_loss_iterations`: Percentage of optimization iterations after which we start to record the best loss (default: 4000).
98
- **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.
99
102
  - `--learning_rate`: Learning rate for the optimizer (default: 1e-2).
100
103
  - `--layer_height`: Layer thickness in millimeters (default: 0.04).
101
- - `--max_layers`: Maximum number of layers (default: 75).
104
+ - `--max_layers`: Maximum number of layers (default: 75). \
102
105
  **Note:** This is about 3mm + the background height
103
- - `--background_height`: Height of the background in millimeters (default: 0.4).
106
+ - `--background_height`: Height of the background in millimeters (default: 0.4). \
104
107
  **Note:** The background height must be divisible by the layer height.
105
- - `--background_color`: Background color in hexadecimal format (default: `#000000` aka Black).
108
+ - `--background_color`: Background color in hexadecimal format (default: `#000000` aka Black). \
106
109
  **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)
107
110
  - `--output_size`: Maximum dimension for target image (default: 1024).
108
- - `--solver_size`: Maximum dimension for solver (fast) image (default: 128).
111
+ - `--solver_size`: Maximum dimension for solver (fast) image (default: 128). \
109
112
  **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.
110
113
  - `--decay`: Final tau value for the Gumbel-Softmax formulation (default: 0.01).
111
114
  - `--visualize`: Flag to enable live visualization of the composite image during optimization.
112
- - `--perform_pruning`: Perform pruning after optimization (default: True).
113
- - `--pruning_max_colors`: Max number of colors allowed after pruning (default: 10).
114
- - `--pruning_max_swaps`: Max number of swaps allowed after pruning (default: 20).
115
+ - `--perform_pruning`: Perform pruning after optimization (default: True). \
116
+ **Note:** This is highly recommended even if you don't have a color/color swap limit, as it actually increases the quality of the output.
117
+ - `--pruning_max_colors`: Max number of colors allowed after pruning (default: 100).
118
+ - `--pruning_max_swaps`: Max number of swaps allowed after pruning (default: 100).
115
119
  - `--random_seed`: Random seed for reproducibility (default: 0 (disabled) ).
116
120
 
121
+ ### Experimental Deph Anything V2 parameters
122
+ I got a request to add a initializing function that takes the original deph of the image into account when initializing. \
123
+ In theory this should give you a nice background/foreground separation, but in practice it can degrade the quality of the output. \
124
+ In addition you need the VRAM to run the depth model. \
125
+ I currently don't recommend it as the output is not as good as without it, but I will leave it in for now. \
126
+
127
+ - `--use_depth_anything`: Use a depth anything v2 model to initialize the height map (default: False).
128
+ **Note:** This will give you a nice background/foreground separation, but will could degrade quality in some cases.
129
+ **Note:** In addition you need the VRAM to run the depth model.
130
+
131
+ - `--depth_strength`: Weight for blending even spacing with the cluster’s average depth when using depth initialization. (default: 0.25)
132
+ - `--depth_threshold`: Threshold for splitting two distinct colors based on depth. (default: 0.05)
133
+ - `--min_cluster_value`: Minimum normalized value for the lowest cluster (to avoid pure black). (default: 0.1)
134
+ - `--w_depth`: Weight for depth difference in ordering. (default: 0.5)
135
+ - `--w_lum`: Weight for luminance difference in ordering. (default: 1.0)
136
+ - `--order_blend`: Blending factor between original luminance ordering (0) and depth-informed ordering (1). (default: 0.1)
137
+
117
138
 
118
139
  ## Outputs
119
140
 
@@ -1,6 +1,7 @@
1
1
  numpy>=1.19.0
2
2
  torch>=2.6.0
3
3
  torchvision>=0.21.0
4
+ transformers>=4.48.1
4
5
  opencv-python>=4.2.0.32
5
6
  matplotlib>=3.3.0
6
7
  configargparse>=1.2.3