mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
@@ -39,6 +39,7 @@ TBD
|
||||
- ui: fix collapsible panels
|
||||
- process: improve send-to functionality
|
||||
- control: safe load non-sparse controlnet
|
||||
- control: fix marigold preprocessor with bfloat16
|
||||
- auth: fix password being shown in clear text during login
|
||||
|
||||
## Update for 2025-11-06
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import torch
|
||||
from PIL import Image
|
||||
from modules.control.util import HWC3, resize_image
|
||||
from modules import devices
|
||||
@@ -28,7 +29,7 @@ class MarigoldDetector:
|
||||
color_map: str = "Spectral",
|
||||
output_type=None,
|
||||
):
|
||||
self.model.to(device=devices.device, dtype=devices.dtype)
|
||||
self.model.to(device=devices.device, dtype=torch.float16)
|
||||
res = self.model(
|
||||
input_image,
|
||||
denoising_steps=denoising_steps,
|
||||
|
||||
@@ -228,7 +228,7 @@ class MarigoldPipeline(DiffusionPipeline):
|
||||
depth_pred = (depth_pred - min_d) / (max_d - min_d)
|
||||
|
||||
# Convert to numpy
|
||||
depth_pred = depth_pred.cpu().numpy().astype(np.float32)
|
||||
depth_pred = depth_pred.to(torch.float32).cpu().numpy()
|
||||
|
||||
# Resize back to original resolution
|
||||
if match_input_res:
|
||||
|
||||
@@ -64,8 +64,9 @@ def ensemble_depths(
|
||||
input_images = downscaler(torch.from_numpy(input_images)).numpy()
|
||||
|
||||
# init guess
|
||||
_min = np.min(input_images.reshape((n_img, -1)).cpu().numpy(), axis=1)
|
||||
_max = np.max(input_images.reshape((n_img, -1)).cpu().numpy(), axis=1)
|
||||
np_img = input_images.reshape((n_img, -1)).to(torch.float32).cpu().numpy()
|
||||
_min = np.min(np_img, axis=1)
|
||||
_max = np.max(np_img, axis=1)
|
||||
s_init = 1.0 / (_max - _min).reshape((-1, 1, 1))
|
||||
t_init = (-1 * s_init.flatten() * _min.flatten()).reshape((-1, 1, 1))
|
||||
x = np.concatenate([s_init, t_init]).reshape(-1).astype(np_dtype)
|
||||
@@ -95,7 +96,7 @@ def ensemble_depths(
|
||||
far_err = torch.sqrt((1 - torch.max(pred)) ** 2)
|
||||
|
||||
err = sqrt_dist + (near_err + far_err) * regularizer_strength
|
||||
err = err.detach().cpu().numpy().astype(np_dtype)
|
||||
err = err.to(torch.float32).detach().cpu().numpy().astype(np_dtype)
|
||||
return err
|
||||
|
||||
res = minimize(
|
||||
|
||||
Reference in New Issue
Block a user