File size: 7,882 Bytes
f90e4dc
c3dc02c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f90e4dc
c3dc02c
 
f90e4dc
f2bedf9
c3dc02c
7c9bcec
c3dc02c
7c9bcec
c3dc02c
7c9bcec
c3dc02c
7c9bcec
c3dc02c
 
f2bedf9
74621d6
 
 
 
c3dc02c
f2bedf9
c3dc02c
f2bedf9
 
 
d83032b
f2bedf9
07ec44b
f2bedf9
d83032b
 
 
f2bedf9
d83032b
 
 
 
 
f2bedf9
 
d83032b
67694b9
 
d83032b
f2bedf9
d83032b
 
 
f2bedf9
d83032b
 
 
 
2272399
c3dc02c
2272399
 
 
 
 
 
c3dc02c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2272399
c3dc02c
2272399
95359f7
c3dc02c
95359f7
 
 
 
 
 
 
c3dc02c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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
---
language:
  - en
tags:
  - stable-diffusion
  - stable-diffusion-diffusers
  - text-to-image
model-index:
  - name: ldm3d-sr
    results:
      - task:
          name: Latent Diffusion Model for 3D - Super-Resolution
          type: latent-diffusion-model-for-3D-SR
        dataset:
          name: LAION-400M
          type: laion/laion400m
        metrics:
          - name: LDM3D-SR-B FID
            type: LDM3D-SR-B FID
            value: 14.705
          - name: LDM3D-SR-B IS
            type: LDM3D-SR-B IS
            value: 60.371
          - name: LDM3D-SR-B PSNR
            type: LDM3D-SR-B PSNR
            value: 24.479
          - name: LDM3D-SR-B SSIM
            type: LDM3D-SR-B SSIM
            value: 0.665
          - name: LDM3D-SR-B Depth MARE
            type: LDM3D-SR-B Depth MARE
            value: 0.0537
library_name: diffusers
pipeline_tag: text-to-3d
license: creativeml-openrail-m
---

# LDM3D-SR model

The LDM3D-VR model suite was proposed in the paper [LDM3D-VR: Latent Diffusion Model for 3D](https://arxiv.org/pdf/2311.03226.pdf), authored by Gabriela Ben Melech Stan, Diana Wofk, Estelle Aflalo, Shao-Yen Tseng, Zhipeng Cai, Michael Paulitsch, and Vasudev Lal.  

LDM3D-VR was accepted to the [NeurIPS 2023 Workshop on Diffusion Models](https://neurips.cc/virtual/2023/workshop/66539).

This new checkpoint is related to the upscaler called LDM3D-SR.

## Model details
Latent diffusion models have proven to be state-of-the-art in the creation and manipulation of visual outputs. However, as far as we know, the generation of depth maps jointly with RGB is still limited. We introduce LDM3D-VR, a suite of diffusion models targeting virtual reality development that includes LDM3D-pano and LDM3D-SR. These models enable the generation of panoramic RGBD based on textual prompts and the upscaling of low-resolution inputs to high-resolution RGBD, respectively. Our models are fine-tuned from existing pretrained models on datasets containing panoramic/high-resolution RGB images, depth maps and captions. Both models are evaluated in comparison to existing related methods. 

![LDM3D-SR overview](ldm3d-sr-overview.png)
<font size="2">LDM3D-SR overview </font>


## Usage

Using the [🤗's Diffusers library](https://github.com/huggingface/diffusers) in a simple and efficient manner. 

```python
from PIL import Image
import os
import torch
from diffusers import StableDiffusionLDM3DPipeline, DiffusionPipeline

#Generate a rgb/depth output from LDM3D
pipe_ldm3d = StableDiffusionLDM3DPipeline.from_pretrained("Intel/ldm3d-4c")
pipe_ldm3d.to("cuda")

prompt =f"A picture of some lemons on a table"
output = pipe_ldm3d(prompt)
rgb_image, depth_image = output.rgb, output.depth
rgb_image[0].save(f"lemons_ldm3d_rgb.jpg")
depth_image[0].save(f"lemons_ldm3d_depth.png")


#Upscale the previous output to a resolution of (1024, 1024)
pipe_ldm3d_upscale = DiffusionPipeline.from_pretrained("Intel/ldm3d-sr", custom_pipeline="pipeline_stable_diffusion_upscale_ldm3d")

pipe_ldm3d_upscale.to("cuda")

low_res_img = Image.open(f"lemons_ldm3d_rgb.jpg").convert("RGB")
low_res_depth = Image.open(f"lemons_ldm3d_depth.png").convert("L")
outputs = pipe_ldm3d_upscale(prompt="high quality high resolution uhd 4k image", rgb=low_res_img, depth=low_res_depth, num_inference_steps=50, target_res=[1024, 1024])

upscaled_rgb, upscaled_depth =outputs.rgb[0], outputs.depth[0]
upscaled_rgb.save(f"upscaled_lemons_rgb.png")
upscaled_depth.save(f"upscaled_lemons_depth.png")
```

This is the result:

Output of ldm3d-4c          |  Upscaled output
:-------------------------:|:-------------------------:
![ldm3d_rgb_results](lemons_ldm3d_rgb.jpg)  |  ![ldm3d_sr_rgb_results](upscaled_lemons_rgb.png)
![ldm3d_depth_results](lemons_ldm3d_depth.png)  |  ![ldm3d_sr_depth_results](upscaled_lemons_depth.png)

## Training data

The LDM3D model was finetuned on a dataset constructed from a subset of the LAION-400M dataset, a large-scale image-caption dataset that contains over 400 million image-caption pairs. In the finetuning process of the LDM3D-SR, the training data consists of additional high-resolution (HR) and low-resolution (LR) sets with 261,045 samples each. For HR samples, a subset of LAION Aesthetics 6+ with tuples (captions, 512x512-sized images, and depth maps from DPT-BEiT-L-512) is used. LR images are generated using a lightweight BSR-image-degradation method, introduced in applied to the HR image. 

### Finetuning

The fine-tuning process comprises two stages. In the first stage, we train an autoencoder to generate a lower-dimensional, perceptually equivalent data representation. Subsequently, we fine-tune the diffusion model using the frozen autoencoder.

LDM3D-SR utilizes the autoencoder previously developed for [LDM3D-4c](https://huggingface.co/Intel/ldm3d-4c) to now encode low-resolution (LR) images into a 64x64x4 dimensional latent space. The diffusion model used here is an adapted version of the U-Net, now modified to have an 8-channel input. This change enables conditioning on LR latent via concatenation to the high-resolution (HR) latent during training, and to noise during inference. Text conditioning is also facilitated using cross attention with a CLIP text encoder. 

## Evaluation results

The table below shows the quantitative results of upscaling from 128 x 128 to 512 x 512, evaluated on 2,243 samples from ImageNet-Val. We explore three methods for generating LR depth maps: performing depth estimation on the LR depth maps (LDM3D-SR-D), utilizing the original HR depth map for LR conditioning (LDM3D-SR-O), and applying bicubic degradation to the depth map (LDM3D-SR-B).

|Method             |FID ↓ |IS ↑       |PSNR ↑     |SSIM ↑    |Depth MARE ↓ |
|-------------------|------|-----------|-----------|----------|-------------|
|Regression, bicubic|24.686|60.135±4.16|26.424±3.98|0.716±0.13|0.0153±0.0189|
|SDx4[29]           |15.865|61.103±3.48|24.528±3.63|0.631±0.15|N/A          |
|LDMx4[30]          |15.245|60.060±3.88|25.511±3.94|0.686±0.16|N/A          |
|SD-superres[2]     |15.254|59.789±3.53|23.878±3.28|0.642±0.15|N/A          |
|LDM3D-SR-D         |15.522|59.736±3.37|24.113±3.54|0.659±0.16|0.0753±0.0734|
|LDM3D-SR-O         |14.793|60.260±3.53|24.498±3.59|0.665±0.16|0.0530±0.0496|
|LDM3D-SR-B         |14.705|60.371±3.56|24.479±3.58|0.665±0.48|0.0537±0.0506|

The results shown above can be referenced in Table 3 of the [LDM3D-VR paper](https://arxiv.org/pdf/2311.03226.pdf).

## Ethical Considerations and Limitations

For image generation, the [Stable Diffusion](https://huggingface.co/CompVis/stable-diffusion-v1-4#limitations) limitations and biases apply. For depth map generation, a first limitiation is that we are using DPT-large to produce the ground truth, hence, other limitations and biases from [DPT](https://huggingface.co/Intel/dpt-large) are applicable.

## Caveats and Recommendations

Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.

Here are a couple of useful links to learn more about Intel's AI software:
* [Intel Extension for PyTorch](https://github.com/intel/intel-extension-for-pytorch)
* [Intel Neural Compressor](https://github.com/intel/neural-compressor)

## Disclaimer

The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please consult an attorney before using this model for commercial purposes.

### BibTeX entry and citation info
```bibtex
@misc{stan2023ldm3dvr,
      title={LDM3D-VR: Latent Diffusion Model for 3D VR}, 
      author={Gabriela Ben Melech Stan and Diana Wofk and Estelle Aflalo and Shao-Yen Tseng and Zhipeng Cai and Michael Paulitsch and Vasudev Lal},
      year={2023},
      eprint={2311.03226},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
```