autoforge 1.7.0__tar.gz → 1.7.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.
- {autoforge-1.7.0 → autoforge-1.7.1}/PKG-INFO +21 -2
- {autoforge-1.7.0 → autoforge-1.7.1}/README.md +20 -1
- {autoforge-1.7.0 → autoforge-1.7.1}/pyproject.toml +1 -1
- {autoforge-1.7.0 → autoforge-1.7.1}/src/AutoForge.egg-info/PKG-INFO +21 -2
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Helper/ImageHelper.py +16 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Helper/OutputHelper.py +5 -3
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Modules/Optimizer.py +10 -6
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/auto_forge.py +13 -3
- {autoforge-1.7.0 → autoforge-1.7.1}/setup.cfg +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/AutoForge.egg-info/SOURCES.txt +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/AutoForge.egg-info/dependency_links.txt +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/AutoForge.egg-info/entry_points.txt +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/AutoForge.egg-info/requires.txt +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/AutoForge.egg-info/top_level.txt +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Gui/__init__.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Gui/browser_gui/Views/__init__.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Gui/browser_gui/Views/backend_database.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Gui/browser_gui/Views/filament_editor.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Gui/browser_gui/app.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Gui/browser_gui/main.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Helper/CAdamW.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Helper/FilamentHelper.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Helper/Heightmaps/ChristofidesHeightMap.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Helper/Heightmaps/DepthEstimateHeightMap.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Helper/Heightmaps/OldHeightmap.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Helper/Heightmaps/__init__.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Helper/OptimizerHelper.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Helper/PruningHelper.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Helper/__init__.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Helper/filamentcolors_library.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Init_comparer/__init__.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Init_comparer/auto_forge_init_check.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Init_comparer/plot_results.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Loss/LossFunctions.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Loss/PerceptionLoss.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Loss/__init__.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Misc/__init__.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Misc/color_fit_all.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Modules/__init__.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/__init__.py +0 -0
- {autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/__main__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AutoForge
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.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
|
|
@@ -177,10 +177,29 @@ After running, the following files will be created in your specified output fold
|
|
|
177
177
|
- **Hueforge Project File**: `project_file.hfp`
|
|
178
178
|
- **Swap Instructions**: `swap_instructions.txt`
|
|
179
179
|
|
|
180
|
+
## Development
|
|
181
|
+
|
|
182
|
+
To have a "nightly" version of the repository or have live updating changes during development please do the following:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
git clone https://github.com/hvoss-techfak/AutoForge.git
|
|
186
|
+
cd AutoForge
|
|
187
|
+
conda create -n forge python=3.11
|
|
188
|
+
conda activate forge
|
|
189
|
+
pip install -e .
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
If the installed pytorch version has no cuda support execute the following:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
conda activate forge
|
|
196
|
+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
|
|
180
200
|
## Known Bugs
|
|
181
201
|
|
|
182
202
|
- The optimizer can sometimes get stuck in a local minimum. If this happens, try running the optimization again with different settings.
|
|
183
|
-
- Hueforge can't open STL files under linux. This is a known bug in hueforge.
|
|
184
203
|
|
|
185
204
|
## License
|
|
186
205
|
|
|
@@ -151,10 +151,29 @@ After running, the following files will be created in your specified output fold
|
|
|
151
151
|
- **Hueforge Project File**: `project_file.hfp`
|
|
152
152
|
- **Swap Instructions**: `swap_instructions.txt`
|
|
153
153
|
|
|
154
|
+
## Development
|
|
155
|
+
|
|
156
|
+
To have a "nightly" version of the repository or have live updating changes during development please do the following:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
git clone https://github.com/hvoss-techfak/AutoForge.git
|
|
160
|
+
cd AutoForge
|
|
161
|
+
conda create -n forge python=3.11
|
|
162
|
+
conda activate forge
|
|
163
|
+
pip install -e .
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
If the installed pytorch version has no cuda support execute the following:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
conda activate forge
|
|
170
|
+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
|
|
154
174
|
## Known Bugs
|
|
155
175
|
|
|
156
176
|
- The optimizer can sometimes get stuck in a local minimum. If this happens, try running the optimization again with different settings.
|
|
157
|
-
- Hueforge can't open STL files under linux. This is a known bug in hueforge.
|
|
158
177
|
|
|
159
178
|
## License
|
|
160
179
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "AutoForge"
|
|
7
|
-
version="1.7.
|
|
7
|
+
version="1.7.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"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AutoForge
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.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
|
|
@@ -177,10 +177,29 @@ After running, the following files will be created in your specified output fold
|
|
|
177
177
|
- **Hueforge Project File**: `project_file.hfp`
|
|
178
178
|
- **Swap Instructions**: `swap_instructions.txt`
|
|
179
179
|
|
|
180
|
+
## Development
|
|
181
|
+
|
|
182
|
+
To have a "nightly" version of the repository or have live updating changes during development please do the following:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
git clone https://github.com/hvoss-techfak/AutoForge.git
|
|
186
|
+
cd AutoForge
|
|
187
|
+
conda create -n forge python=3.11
|
|
188
|
+
conda activate forge
|
|
189
|
+
pip install -e .
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
If the installed pytorch version has no cuda support execute the following:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
conda activate forge
|
|
196
|
+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
|
|
180
200
|
## Known Bugs
|
|
181
201
|
|
|
182
202
|
- The optimizer can sometimes get stuck in a local minimum. If this happens, try running the optimization again with different settings.
|
|
183
|
-
- Hueforge can't open STL files under linux. This is a known bug in hueforge.
|
|
184
203
|
|
|
185
204
|
## License
|
|
186
205
|
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from typing import Sequence
|
|
3
|
+
|
|
1
4
|
import cv2
|
|
2
5
|
import torch
|
|
6
|
+
from cv2.typing import MatLike
|
|
7
|
+
import numpy as np
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def imread(filename: str, flags: int = cv2.IMREAD_COLOR) -> MatLike:
|
|
11
|
+
return cv2.imdecode(np.fromfile(filename, dtype=np.uint8), flags)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def imwrite(filename: str, img: MatLike, params: Sequence[int] = ()) -> None:
|
|
15
|
+
success, encoded_img = cv2.imencode(os.path.splitext(filename)[1], img, params)
|
|
16
|
+
if not success:
|
|
17
|
+
raise OSError(f"cv2 could not write to path {filename}")
|
|
18
|
+
encoded_img.tofile(filename)
|
|
3
19
|
|
|
4
20
|
|
|
5
21
|
def resize_image(img, max_size):
|
|
@@ -98,12 +98,14 @@ def generate_project_file(
|
|
|
98
98
|
"Color": mat[" Color"],
|
|
99
99
|
"Name": mat[" Name"],
|
|
100
100
|
# Convert Owned to a boolean (in case it is read as a string)
|
|
101
|
-
"Owned": str(mat[" Owned"]).strip().lower() == "true"
|
|
101
|
+
"Owned": str(mat[" Owned"]).strip().lower() == "true"
|
|
102
|
+
if " Owned" in mat
|
|
103
|
+
else False,
|
|
102
104
|
"Transmissivity": float(mat[" TD"])
|
|
103
105
|
if not float(mat[" TD"]).is_integer()
|
|
104
106
|
else int(mat[" TD"]),
|
|
105
|
-
"Type": mat[" Type"],
|
|
106
|
-
"uuid": mat[" Uuid"],
|
|
107
|
+
"Type": mat[" Type"] if " Type" in mat else "PLA",
|
|
108
|
+
"uuid": mat[" Uuid"] if " Uuid" in mat else str(uuid.uuid4()),
|
|
107
109
|
}
|
|
108
110
|
filament_set.append(filament_entry)
|
|
109
111
|
|
|
@@ -171,7 +171,8 @@ class FilamentOptimizer:
|
|
|
171
171
|
|
|
172
172
|
# If you want a figure for real-time visualization:
|
|
173
173
|
if self.visualize_flag:
|
|
174
|
-
|
|
174
|
+
if self.args.disable_visualization_for_gradio != 1:
|
|
175
|
+
plt.ion()
|
|
175
176
|
self.fig, self.ax = plt.subplots(2, 3, figsize=(14, 6))
|
|
176
177
|
|
|
177
178
|
self.target_im_ax = self.ax[0, 0].imshow(
|
|
@@ -188,7 +189,8 @@ class FilamentOptimizer:
|
|
|
188
189
|
np.zeros((self.H, self.W, 3), dtype=np.uint8)
|
|
189
190
|
)
|
|
190
191
|
self.ax[0, 2].set_title("Best Discrete Composite")
|
|
191
|
-
|
|
192
|
+
if self.args.disable_visualization_for_gradio != 1:
|
|
193
|
+
plt.pause(0.1)
|
|
192
194
|
|
|
193
195
|
self.depth_map_ax = self.ax[1, 0].imshow(
|
|
194
196
|
np.zeros((self.H, self.W), dtype=np.uint8), cmap="viridis"
|
|
@@ -445,10 +447,11 @@ class FilamentOptimizer:
|
|
|
445
447
|
self.diff_depth_map_ax.set_clim(-2.5, 2.5)
|
|
446
448
|
|
|
447
449
|
self.fig.suptitle(
|
|
448
|
-
f"Step {self.num_steps_done}, Tau: {tau_g:.4f}, Loss: {self.loss:.4f}, Best Discrete Loss: {self.best_discrete_loss:.4f}"
|
|
450
|
+
f"Step {self.num_steps_done}/{self.args.iterations}, Tau: {tau_g:.4f}, Loss: {self.loss:.4f}, Best Discrete Loss: {self.best_discrete_loss:.4f}"
|
|
449
451
|
)
|
|
450
|
-
|
|
451
|
-
|
|
452
|
+
if self.args.disable_visualization_for_gradio != 1:
|
|
453
|
+
plt.pause(0.01)
|
|
454
|
+
plt.savefig(self.args.output_folder + "/vis_temp.png")
|
|
452
455
|
|
|
453
456
|
def get_current_parameters(self):
|
|
454
457
|
"""
|
|
@@ -544,8 +547,9 @@ class FilamentOptimizer:
|
|
|
544
547
|
prune_num_swaps,
|
|
545
548
|
prune_redundant_layers,
|
|
546
549
|
)
|
|
550
|
+
|
|
547
551
|
if search_seed:
|
|
548
|
-
self.rng_seed_search(self.best_discrete_loss,
|
|
552
|
+
self.rng_seed_search(self.best_discrete_loss, 100, autoset_seed=True)
|
|
549
553
|
|
|
550
554
|
prune_num_colors(
|
|
551
555
|
self,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import argparse
|
|
1
2
|
import sys
|
|
2
3
|
import os
|
|
3
4
|
import time
|
|
@@ -15,7 +16,7 @@ from autoforge.Helper.Heightmaps.DepthEstimateHeightMap import (
|
|
|
15
16
|
init_height_map_depth_color_adjusted,
|
|
16
17
|
)
|
|
17
18
|
|
|
18
|
-
from autoforge.Helper.ImageHelper import resize_image
|
|
19
|
+
from autoforge.Helper.ImageHelper import resize_image, imread
|
|
19
20
|
from autoforge.Helper.OutputHelper import (
|
|
20
21
|
generate_stl,
|
|
21
22
|
generate_swap_instructions,
|
|
@@ -120,6 +121,7 @@ def main():
|
|
|
120
121
|
type=bool,
|
|
121
122
|
default=True,
|
|
122
123
|
help="Enable visualization during optimization",
|
|
124
|
+
action=argparse.BooleanOptionalAction,
|
|
123
125
|
)
|
|
124
126
|
|
|
125
127
|
# Instead of an output_size parameter, we use stl_output_size and nozzle_diameter.
|
|
@@ -147,12 +149,14 @@ def main():
|
|
|
147
149
|
type=bool,
|
|
148
150
|
default=True,
|
|
149
151
|
help="Perform pruning after optimization",
|
|
152
|
+
action=argparse.BooleanOptionalAction,
|
|
150
153
|
)
|
|
151
154
|
parser.add_argument(
|
|
152
155
|
"--fast_pruning",
|
|
153
156
|
type=bool,
|
|
154
157
|
default=True,
|
|
155
158
|
help="Use fast pruning method",
|
|
159
|
+
action=argparse.BooleanOptionalAction,
|
|
156
160
|
)
|
|
157
161
|
parser.add_argument(
|
|
158
162
|
"--fast_pruning_percent",
|
|
@@ -242,7 +246,7 @@ def main():
|
|
|
242
246
|
parser.add_argument(
|
|
243
247
|
"--num_init_rounds",
|
|
244
248
|
type=int,
|
|
245
|
-
default=
|
|
249
|
+
default=128,
|
|
246
250
|
help="Number of rounds to choose the starting height map from.",
|
|
247
251
|
)
|
|
248
252
|
parser.add_argument(
|
|
@@ -251,6 +255,12 @@ def main():
|
|
|
251
255
|
default=-1,
|
|
252
256
|
help="Number of layers to cluster the image into.",
|
|
253
257
|
)
|
|
258
|
+
parser.add_argument(
|
|
259
|
+
"--disable_visualization_for_gradio",
|
|
260
|
+
type=int,
|
|
261
|
+
default=0,
|
|
262
|
+
help="Simple switch to disable the matplotlib render window for gradio rendering.",
|
|
263
|
+
)
|
|
254
264
|
|
|
255
265
|
args = parser.parse_args()
|
|
256
266
|
if args.num_init_cluster_layers == -1:
|
|
@@ -302,7 +312,7 @@ def main():
|
|
|
302
312
|
material_TDs = torch.tensor(material_TDs_np, dtype=torch.float32, device=device)
|
|
303
313
|
|
|
304
314
|
# Read input image
|
|
305
|
-
img =
|
|
315
|
+
img = imread(args.input_image, cv2.IMREAD_UNCHANGED)
|
|
306
316
|
computed_output_size = int(round(args.stl_output_size * 2 / args.nozzle_diameter))
|
|
307
317
|
print(f"Computed solving pixel size: {computed_output_size}")
|
|
308
318
|
alpha = None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Helper/Heightmaps/ChristofidesHeightMap.py
RENAMED
|
File without changes
|
{autoforge-1.7.0 → autoforge-1.7.1}/src/autoforge/Helper/Heightmaps/DepthEstimateHeightMap.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|