autoforge 1.6.1__tar.gz → 1.6.2__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 (41) hide show
  1. {autoforge-1.6.1 → autoforge-1.6.2}/PKG-INFO +2 -2
  2. {autoforge-1.6.1 → autoforge-1.6.2}/pyproject.toml +1 -1
  3. {autoforge-1.6.1 → autoforge-1.6.2}/src/AutoForge.egg-info/PKG-INFO +2 -2
  4. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Loss/LossFunctions.py +24 -28
  5. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/auto_forge.py +4 -3
  6. {autoforge-1.6.1 → autoforge-1.6.2}/README.md +0 -0
  7. {autoforge-1.6.1 → autoforge-1.6.2}/setup.cfg +0 -0
  8. {autoforge-1.6.1 → autoforge-1.6.2}/src/AutoForge.egg-info/SOURCES.txt +0 -0
  9. {autoforge-1.6.1 → autoforge-1.6.2}/src/AutoForge.egg-info/dependency_links.txt +0 -0
  10. {autoforge-1.6.1 → autoforge-1.6.2}/src/AutoForge.egg-info/entry_points.txt +0 -0
  11. {autoforge-1.6.1 → autoforge-1.6.2}/src/AutoForge.egg-info/requires.txt +0 -0
  12. {autoforge-1.6.1 → autoforge-1.6.2}/src/AutoForge.egg-info/top_level.txt +0 -0
  13. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Gui/__init__.py +0 -0
  14. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Gui/browser_gui/Views/__init__.py +0 -0
  15. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Gui/browser_gui/Views/backend_database.py +0 -0
  16. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Gui/browser_gui/Views/filament_editor.py +0 -0
  17. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Gui/browser_gui/app.py +0 -0
  18. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Gui/browser_gui/main.py +0 -0
  19. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Helper/CAdamW.py +0 -0
  20. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Helper/FilamentHelper.py +0 -0
  21. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Helper/Heightmaps/ChristofidesHeightMap.py +0 -0
  22. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Helper/Heightmaps/DepthEstimateHeightMap.py +0 -0
  23. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Helper/Heightmaps/OldHeightmap.py +0 -0
  24. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Helper/Heightmaps/__init__.py +0 -0
  25. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Helper/ImageHelper.py +0 -0
  26. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Helper/OptimizerHelper.py +0 -0
  27. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Helper/OutputHelper.py +0 -0
  28. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Helper/PruningHelper.py +0 -0
  29. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Helper/__init__.py +0 -0
  30. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Helper/filamentcolors_library.py +0 -0
  31. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Init_comparer/__init__.py +0 -0
  32. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Init_comparer/auto_forge_init_check.py +0 -0
  33. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Init_comparer/plot_results.py +0 -0
  34. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Loss/PerceptionLoss.py +0 -0
  35. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Loss/__init__.py +0 -0
  36. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Misc/__init__.py +0 -0
  37. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Misc/color_fit_all.py +0 -0
  38. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Modules/Optimizer.py +0 -0
  39. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/Modules/__init__.py +0 -0
  40. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/__init__.py +0 -0
  41. {autoforge-1.6.1 → autoforge-1.6.2}/src/autoforge/__main__.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: AutoForge
3
- Version: 1.6.1
3
+ Version: 1.6.2
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "AutoForge"
7
- version="1.6.1"
7
+ version="1.6.2"
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
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: AutoForge
3
- Version: 1.6.1
3
+ Version: 1.6.2
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
@@ -50,46 +50,42 @@ def compute_loss(
50
50
  add_penalty_loss: float = 0.0,
51
51
  ) -> torch.Tensor:
52
52
  """
53
- Combined MSE + Perceptual + penalty losses.
53
+ Combined MSE + Perceptual + penalty losses with patch-based smoothness.
54
54
  """
55
- # MSE
55
+ # MSE Loss
56
56
  comp_mse = srgb_to_lab(comp)
57
- # we slightly increase saturation of our target image to make the color matching more robust
58
- # target = increase_saturation(target, 0.1)
59
57
  target_mse = srgb_to_lab(target)
60
58
  mse_loss = F.huber_loss(comp_mse, target_mse)
61
59
 
62
60
  if pixel_height_logits is not None:
61
+ # Existing neighbor-based smoothness loss:
63
62
  target_gray = target.mean(dim=2) # shape becomes [H, W]
64
-
65
- # Compute weights using the grayscale image
66
- weight_x = torch.exp(
67
- -torch.abs(target_gray[:, 1:] - target_gray[:, :-1])
68
- ) # shape [H, W-1]
69
- weight_y = torch.exp(
70
- -torch.abs(target_gray[1:, :] - target_gray[:-1, :])
71
- ) # shape [H-1, W]
72
-
63
+ weight_x = torch.exp(-torch.abs(target_gray[:, 1:] - target_gray[:, :-1]))
64
+ weight_y = torch.exp(-torch.abs(target_gray[1:, :] - target_gray[:-1, :]))
73
65
  weight_x = torch.clamp(weight_x, 0.5, 1.0)
74
66
  weight_y = torch.clamp(weight_y, 0.5, 1.0)
75
-
76
- # Compute differences in the depth map
77
- dx = torch.abs(
78
- pixel_height_logits[:, 1:] - pixel_height_logits[:, :-1]
79
- ) # shape [H, W-1]
80
- dy = torch.abs(
81
- pixel_height_logits[1:, :] - pixel_height_logits[:-1, :]
82
- ) # shape [H-1, W]
83
-
84
- # provide a target tensor (zeros) for the huber loss.
67
+ dx = torch.abs(pixel_height_logits[:, 1:] - pixel_height_logits[:, :-1])
68
+ dy = torch.abs(pixel_height_logits[1:, :] - pixel_height_logits[:-1, :])
85
69
  loss_dx = torch.mean(F.huber_loss(dx * weight_x, torch.zeros_like(dx)))
86
70
  loss_dy = torch.mean(F.huber_loss(dy * weight_y, torch.zeros_like(dy)))
87
- # loss_dx = torch.mean(F.huber_loss(dx, torch.zeros_like(dx)))
88
- # loss_dy = torch.mean(F.huber_loss(dy, torch.zeros_like(dy)))
71
+ smoothness_loss = (loss_dx + loss_dy) * (10 * add_penalty_loss)
89
72
 
90
- smoothness_loss = (loss_dx + loss_dy) * (20 * add_penalty_loss)
91
- # print(f"mse_loss: {mse_loss}, smoothness_loss: {smoothness_loss}")
92
- total_loss = mse_loss + smoothness_loss
73
+ # Additional patch-based smoothness loss (using a 3x3 Laplacian):
74
+ laplacian_kernel = (
75
+ torch.tensor(
76
+ [[0, 1, 0], [1, -4, 1], [0, 1, 0]],
77
+ dtype=pixel_height_logits.dtype,
78
+ device=pixel_height_logits.device,
79
+ )
80
+ .unsqueeze(0)
81
+ .unsqueeze(0)
82
+ )
83
+ height_map = pixel_height_logits.unsqueeze(0).unsqueeze(0)
84
+ laplacian_output = F.conv2d(height_map, laplacian_kernel, padding=1)
85
+ patch_smooth_loss = (
86
+ F.huber_loss(laplacian_output, torch.zeros_like(laplacian_output)) * 10
87
+ )
88
+ total_loss = mse_loss + smoothness_loss + add_penalty_loss * patch_smooth_loss
93
89
  else:
94
90
  total_loss = mse_loss
95
91
  return total_loss
@@ -46,7 +46,10 @@ def main():
46
46
  )
47
47
 
48
48
  parser.add_argument(
49
- "--warmup_fraction", type=float, default=1.0, help="Fraction of iterations for keeping the tau at the initial value"
49
+ "--warmup_fraction",
50
+ type=float,
51
+ default=1.0,
52
+ help="Fraction of iterations for keeping the tau at the initial value",
50
53
  )
51
54
  #
52
55
  # parser.add_argument(
@@ -98,8 +101,6 @@ def main():
98
101
  "--background_color", type=str, default="#000000", help="Background color"
99
102
  )
100
103
 
101
-
102
-
103
104
  parser.add_argument(
104
105
  "--visualize",
105
106
  action="store_true",
File without changes
File without changes