Marigold Computer Vision¶
Marigold was proposed in Repurposing Diffusion-Based Image Generators for Monocular Depth Estimation, a CVPR 2024 Oral paper by Bingxin Ke, Anton Obukhov, Shengyu Huang, Nando Metzger, Rodrigo Caye Daudt, and Konrad Schindler. The core idea is to repurpose the generative prior of Text-to-Image Latent Diffusion Models (LDMs) for traditional computer vision tasks. This approach was explored by fine-tuning Stable Diffusion for Monocular Depth Estimation, as demonstrated in the teaser above.
Marigold was later extended in the follow-up paper, Marigold: Affordable Adaptation of Diffusion-Based Image Generators for Image Analysis, authored by Bingxin Ke, Kevin Qu, Tianfu Wang, Nando Metzger, Shengyu Huang, Bo Li, Anton Obukhov, and Konrad Schindler. This work expanded Marigold to support new modalities such as Surface Normals and Intrinsic Image Decomposition (IID), introduced a training protocol for Latent Consistency Models (LCM), and demonstrated High-Resolution (HR) processing capability.
Tip
The early Marigold models (v1-0
and earlier) were optimized for best results with at least 10 inference steps.
LCM models were later developed to enable high-quality inference in just 1 to 4 steps.
Marigold models v1-1
and later use the DDIM scheduler to achieve optimal
results in as few as 1 to 4 steps.
Available Pipelines¶
Each pipeline is tailored for a specific computer vision task, processing an input RGB image and generating a corresponding prediction. Currently, the following computer vision tasks are implemented:
Pipeline | Recommended Model Checkpoints | Spaces (Interactive Apps) | Predicted Modalities |
---|---|---|---|
MarigoldDepthPipeline | prs-eth/marigold-depth-v1-1 | Depth Estimation | Depth, Disparity |
MarigoldNormalsPipeline | prs-eth/marigold-normals-v1-1 | Surface Normals Estimation | Surface normals |
MarigoldIntrinsicsPipeline | prs-eth/marigold-iid-appearance-v1-1, prs-eth/marigold-iid-lighting-v1-1 |
Intrinsic Image Decomposition | Albedo, Materials, Lighting |
Available Checkpoints¶
All original checkpoints are available under the PRS-ETH organization on Hugging Face. They are designed for use with diffusers pipelines and the original codebase, which can also be used to train new model checkpoints. The following is a summary of the recommended checkpoints, all of which produce reliable results with 1 to 4 steps.
Checkpoint | Modality | Comment |
---|---|---|
prs-eth/marigold-depth-v1-1 | Depth | Affine-invariant depth prediction assigns each pixel a value between 0 (near plane) and 1 (far plane), with both planes determined by the model during inference. |
prs-eth/marigold-normals-v0-1 | Normals | The surface normals predictions are unit-length 3D vectors in the screen space camera, with values in the range from -1 to 1. |
prs-eth/marigold-iid-appearance-v1-1 | Intrinsics | InteriorVerse decomposition is comprised of Albedo and two BRDF material properties: Roughness and Metallicity. |
prs-eth/marigold-iid-lighting-v1-1 | Intrinsics | HyperSim decomposition of an image  \(I\)  is comprised of Albedo  \(A\), Diffuse shading  \(S\), and Non-diffuse residual  \(R\):  \(I = A*S+R\). |
Tip
Make sure to check out the Schedulers guide to learn how to explore the tradeoff between scheduler speed and quality, and see the reuse components across pipelines section to learn how to efficiently load the same components into multiple pipelines. Also, to know more about reducing the memory usage of this pipeline, refer to the ["Reduce memory usage"] section here.
Warning
Marigold pipelines were designed and tested with the scheduler embedded in the model checkpoint.
The optimal number of inference steps varies by scheduler, with no universal value that works best across all cases.
To accommodate this, the num_inference_steps
parameter in the pipeline's __call__
method defaults to None
(see the
API reference).
Unless set explicitly, it inherits the value from the default_denoising_steps
field in the checkpoint configuration
file (model_index.json
).
This ensures high-quality predictions when invoking the pipeline with only the image
argument.
See also Marigold usage examples.
Marigold Depth Prediction API¶
mindone.diffusers.MarigoldDepthPipeline
¶
Bases: DiffusionPipeline
Pipeline for monocular depth estimation using the Marigold method: https://marigoldmonodepth.github.io.
This model inherits from [DiffusionPipeline
]. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)
PARAMETER | DESCRIPTION |
---|---|
unet |
Conditional U-Net to denoise the depth latent, conditioned on image latent.
TYPE:
|
vae |
Variational Auto-Encoder (VAE) Model to encode and decode images and predictions to and from latent representations.
TYPE:
|
scheduler |
A scheduler to be used in combination with
TYPE:
|
text_encoder |
Text-encoder, for empty text embedding.
TYPE:
|
tokenizer |
CLIP tokenizer.
TYPE:
|
prediction_type |
Type of predictions made by the model.
TYPE:
|
scale_invariant |
A model property specifying whether the predicted depth maps are scale-invariant. This value must be set in
the model config. When used together with the
TYPE:
|
shift_invariant |
A model property specifying whether the predicted depth maps are shift-invariant. This value must be set in
the model config. When used together with the
TYPE:
|
default_denoising_steps |
The minimum number of denoising diffusion steps that are required to produce a prediction of reasonable
quality with the given model. This value must be set in the model config. When the pipeline is called
without explicitly setting
TYPE:
|
default_processing_resolution |
The recommended value of the
TYPE:
|
Source code in mindone/diffusers/pipelines/marigold/pipeline_marigold_depth.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 |
|
mindone.diffusers.MarigoldDepthPipeline.__call__(image, num_inference_steps=None, ensemble_size=1, processing_resolution=None, match_input_resolution=True, resample_method_input='bilinear', resample_method_output='bilinear', batch_size=1, ensembling_kwargs=None, latents=None, generator=None, output_type='np', output_uncertainty=False, output_latent=False, return_dict=False)
¶
Function invoked when calling the pipeline.
PARAMETER | DESCRIPTION |
---|---|
num_inference_steps |
Number of denoising diffusion steps during inference. The default value
TYPE:
|
ensemble_size |
Number of ensemble predictions. Higher values result in measurable improvements and visual degradation.
TYPE:
|
processing_resolution |
Effective processing resolution. When set to
TYPE:
|
match_input_resolution |
When enabled, the output prediction is resized to match the input dimensions. When disabled, the longer
side of the output will equal to
TYPE:
|
resample_method_input |
Resampling method used to resize input images to
TYPE:
|
resample_method_output |
Resampling method used to resize output predictions to match the input resolution. The accepted values
are
TYPE:
|
batch_size |
Batch size; only matters when setting
TYPE:
|
latents |
Latent noise tensors to replace the random initialization. These can be taken from the previous function call's output.
TYPE:
|
generator |
Random number generator object to ensure reproducibility.
TYPE:
|
output_type |
Preferred format of the output's
TYPE:
|
output_uncertainty |
When enabled, the output's
TYPE:
|
output_latent |
When enabled, the output's
TYPE:
|
return_dict |
Whether or not to return a [
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
[ |
Source code in mindone/diffusers/pipelines/marigold/pipeline_marigold_depth.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
|
mindone.diffusers.MarigoldDepthPipeline.ensemble_depth(depth, scale_invariant=True, shift_invariant=True, output_uncertainty=False, reduction='median', regularizer_strength=0.02, max_iter=2, tol=0.001, max_res=1024)
staticmethod
¶
Ensembles the depth maps represented by the depth
tensor with expected shape (B, 1, H, W)
, where B is the
number of ensemble members for a given prediction of size (H x W)
. Even though the function is designed for
depth maps, it can also be used with disparity maps as long as the input tensor values are non-negative. The
alignment happens when the predictions have one or more degrees of freedom, that is when they are either
affine-invariant (scale_invariant=True
and shift_invariant=True
), or just scale-invariant (only
scale_invariant=True
). For absolute predictions (scale_invariant=False
and shift_invariant=False
)
alignment is skipped and only ensembling is performed.
PARAMETER | DESCRIPTION |
---|---|
depth |
Input ensemble depth maps.
TYPE:
|
scale_invariant |
Whether to treat predictions as scale-invariant.
TYPE:
|
shift_invariant |
Whether to treat predictions as shift-invariant.
TYPE:
|
output_uncertainty |
Whether to output uncertainty map.
TYPE:
|
reduction |
Reduction method used to ensemble aligned predictions. The accepted values are:
TYPE:
|
regularizer_strength |
Strength of the regularizer that pulls the aligned predictions to the unit range from 0 to 1.
TYPE:
|
max_iter |
Maximum number of the alignment solver steps. Refer to
TYPE:
|
tol |
Alignment solver tolerance. The solver stops when the tolerance is reached.
TYPE:
|
max_res |
Resolution at which the alignment is performed;
TYPE:
|
Source code in mindone/diffusers/pipelines/marigold/pipeline_marigold_depth.py
643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 |
|
mindone.diffusers.pipelines.marigold.pipeline_marigold_depth.MarigoldDepthOutput
dataclass
¶
Bases: BaseOutput
Output class for Marigold monocular depth prediction pipeline.
PARAMETER | DESCRIPTION |
---|---|
prediction |
Predicted depth maps with values in the range [0, 1]. The shape is \(numimages imes 1 imes height imes
width\) for
TYPE:
|
uncertainty |
Uncertainty maps computed from the ensemble, with values in the range [0, 1]. The shape is \(numimages
imes 1 imes height imes width\) for
TYPE:
|
latent |
Latent features corresponding to the predictions, compatible with the
TYPE:
|
Source code in mindone/diffusers/pipelines/marigold/pipeline_marigold_depth.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
mindone.diffusers.pipelines.marigold.marigold_image_processing.MarigoldImageProcessor.visualize_depth(depth, val_min=0.0, val_max=1.0, color_map='Spectral')
staticmethod
¶
Visualizes depth maps, such as predictions of the MarigoldDepthPipeline
.
PARAMETER | DESCRIPTION |
---|---|
val_min |
Minimum value of the visualized depth range.
TYPE:
|
val_max |
Maximum value of the visualized depth range.
TYPE:
|
color_map |
Color map used to convert a single-channel depth prediction into colored representation.
TYPE:
|
Source code in mindone/diffusers/pipelines/marigold/marigold_image_processing.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
|
Marigold Normals Estimation API¶
mindone.diffusers.MarigoldNormalsPipeline
¶
Bases: DiffusionPipeline
Pipeline for monocular normals estimation using the Marigold method: https://marigoldmonodepth.github.io.
This model inherits from [DiffusionPipeline
]. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)
PARAMETER | DESCRIPTION |
---|---|
unet |
Conditional U-Net to denoise the normals latent, conditioned on image latent.
TYPE:
|
vae |
Variational Auto-Encoder (VAE) Model to encode and decode images and predictions to and from latent representations.
TYPE:
|
scheduler |
A scheduler to be used in combination with
TYPE:
|
text_encoder |
Text-encoder, for empty text embedding.
TYPE:
|
tokenizer |
CLIP tokenizer.
TYPE:
|
prediction_type |
Type of predictions made by the model.
TYPE:
|
use_full_z_range |
Whether the normals predicted by this model utilize the full range of the Z dimension, or only its positive half.
TYPE:
|
default_denoising_steps |
The minimum number of denoising diffusion steps that are required to produce a prediction of reasonable
quality with the given model. This value must be set in the model config. When the pipeline is called
without explicitly setting
TYPE:
|
default_processing_resolution |
The recommended value of the
TYPE:
|
Source code in mindone/diffusers/pipelines/marigold/pipeline_marigold_normals.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 |
|
mindone.diffusers.MarigoldNormalsPipeline.__call__(image, num_inference_steps=None, ensemble_size=1, processing_resolution=None, match_input_resolution=True, resample_method_input='bilinear', resample_method_output='bilinear', batch_size=1, ensembling_kwargs=None, latents=None, generator=None, output_type='np', output_uncertainty=False, output_latent=False, return_dict=False)
¶
Function invoked when calling the pipeline.
PARAMETER | DESCRIPTION |
---|---|
num_inference_steps |
Number of denoising diffusion steps during inference. The default value
TYPE:
|
ensemble_size |
Number of ensemble predictions. Higher values result in measurable improvements and visual degradation.
TYPE:
|
processing_resolution |
Effective processing resolution. When set to
TYPE:
|
match_input_resolution |
When enabled, the output prediction is resized to match the input dimensions. When disabled, the longer
side of the output will equal to
TYPE:
|
resample_method_input |
Resampling method used to resize input images to
TYPE:
|
resample_method_output |
Resampling method used to resize output predictions to match the input resolution. The accepted values
are
TYPE:
|
batch_size |
Batch size; only matters when setting
TYPE:
|
latents |
Latent noise tensors to replace the random initialization. These can be taken from the previous function call's output.
TYPE:
|
generator |
Random number generator object to ensure reproducibility.
TYPE:
|
output_type |
Preferred format of the output's
TYPE:
|
output_uncertainty |
When enabled, the output's
TYPE:
|
output_latent |
When enabled, the output's
TYPE:
|
return_dict |
Whether or not to return a [
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
[ |
Source code in mindone/diffusers/pipelines/marigold/pipeline_marigold_normals.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
|
mindone.diffusers.MarigoldNormalsPipeline.ensemble_normals(normals, output_uncertainty, reduction='closest')
staticmethod
¶
Ensembles the normals maps represented by the normals
tensor with expected shape (B, 3, H, W)
, where B is
the number of ensemble members for a given prediction of size (H x W)
.
PARAMETER | DESCRIPTION |
---|---|
normals |
Input ensemble normals maps.
TYPE:
|
output_uncertainty |
Whether to output uncertainty map.
TYPE:
|
reduction |
Reduction method used to ensemble aligned predictions. The accepted values are:
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Tensor
|
A tensor of aligned and ensembled normals maps with shape |
Optional[Tensor]
|
uncertainties of shape |
Source code in mindone/diffusers/pipelines/marigold/pipeline_marigold_normals.py
630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 |
|
mindone.diffusers.pipelines.marigold.pipeline_marigold_normals.MarigoldNormalsOutput
dataclass
¶
Bases: BaseOutput
Output class for Marigold monocular normals prediction pipeline.
PARAMETER | DESCRIPTION |
---|---|
prediction |
Predicted normals with values in the range [-1, 1]. The shape is \(numimages imes 3 imes height imes
width\) for
TYPE:
|
uncertainty |
Uncertainty maps computed from the ensemble, with values in the range [0, 1]. The shape is \(numimages
imes 1 imes height imes width\) for
TYPE:
|
latent |
Latent features corresponding to the predictions, compatible with the
TYPE:
|
Source code in mindone/diffusers/pipelines/marigold/pipeline_marigold_normals.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
mindone.diffusers.pipelines.marigold.marigold_image_processing.MarigoldImageProcessor.visualize_normals(normals, flip_x=False, flip_y=False, flip_z=False)
staticmethod
¶
Visualizes surface normals, such as predictions of the MarigoldNormalsPipeline
.
PARAMETER | DESCRIPTION |
---|---|
normals |
Surface normals.
TYPE:
|
flip_x |
Flips the X axis of the normals frame of reference. Default direction is right.
TYPE:
|
flip_y |
Flips the Y axis of the normals frame of reference. Default direction is top.
TYPE:
|
flip_z |
Flips the Z axis of the normals frame of reference. Default direction is facing the observer.
TYPE:
|
Source code in mindone/diffusers/pipelines/marigold/marigold_image_processing.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
|
Marigold Intrinsic Image Decomposition API¶
mindone.diffusers.MarigoldIntrinsicsPipeline
¶
Bases: DiffusionPipeline
Pipeline for Intrinsic Image Decomposition (IID) using the Marigold method: https://marigoldcomputervision.github.io.
This model inherits from [DiffusionPipeline
]. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)
PARAMETER | DESCRIPTION |
---|---|
unet |
Conditional U-Net to denoise the targets latent, conditioned on image latent.
TYPE:
|
vae |
Variational Auto-Encoder (VAE) Model to encode and decode images and predictions to and from latent representations.
TYPE:
|
scheduler |
A scheduler to be used in combination with
TYPE:
|
text_encoder |
Text-encoder, for empty text embedding.
TYPE:
|
tokenizer |
CLIP tokenizer.
TYPE:
|
prediction_type |
Type of predictions made by the model.
TYPE:
|
target_properties |
Properties of the predicted modalities, such as
TYPE:
|
default_denoising_steps |
The minimum number of denoising diffusion steps that are required to produce a prediction of reasonable
quality with the given model. This value must be set in the model config. When the pipeline is called
without explicitly setting
TYPE:
|
default_processing_resolution |
The recommended value of the
TYPE:
|
Source code in mindone/diffusers/pipelines/marigold/pipeline_marigold_intrinsics.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 |
|
mindone.diffusers.MarigoldIntrinsicsPipeline.__call__(image, num_inference_steps=None, ensemble_size=1, processing_resolution=None, match_input_resolution=True, resample_method_input='bilinear', resample_method_output='bilinear', batch_size=1, ensembling_kwargs=None, latents=None, generator=None, output_type='np', output_uncertainty=False, output_latent=False, return_dict=False)
¶
Function invoked when calling the pipeline.
PARAMETER | DESCRIPTION |
---|---|
num_inference_steps |
Number of denoising diffusion steps during inference. The default value
TYPE:
|
ensemble_size |
Number of ensemble predictions. Higher values result in measurable improvements and visual degradation.
TYPE:
|
processing_resolution |
Effective processing resolution. When set to
TYPE:
|
match_input_resolution |
When enabled, the output prediction is resized to match the input dimensions. When disabled, the longer
side of the output will equal to
TYPE:
|
resample_method_input |
Resampling method used to resize input images to
TYPE:
|
resample_method_output |
Resampling method used to resize output predictions to match the input resolution. The accepted values
are
TYPE:
|
batch_size |
Batch size; only matters when setting
TYPE:
|
latents |
Latent noise tensors to replace the random initialization. These can be taken from the previous function call's output.
TYPE:
|
generator |
Random number generator object to ensure reproducibility.
TYPE:
|
output_type |
Preferred format of the output's
TYPE:
|
output_uncertainty |
When enabled, the output's
TYPE:
|
output_latent |
When enabled, the output's
TYPE:
|
return_dict |
Whether or not to return a [
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
[ |
Source code in mindone/diffusers/pipelines/marigold/pipeline_marigold_intrinsics.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 |
|
mindone.diffusers.MarigoldIntrinsicsPipeline.ensemble_intrinsics(targets, output_uncertainty=False, reduction='median')
staticmethod
¶
Ensembles the intrinsic decomposition represented by the targets
tensor with expected shape (B, T, 3, H,
W)
, where B is the number of ensemble members for a given prediction of size (H x W)
, and T is the number of
predicted targets.
PARAMETER | DESCRIPTION |
---|---|
targets |
Input ensemble of intrinsic image decomposition maps.
TYPE:
|
output_uncertainty |
Whether to output uncertainty map.
TYPE:
|
reduction |
Reduction method used to ensemble aligned predictions. The accepted values are:
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Tensor
|
A tensor of aligned and ensembled intrinsic decomposition maps with shape |
Optional[Tensor]
|
tensor of uncertainties of shape |
Source code in mindone/diffusers/pipelines/marigold/pipeline_marigold_intrinsics.py
649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 |
|
mindone.diffusers.pipelines.marigold.pipeline_marigold_intrinsics.MarigoldIntrinsicsOutput
dataclass
¶
Bases: BaseOutput
Output class for Marigold Intrinsic Image Decomposition pipeline.
PARAMETER | DESCRIPTION |
---|---|
prediction |
Predicted image intrinsics with values in the range [0, 1]. The shape is \((numimages * numtargets) imes 3
imes height imes width\) for
TYPE:
|
uncertainty |
Uncertainty maps computed from the ensemble, with values in the range [0, 1]. The shape is \((numimages *
numtargets) imes 3 imes height imes width\) for
TYPE:
|
latent |
Latent features corresponding to the predictions, compatible with the
TYPE:
|
Source code in mindone/diffusers/pipelines/marigold/pipeline_marigold_intrinsics.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
mindone.diffusers.pipelines.marigold.marigold_image_processing.MarigoldImageProcessor.visualize_intrinsics(prediction, target_properties, color_map='binary')
staticmethod
¶
Visualizes intrinsic image decomposition, such as predictions of the MarigoldIntrinsicsPipeline
.
PARAMETER | DESCRIPTION |
---|---|
prediction |
Intrinsic image decomposition.
TYPE:
|
target_properties |
Decomposition properties. Expected entries:
TYPE:
|
color_map |
Color map used to convert a single-channel predictions into colored representations. When a dictionary is passed, each modality can be colored with its own color map.
TYPE:
|
Source code in mindone/diffusers/pipelines/marigold/marigold_image_processing.py
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 |
|