mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
processors multiple fixes
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
- `sdnq` warn instead of error for triton
|
- `sdnq` warn instead of error for triton
|
||||||
- `insightface` missing dependencies
|
- `insightface` missing dependencies
|
||||||
- `pulid` import paths
|
- `pulid` import paths
|
||||||
|
- `processors` init code and multiple fixes
|
||||||
|
|
||||||
## Update for 2026-06-16
|
## Update for 2026-06-16
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class AnylineDetector:
|
|||||||
def from_pretrained(cls, pretrained_model_or_path="TheMistoAI/MistoLine", cache_dir=None, local_files_only=False):
|
def from_pretrained(cls, pretrained_model_or_path="TheMistoAI/MistoLine", cache_dir=None, local_files_only=False):
|
||||||
from installer import install
|
from installer import install
|
||||||
install('controlnet-aux', quiet=True)
|
install('controlnet-aux', quiet=True)
|
||||||
from controlnet_aux import AnylineDetector as _AnylineDetector
|
from controlnet_aux.anyline import AnylineDetector as _AnylineDetector
|
||||||
model = _AnylineDetector.from_pretrained(pretrained_model_or_path, filename="MTEED.pth", subfolder="Anyline", cache_dir=cache_dir)
|
model = _AnylineDetector.from_pretrained(pretrained_model_or_path, filename="MTEED.pth", subfolder="Anyline", cache_dir=cache_dir)
|
||||||
return cls(model)
|
return cls(model)
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
from ..util import util
|
|
||||||
# import torch
|
|
||||||
from .. import models
|
|
||||||
# import pix2pix.data
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from modules.control.proc.leres.pix2pix.util import util
|
||||||
|
from modules.control.proc.leres.pix2pix import models
|
||||||
|
|
||||||
class BaseOptions():
|
class BaseOptions():
|
||||||
"""This class defines options used during both training and test time.
|
"""This class defines options used during both training and test time.
|
||||||
|
|||||||
@@ -64,9 +64,13 @@ class LotusDetector:
|
|||||||
# Concatenate along channel dim: [rgb_latents, noise_latents]
|
# Concatenate along channel dim: [rgb_latents, noise_latents]
|
||||||
latent_input = torch.cat([rgb_latents, noise_latents], dim=1)
|
latent_input = torch.cat([rgb_latents, noise_latents], dim=1)
|
||||||
# UNet forward pass with task embedding as class_labels
|
# UNet forward pass with task embedding as class_labels
|
||||||
|
latent_input = latent_input.to(self.unet.dtype)
|
||||||
|
prompt_embeds = prompt_embeds.to(self.unet.dtype)
|
||||||
|
task_emb = task_emb.to(self.unet.dtype)
|
||||||
prediction = self.unet(latent_input, timestep, encoder_hidden_states=prompt_embeds, class_labels=task_emb).sample
|
prediction = self.unet(latent_input, timestep, encoder_hidden_states=prompt_embeds, class_labels=task_emb).sample
|
||||||
# Decode prediction
|
# Decode prediction
|
||||||
prediction = prediction / self.vae.config.scaling_factor
|
prediction = prediction / self.vae.config.scaling_factor
|
||||||
|
prediction = prediction.to(self.vae.dtype)
|
||||||
decoded = self.vae.decode(prediction).sample
|
decoded = self.vae.decode(prediction).sample
|
||||||
if opts.control_move_processor:
|
if opts.control_move_processor:
|
||||||
self._to("cpu")
|
self._to("cpu")
|
||||||
|
|||||||
@@ -9,12 +9,10 @@ checked_ok = False
|
|||||||
|
|
||||||
def check_dependencies():
|
def check_dependencies():
|
||||||
global checked_ok # pylint: disable=global-statement
|
global checked_ok # pylint: disable=global-statement
|
||||||
from installer import installed, install
|
from installer import install
|
||||||
from modules.logger import log
|
from modules.logger import log
|
||||||
packages = [('mediapipe', 'mediapipe')]
|
install('mediapipe')
|
||||||
for pkg in packages:
|
# install('protobuf==4.25.6', 'protobuf', no_deps=True, reinstall=True, force=True)
|
||||||
if not installed(pkg[1], quiet=True):
|
|
||||||
install(pkg[0], pkg[1], ignore=False)
|
|
||||||
try:
|
try:
|
||||||
import mediapipe as mp # pylint: disable=unused-import
|
import mediapipe as mp # pylint: disable=unused-import
|
||||||
checked_ok = True
|
checked_ok = True
|
||||||
|
|||||||
@@ -2,14 +2,13 @@
|
|||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import os
|
import os
|
||||||
import torch
|
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from torchvision.transforms import Compose
|
from torchvision.transforms import Compose
|
||||||
|
|
||||||
from .midas.dpt_depth import DPTDepthModel
|
from modules.control.proc.midas.midas.dpt_depth import DPTDepthModel
|
||||||
from .midas.midas_net import MidasNet
|
from modules.control.proc.midas.midas.midas_net import MidasNet
|
||||||
from .midas.midas_net_custom import MidasNet_small
|
from modules.control.proc.midas.midas.midas_net_custom import MidasNet_small
|
||||||
from .midas.transforms import Resize, NormalizeImage, PrepareForNet
|
from modules.control.proc.midas.midas.transforms import Resize, NormalizeImage, PrepareForNet
|
||||||
from modules.control.util import annotator_ckpts_path
|
from modules.control.util import annotator_ckpts_path
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import numpy as np
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
|
||||||
|
class NormalBaeDetector:
|
||||||
|
def __init__(self, model):
|
||||||
|
self.model = model
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_pretrained(cls, pretrained_model_or_path="fal/teed", cache_dir=None, local_files_only=False): # pylint: disable=unused-argument
|
||||||
|
from installer import install
|
||||||
|
install('controlnet-aux', quiet=True)
|
||||||
|
from controlnet_aux.normalbae import NormalBaeDetector as _NormalBaeDetector
|
||||||
|
model = _NormalBaeDetector.from_pretrained(pretrained_model_or_path, filename="5_model.pth")
|
||||||
|
return cls(model)
|
||||||
|
|
||||||
|
def __call__(self, image, output_type="pil", **kwargs):
|
||||||
|
if isinstance(image, np.ndarray):
|
||||||
|
image = Image.fromarray(image)
|
||||||
|
result = self.model(image, output_type=output_type)
|
||||||
|
return result
|
||||||
@@ -4,14 +4,13 @@
|
|||||||
# This source code is licensed under the license found in the
|
# This source code is licensed under the license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
|
from typing import Tuple
|
||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from torch.nn import functional as F
|
from torch.nn import functional as F
|
||||||
|
|
||||||
from typing import Tuple
|
from modules.control.proc.segment_anything.modeling import Sam
|
||||||
|
from modules.control.proc.segment_anything.utils.amg import calculate_stability_score
|
||||||
from ..modeling import Sam
|
|
||||||
from .amg import calculate_stability_score
|
|
||||||
|
|
||||||
|
|
||||||
class SamOnnxModel(nn.Module):
|
class SamOnnxModel(nn.Module):
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ dependencies = ["torch"]
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from .midas.dpt_depth import DPTDepthModel
|
from modules.control.proc.zoe.zoedepth.models.base_models.midas_repo.midas.dpt_depth import DPTDepthModel
|
||||||
from .midas.midas_net import MidasNet
|
from modules.control.proc.zoe.zoedepth.models.base_models.midas_repo.midas.midas_net import MidasNet
|
||||||
from .midas.midas_net_custom import MidasNet_small
|
from modules.control.proc.zoe.zoedepth.models.base_models.midas_repo.midas.midas_net_custom import MidasNet_small
|
||||||
|
|
||||||
def DPT_BEiT_L_512(pretrained=True, **kwargs):
|
def DPT_BEiT_L_512(pretrained=True, **kwargs):
|
||||||
""" # This docstring shows up in hub.help()
|
""" # This docstring shows up in hub.help()
|
||||||
|
|||||||
-1
@@ -1,7 +1,6 @@
|
|||||||
import timm
|
import timm
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from .utils import activations, forward_default, get_activation
|
from .utils import activations, forward_default, get_activation
|
||||||
from ..external.next_vit.classification.nextvit import *
|
|
||||||
|
|
||||||
|
|
||||||
def forward_next_vit(pretrained, x):
|
def forward_next_vit(pretrained, x):
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ import itertools
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from ..depth_model import DepthModel
|
from modules.control.proc.zoe.zoedepth.models.depth_model import DepthModel
|
||||||
from ...base_models.midas import MidasCore
|
from modules.control.proc.zoe.zoedepth.models.base_models.midas import MidasCore
|
||||||
from ...layers.attractor import AttractorLayer, AttractorLayerUnnormed
|
from modules.control.proc.zoe.zoedepth.models.layers.attractor import AttractorLayer, AttractorLayerUnnormed
|
||||||
from ...layers.dist_layers import ConditionalLogBinomial
|
from modules.control.proc.zoe.zoedepth.models.layers.dist_layers import ConditionalLogBinomial
|
||||||
from ...layers.localbins_layers import Projector, SeedBinRegressor, SeedBinRegressorUnnormed
|
from modules.control.proc.zoe.zoedepth.models.layers.localbins_layers import Projector, SeedBinRegressor, SeedBinRegressorUnnormed
|
||||||
from ...model_io import load_state_from_resource
|
from modules.control.proc.zoe.zoedepth.models.model_io import load_state_from_resource
|
||||||
|
|
||||||
|
|
||||||
class ZoeDepth(DepthModel):
|
class ZoeDepth(DepthModel):
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ import itertools
|
|||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
|
|
||||||
from ..depth_model import DepthModel
|
from modules.control.proc.zoe.zoedepth.models.depth_model import DepthModel
|
||||||
from ...base_models.midas import MidasCore
|
from modules.control.proc.zoe.zoedepth.models.base_models.midas import MidasCore
|
||||||
from ...layers.attractor import AttractorLayer, AttractorLayerUnnormed
|
from modules.control.proc.zoe.zoedepth.models.layers.attractor import AttractorLayer, AttractorLayerUnnormed
|
||||||
from ...layers.dist_layers import ConditionalLogBinomial
|
from modules.control.proc.zoe.zoedepth.models.layers.dist_layers import ConditionalLogBinomial
|
||||||
from ...layers.localbins_layers import Projector, SeedBinRegressor, SeedBinRegressorUnnormed
|
from modules.control.proc.zoe.zoedepth.models.layers.localbins_layers import Projector, SeedBinRegressor, SeedBinRegressorUnnormed
|
||||||
from ...layers.patch_transformer import PatchTransformerEncoder
|
from modules.control.proc.zoe.zoedepth.models.layers.patch_transformer import PatchTransformerEncoder
|
||||||
from ...model_io import load_state_from_resource
|
from modules.control.proc.zoe.zoedepth.models.model_io import load_state_from_resource
|
||||||
|
|
||||||
class ZoeDepthNK(DepthModel):
|
class ZoeDepthNK(DepthModel):
|
||||||
def __init__(self, core, bin_conf, bin_centers_type="softplus", bin_embedding_dim=128,
|
def __init__(self, core, bin_conf, bin_centers_type="softplus", bin_embedding_dim=128,
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ processors = [
|
|||||||
# pose
|
# pose
|
||||||
'OpenPose',
|
'OpenPose',
|
||||||
'DWPose',
|
'DWPose',
|
||||||
'MediaPipe Face',
|
|
||||||
'DWPose (ONNX)',
|
|
||||||
'RTMW',
|
'RTMW',
|
||||||
'RTMO',
|
'RTMO',
|
||||||
'ViTPose',
|
'ViTPose',
|
||||||
@@ -31,8 +29,7 @@ processors = [
|
|||||||
'HED',
|
'HED',
|
||||||
'PidiNet',
|
'PidiNet',
|
||||||
'MLSD',
|
'MLSD',
|
||||||
'TEED',
|
'Anyline (Legacy)',
|
||||||
'Anyline',
|
|
||||||
# depth
|
# depth
|
||||||
'Midas Depth Hybrid',
|
'Midas Depth Hybrid',
|
||||||
'Leres Depth',
|
'Leres Depth',
|
||||||
@@ -47,16 +44,20 @@ processors = [
|
|||||||
'Marigold Depth LCM',
|
'Marigold Depth LCM',
|
||||||
'Lotus Depth',
|
'Lotus Depth',
|
||||||
# normal
|
# normal
|
||||||
'Normal Bae',
|
'Normal Bae (Legacy)',
|
||||||
'DSINE',
|
'DSINE',
|
||||||
'StableNormal',
|
'StableNormal',
|
||||||
'Marigold Normals',
|
'Marigold Normals',
|
||||||
# segmentation
|
# segmentation
|
||||||
'SegmentAnything',
|
'SegmentAnything 1.0',
|
||||||
'SAM 2.1',
|
'SegmentAnything 2.1',
|
||||||
'OneFormer',
|
'OneFormer',
|
||||||
# other
|
# other
|
||||||
'Shuffle',
|
'Shuffle',
|
||||||
|
# legacy
|
||||||
|
'MediaPipe Face (Legacy)',
|
||||||
|
'DWPose (Legacy)',
|
||||||
|
'TEED (Legacy)',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ config = {
|
|||||||
'None': {},
|
'None': {},
|
||||||
# pose models
|
# pose models
|
||||||
'OpenPose': {'class': None, 'group': 'Pose', 'checkpoint': True, 'params': {'include_body': True, 'include_hand': False, 'include_face': False}},
|
'OpenPose': {'class': None, 'group': 'Pose', 'checkpoint': True, 'params': {'include_body': True, 'include_hand': False, 'include_face': False}},
|
||||||
'MediaPipe Face': {'class': None, 'group': 'Pose', 'checkpoint': False, 'params': {'max_faces': 1, 'min_confidence': 0.5}},
|
|
||||||
'DWPose (ONNX)': {'class': None, 'group': 'Pose', 'checkpoint': False, 'params': {'min_confidence': 0.3}},
|
|
||||||
'RTMW': {'class': None, 'group': 'Pose', 'checkpoint': False, 'params': {'min_confidence': 0.3, 'draw_body_pose': True, 'draw_hand_pose': True, 'draw_face_pose': True}},
|
'RTMW': {'class': None, 'group': 'Pose', 'checkpoint': False, 'params': {'min_confidence': 0.3, 'draw_body_pose': True, 'draw_hand_pose': True, 'draw_face_pose': True}},
|
||||||
'RTMO': {'class': None, 'group': 'Pose', 'checkpoint': False, 'params': {'min_confidence': 0.3}},
|
'RTMO': {'class': None, 'group': 'Pose', 'checkpoint': False, 'params': {'min_confidence': 0.3}},
|
||||||
'ViTPose': {'class': None, 'group': 'Pose', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'usyd-community/vitpose-plus-base'}, 'params': {'min_confidence': 0.3}},
|
'ViTPose': {'class': None, 'group': 'Pose', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'usyd-community/vitpose-plus-base'}, 'params': {'min_confidence': 0.3}},
|
||||||
@@ -29,8 +27,6 @@ config = {
|
|||||||
'HED': {'class': None, 'group': 'Edge', 'checkpoint': True, 'params': {'scribble': False, 'safe': False}},
|
'HED': {'class': None, 'group': 'Edge', 'checkpoint': True, 'params': {'scribble': False, 'safe': False}},
|
||||||
'PidiNet': {'class': None, 'group': 'Edge', 'checkpoint': True, 'params': {'scribble': False, 'safe': False, 'apply_filter': False}},
|
'PidiNet': {'class': None, 'group': 'Edge', 'checkpoint': True, 'params': {'scribble': False, 'safe': False, 'apply_filter': False}},
|
||||||
'MLSD': {'class': None, 'group': 'Edge', 'checkpoint': True, 'params': {'thr_v': 0.1, 'thr_d': 0.1}},
|
'MLSD': {'class': None, 'group': 'Edge', 'checkpoint': True, 'params': {'thr_v': 0.1, 'thr_d': 0.1}},
|
||||||
'TEED': {'class': None, 'group': 'Edge', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'fal/teed'}, 'params': {}},
|
|
||||||
'Anyline': {'class': None, 'group': 'Edge', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'TheMistoAI/MistoLine'}, 'params': {}},
|
|
||||||
# depth models
|
# depth models
|
||||||
'Midas Depth Hybrid': {'class': None, 'group': 'Depth', 'checkpoint': True, 'params': {'bg_th': 0.1, 'depth_and_normal': False}},
|
'Midas Depth Hybrid': {'class': None, 'group': 'Depth', 'checkpoint': True, 'params': {'bg_th': 0.1, 'depth_and_normal': False}},
|
||||||
'Leres Depth': {'class': None, 'group': 'Depth', 'checkpoint': True, 'params': {'boost': False, 'thr_a': 0, 'thr_b': 0}},
|
'Leres Depth': {'class': None, 'group': 'Depth', 'checkpoint': True, 'params': {'boost': False, 'thr_a': 0, 'thr_b': 0}},
|
||||||
@@ -45,16 +41,21 @@ config = {
|
|||||||
'Marigold Depth LCM': {'class': None, 'group': 'Depth', 'checkpoint': True, 'params': {'denoising_steps': 1, 'ensemble_size': 1, 'processing_res': 768, 'match_input_res': True, 'color_map': 'None'}, 'load_config': {'pretrained_model_or_path': 'prs-eth/marigold-depth-lcm-v1-0'}},
|
'Marigold Depth LCM': {'class': None, 'group': 'Depth', 'checkpoint': True, 'params': {'denoising_steps': 1, 'ensemble_size': 1, 'processing_res': 768, 'match_input_res': True, 'color_map': 'None'}, 'load_config': {'pretrained_model_or_path': 'prs-eth/marigold-depth-lcm-v1-0'}},
|
||||||
'Lotus Depth': {'class': None, 'group': 'Depth', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'jingheya/lotus-depth-g-v2-1-disparity'}, 'params': {'color_map': 'inferno'}},
|
'Lotus Depth': {'class': None, 'group': 'Depth', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'jingheya/lotus-depth-g-v2-1-disparity'}, 'params': {'color_map': 'inferno'}},
|
||||||
# normal models
|
# normal models
|
||||||
'Normal Bae': {'class': None, 'group': 'Normal', 'checkpoint': True, 'params': {}},
|
|
||||||
'DSINE': {'class': None, 'group': 'Normal', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'hugoycj/DSINE-hub'}, 'params': {}},
|
'DSINE': {'class': None, 'group': 'Normal', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'hugoycj/DSINE-hub'}, 'params': {}},
|
||||||
'StableNormal': {'class': None, 'group': 'Normal', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'Stable-X/StableNormal'}, 'params': {}},
|
'StableNormal': {'class': None, 'group': 'Normal', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'Stable-X/StableNormal'}, 'params': {}},
|
||||||
'Marigold Normals': {'class': None, 'group': 'Normal', 'checkpoint': True, 'params': {'denoising_steps': 4, 'ensemble_size': 4, 'processing_res': 768, 'match_input_res': True}, 'load_config': {'pretrained_model_or_path': 'prs-eth/marigold-normals-v1-1'}},
|
'Marigold Normals': {'class': None, 'group': 'Normal', 'checkpoint': True, 'params': {'denoising_steps': 4, 'ensemble_size': 4, 'processing_res': 768, 'match_input_res': True}, 'load_config': {'pretrained_model_or_path': 'prs-eth/marigold-normals-v1-1'}},
|
||||||
# segmentation models
|
# segmentation models
|
||||||
'SegmentAnything': {'class': None, 'group': 'Segmentation', 'checkpoint': True, 'model': 'Base', 'params': {}},
|
'SegmentAnything 1.0': {'class': None, 'group': 'Segmentation', 'checkpoint': True, 'model': 'Base', 'params': {}},
|
||||||
'SAM 2.1': {'class': None, 'group': 'Segmentation', 'checkpoint': True, 'model': 'Large', 'load_config': {'pretrained_model_or_path': 'facebook/sam2.1-hiera-large'}, 'params': {}},
|
'SegmentAnything 2.1': {'class': None, 'group': 'Segmentation', 'checkpoint': True, 'model': 'Large', 'load_config': {'pretrained_model_or_path': 'facebook/sam2.1-hiera-large'}, 'params': {}},
|
||||||
'OneFormer': {'class': None, 'group': 'Segmentation', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'shi-labs/oneformer_ade20k_swin_large'}, 'params': {}},
|
'OneFormer': {'class': None, 'group': 'Segmentation', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'shi-labs/oneformer_ade20k_swin_large'}, 'params': {}},
|
||||||
# other models
|
# other models
|
||||||
'Shuffle': {'class': None, 'group': 'Other', 'checkpoint': False, 'params': {}},
|
'Shuffle': {'class': None, 'group': 'Other', 'checkpoint': False, 'params': {}},
|
||||||
|
# legacy models
|
||||||
|
'MediaPipe Face (Legacy)': {'class': None, 'group': 'Pose', 'checkpoint': False, 'params': {'max_faces': 1, 'min_confidence': 0.5}},
|
||||||
|
'DWPose (Legacy)': {'class': None, 'group': 'Pose', 'checkpoint': False, 'params': {'min_confidence': 0.3}},
|
||||||
|
'TEED (Legacy)': {'class': None, 'group': 'Edge', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'fal/teed'}, 'params': {}},
|
||||||
|
'Anyline (Legacy)': {'class': None, 'group': 'Edge', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'TheMistoAI/MistoLine'}, 'params': {}},
|
||||||
|
'Normal Bae (Legacy)': {'class': None, 'group': 'Normal', 'checkpoint': True, 'params': {}},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -81,6 +82,7 @@ def delay_load_config():
|
|||||||
from modules.control.proc.depth_pro import DepthProDetector
|
from modules.control.proc.depth_pro import DepthProDetector
|
||||||
from modules.control.proc.depth_anything_v2 import DepthAnythingV2Detector
|
from modules.control.proc.depth_anything_v2 import DepthAnythingV2Detector
|
||||||
from modules.control.proc.teed import TEEDDetector
|
from modules.control.proc.teed import TEEDDetector
|
||||||
|
from modules.control.proc.normalbae import NormalBaeDetector
|
||||||
from modules.control.proc.anyline import AnylineDetector
|
from modules.control.proc.anyline import AnylineDetector
|
||||||
from modules.control.proc.rtmlib_pose import RtmlibPoseDetector
|
from modules.control.proc.rtmlib_pose import RtmlibPoseDetector
|
||||||
from modules.control.proc.vitpose import ViTPoseDetector
|
from modules.control.proc.vitpose import ViTPoseDetector
|
||||||
@@ -95,8 +97,8 @@ def delay_load_config():
|
|||||||
'None': {},
|
'None': {},
|
||||||
# pose models
|
# pose models
|
||||||
'OpenPose': {'class': OpenposeDetector, 'group': 'Pose', 'checkpoint': True, 'params': {'include_body': True, 'include_hand': False, 'include_face': False}},
|
'OpenPose': {'class': OpenposeDetector, 'group': 'Pose', 'checkpoint': True, 'params': {'include_body': True, 'include_hand': False, 'include_face': False}},
|
||||||
'MediaPipe Face': {'class': MediapipeFaceDetector, 'group': 'Pose', 'checkpoint': False, 'params': {'max_faces': 1, 'min_confidence': 0.5}},
|
'MediaPipe Face (Legacy)': {'class': MediapipeFaceDetector, 'group': 'Pose', 'checkpoint': False, 'params': {'max_faces': 1, 'min_confidence': 0.5}},
|
||||||
'DWPose (ONNX)': {'class': RtmlibPoseDetector, 'group': 'Pose', 'checkpoint': False, 'params': {'min_confidence': 0.3}},
|
'DWPose (Legacy)': {'class': RtmlibPoseDetector, 'group': 'Pose', 'checkpoint': False, 'params': {'min_confidence': 0.3}},
|
||||||
'RTMW': {'class': RtmlibPoseDetector, 'group': 'Pose', 'checkpoint': False, 'params': {'min_confidence': 0.3, 'draw_body_pose': True, 'draw_hand_pose': True, 'draw_face_pose': True}},
|
'RTMW': {'class': RtmlibPoseDetector, 'group': 'Pose', 'checkpoint': False, 'params': {'min_confidence': 0.3, 'draw_body_pose': True, 'draw_hand_pose': True, 'draw_face_pose': True}},
|
||||||
'RTMO': {'class': RtmlibPoseDetector, 'group': 'Pose', 'checkpoint': False, 'params': {'min_confidence': 0.3}},
|
'RTMO': {'class': RtmlibPoseDetector, 'group': 'Pose', 'checkpoint': False, 'params': {'min_confidence': 0.3}},
|
||||||
'ViTPose': {'class': ViTPoseDetector, 'group': 'Pose', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'usyd-community/vitpose-plus-base'}, 'params': {'min_confidence': 0.3}},
|
'ViTPose': {'class': ViTPoseDetector, 'group': 'Pose', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'usyd-community/vitpose-plus-base'}, 'params': {'min_confidence': 0.3}},
|
||||||
@@ -108,8 +110,8 @@ def delay_load_config():
|
|||||||
'HED': {'class': HEDdetector, 'group': 'Edge', 'checkpoint': True, 'params': {'scribble': False, 'safe': False}},
|
'HED': {'class': HEDdetector, 'group': 'Edge', 'checkpoint': True, 'params': {'scribble': False, 'safe': False}},
|
||||||
'PidiNet': {'class': PidiNetDetector, 'group': 'Edge', 'checkpoint': True, 'params': {'scribble': False, 'safe': False, 'apply_filter': False}},
|
'PidiNet': {'class': PidiNetDetector, 'group': 'Edge', 'checkpoint': True, 'params': {'scribble': False, 'safe': False, 'apply_filter': False}},
|
||||||
'MLSD': {'class': MLSDdetector, 'group': 'Edge', 'checkpoint': True, 'params': {'thr_v': 0.1, 'thr_d': 0.1}},
|
'MLSD': {'class': MLSDdetector, 'group': 'Edge', 'checkpoint': True, 'params': {'thr_v': 0.1, 'thr_d': 0.1}},
|
||||||
'TEED': {'class': TEEDDetector, 'group': 'Edge', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'fal/teed'}, 'params': {}},
|
'TEED (Legacy)': {'class': TEEDDetector, 'group': 'Edge', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'fal/teed'}, 'params': {}},
|
||||||
'Anyline': {'class': AnylineDetector, 'group': 'Edge', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'TheMistoAI/MistoLine'}, 'params': {}},
|
'Anyline (Legacy)': {'class': AnylineDetector, 'group': 'Edge', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'TheMistoAI/MistoLine'}, 'params': {}},
|
||||||
# depth models
|
# depth models
|
||||||
'Midas Depth Hybrid': {'class': MidasDetector, 'group': 'Depth', 'checkpoint': True, 'params': {'bg_th': 0.1, 'depth_and_normal': False}},
|
'Midas Depth Hybrid': {'class': MidasDetector, 'group': 'Depth', 'checkpoint': True, 'params': {'bg_th': 0.1, 'depth_and_normal': False}},
|
||||||
'Leres Depth': {'class': LeresDetector, 'group': 'Depth', 'checkpoint': True, 'params': {'boost': False, 'thr_a': 0, 'thr_b': 0}},
|
'Leres Depth': {'class': LeresDetector, 'group': 'Depth', 'checkpoint': True, 'params': {'boost': False, 'thr_a': 0, 'thr_b': 0}},
|
||||||
@@ -124,13 +126,13 @@ def delay_load_config():
|
|||||||
'Marigold Depth LCM': {'class': MarigoldDetector, 'group': 'Depth', 'checkpoint': True, 'params': {'denoising_steps': 1, 'ensemble_size': 1, 'processing_res': 768, 'match_input_res': True, 'color_map': 'None'}, 'load_config': {'pretrained_model_or_path': 'prs-eth/marigold-depth-lcm-v1-0'}},
|
'Marigold Depth LCM': {'class': MarigoldDetector, 'group': 'Depth', 'checkpoint': True, 'params': {'denoising_steps': 1, 'ensemble_size': 1, 'processing_res': 768, 'match_input_res': True, 'color_map': 'None'}, 'load_config': {'pretrained_model_or_path': 'prs-eth/marigold-depth-lcm-v1-0'}},
|
||||||
'Lotus Depth': {'class': LotusDetector, 'group': 'Depth', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'jingheya/lotus-depth-g-v2-1-disparity'}, 'params': {'color_map': 'inferno'}},
|
'Lotus Depth': {'class': LotusDetector, 'group': 'Depth', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'jingheya/lotus-depth-g-v2-1-disparity'}, 'params': {'color_map': 'inferno'}},
|
||||||
# normal models
|
# normal models
|
||||||
'Normal Bae': {'class': None, 'group': 'Normal', 'checkpoint': True, 'params': {}},
|
'Normal Bae (Legacy)': {'class': NormalBaeDetector, 'group': 'Normal', 'checkpoint': True, 'params': {}},
|
||||||
'DSINE': {'class': DSINEDetector, 'group': 'Normal', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'hugoycj/DSINE-hub'}, 'params': {}},
|
'DSINE': {'class': DSINEDetector, 'group': 'Normal', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'hugoycj/DSINE-hub'}, 'params': {}},
|
||||||
'StableNormal': {'class': StableNormalDetector, 'group': 'Normal', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'Stable-X/StableNormal'}, 'params': {}},
|
'StableNormal': {'class': StableNormalDetector, 'group': 'Normal', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'Stable-X/StableNormal'}, 'params': {}},
|
||||||
'Marigold Normals': {'class': MarigoldNormalsDetector, 'group': 'Normal', 'checkpoint': True, 'params': {'denoising_steps': 4, 'ensemble_size': 4, 'processing_res': 768, 'match_input_res': True}, 'load_config': {'pretrained_model_or_path': 'prs-eth/marigold-normals-v1-1'}},
|
'Marigold Normals': {'class': MarigoldNormalsDetector, 'group': 'Normal', 'checkpoint': True, 'params': {'denoising_steps': 4, 'ensemble_size': 4, 'processing_res': 768, 'match_input_res': True}, 'load_config': {'pretrained_model_or_path': 'prs-eth/marigold-normals-v1-1'}},
|
||||||
# segmentation models
|
# segmentation models
|
||||||
'SegmentAnything': {'class': SamDetector, 'group': 'Segmentation', 'checkpoint': True, 'model': 'Base', 'params': {}},
|
'SegmentAnything 1.0': {'class': SamDetector, 'group': 'Segmentation', 'checkpoint': True, 'model': 'Base', 'params': {}},
|
||||||
'SAM 2.1': {'class': Sam2Detector, 'group': 'Segmentation', 'checkpoint': True, 'model': 'Large', 'load_config': {'pretrained_model_or_path': 'facebook/sam2.1-hiera-large'}, 'params': {}},
|
'SegmentAnything 2.1': {'class': Sam2Detector, 'group': 'Segmentation', 'checkpoint': True, 'model': 'Large', 'load_config': {'pretrained_model_or_path': 'facebook/sam2.1-hiera-large'}, 'params': {}},
|
||||||
'OneFormer': {'class': OneFormerDetector, 'group': 'Segmentation', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'shi-labs/oneformer_ade20k_swin_large'}, 'params': {}},
|
'OneFormer': {'class': OneFormerDetector, 'group': 'Segmentation', 'checkpoint': True, 'load_config': {'pretrained_model_or_path': 'shi-labs/oneformer_ade20k_swin_large'}, 'params': {}},
|
||||||
# other models
|
# other models
|
||||||
'Shuffle': {'class': ContentShuffleDetector, 'group': 'Other', 'checkpoint': False, 'params': {}},
|
'Shuffle': {'class': ContentShuffleDetector, 'group': 'Other', 'checkpoint': False, 'params': {}},
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class FluxToolsScript(scripts_manager.Script):
|
|||||||
shared.opts.data["sd_model_checkpoint"] = "black-forest-labs/FLUX.1-Canny-dev"
|
shared.opts.data["sd_model_checkpoint"] = "black-forest-labs/FLUX.1-Canny-dev"
|
||||||
sd_models.reload_model_weights(op='model', revision="refs/pr/1")
|
sd_models.reload_model_weights(op='model', revision="refs/pr/1")
|
||||||
if processor_canny is None:
|
if processor_canny is None:
|
||||||
from controlnet_aux import CannyDetector
|
from modules.control.proc.canny import CannyDetector
|
||||||
processor_canny = CannyDetector()
|
processor_canny = CannyDetector()
|
||||||
if process:
|
if process:
|
||||||
control_image = processor_canny(image, low_threshold=50, high_threshold=200, detect_resolution=1024, image_resolution=1024)
|
control_image = processor_canny(image, low_threshold=50, high_threshold=200, detect_resolution=1024, image_resolution=1024)
|
||||||
|
|||||||
Reference in New Issue
Block a user