Saltar al contenido principal

SD15DepthControlNetModel

GenerativeModel
DashAI.back.models.hugging_face.SD15DepthControlNetModel

Depth-conditioned ControlNet pipeline built on Stable Diffusion 1.5.

Takes an input image and a text prompt. A depth map is estimated from the image using Intel's DPT-Hybrid-MiDaS model, then fed as a spatial conditioning signal into the lllyasviel/sd-controlnet-depth ControlNet backbone together with the runwayml/stable-diffusion-v1-5 diffusion pipeline. The result is a 512 x 512 image that respects both the text description and the 3-D structure of the original scene.

References

Parameters

num_inference_steps : integer, default=20
Number of denoising steps to run. More steps refine the image but increase generation time. Typical range: 20-30 for fast results, 40-50 for higher quality.
controlnet_conditioning_scale : number, default=1.0
Weight of the ControlNet depth conditioning relative to the base diffusion pipeline (range 0.0-2.0). At 0.0 the depth map has no effect; at 1.0 the output closely follows the input structure; above 1.5 depth dominates and may produce rigid results.
guidance_scale : number, default=7.5
Classifier-Free Guidance (CFG) scale. Controls how strictly the image follows the text prompt. Values 7-9 are typical for SD 1.5.
device : string, default=CPU
Hardware device for inference. GPU is strongly recommended for diffusion models. CPU inference is possible but very slow.

Methods

generate(self, input: Tuple[ForwardRef('Image.Image'), str]) -> List[Any]

Defined on SD15DepthControlNetModel

Generate output from a generative model.

Parameters

input : Tuple[Image.Image, str]
Input image and text prompt.

Returns

List[Any]
Generated output images in a list.

component_dir(cls) -> pathlib.Path

Defined on DownloadableMixin

Return this component's own storage directory.

Returns

pathlib.Path
<COMPONENT_PATH>/<ClassName>.

delete(cls) -> None

Defined on DownloadableMixin

Remove the component's downloaded artifacts.

download(cls, report: Optional[Callable[[Optional[float], Optional[str]], NoneType]] = None) -> None

Defined on HFDownloadableMixin

Download all repos listed in hf_repos() into component_dir().

Parameters

report : ProgressReporter, optional
Callback invoked before each repo download with report(None, "Downloading <repo_id>"). None means no progress reporting.

get_metadata(cls) -> Dict[str, Any]

Defined on BaseGenerativeModel

Get metadata values for the current generative model.

Returns

Dict[str, Any]
Dictionary indicating whether the model requires a download before use and the expected download size in bytes.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

hf_repos(cls) -> List[Union[Tuple[str, str], Tuple[str, str, List[str]]]]

Defined on HFDownloadableMixin

Return the repo entries this component needs.

Returns

list of tuple
Each entry is either (repo_id, repo_type) or (repo_id, repo_type, allow_patterns).

is_downloaded(cls) -> bool

Defined on HFDownloadableMixin

Return whether all repo directories exist and are non-empty.

Returns

bool
True when every repo listed in hf_repos() has a non-empty local directory; False otherwise (including when the list is empty).

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.

Parameters

raw_data : dict
A dictionary with the data provided by the user to initialize the model.

Returns

dict
A validated dictionary with the necessary objects.

Compatible with