update readme
Browse files
README.md
CHANGED
|
@@ -9,31 +9,37 @@ Note the input image is suppose to be **white background**.
|
|
| 9 |
import torch
|
| 10 |
import numpy as np
|
| 11 |
from PIL import Image
|
| 12 |
-
from
|
| 13 |
|
| 14 |
|
| 15 |
pipe = StableDiffusionImage2MVCustomPipeline.from_pretrained(
|
| 16 |
-
"
|
|
|
|
| 17 |
torch_dtype=torch.float16,
|
| 18 |
-
trust_remote_code=True
|
|
|
|
| 19 |
).to("cuda")
|
| 20 |
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
image = Image.open('image.png').convert("RGB")
|
| 23 |
|
|
|
|
| 24 |
forward_args = dict(
|
| 25 |
width=256,
|
| 26 |
height=256,
|
| 27 |
-
width_cond=256,
|
| 28 |
-
height_cond=256,
|
| 29 |
num_images_per_prompt=4,
|
| 30 |
-
num_inference_steps=50,
|
|
|
|
|
|
|
|
|
|
| 31 |
guidance_scale=1.5,
|
| 32 |
)
|
| 33 |
|
| 34 |
out = pipe(image, **forward_args).images
|
| 35 |
rgb_np = np.hstack([np.array(img) for img in out])
|
| 36 |
-
Image.fromarray(rgb_np).save(f"
|
|
|
|
| 37 |
```
|
| 38 |
|
| 39 |
## Image-to-Normal
|
|
|
|
| 9 |
import torch
|
| 10 |
import numpy as np
|
| 11 |
from PIL import Image
|
| 12 |
+
from pipeline import StableDiffusionImage2MVCustomPipeline
|
| 13 |
|
| 14 |
|
| 15 |
pipe = StableDiffusionImage2MVCustomPipeline.from_pretrained(
|
| 16 |
+
".",
|
| 17 |
+
# "Luffuly/unique3d-mv-variation-diffuser",
|
| 18 |
torch_dtype=torch.float16,
|
| 19 |
+
trust_remote_code=True,
|
| 20 |
+
class_labels=torch.tensor(range(4)),
|
| 21 |
).to("cuda")
|
| 22 |
|
| 23 |
+
seed = -1
|
| 24 |
+
generator = torch.Generator(device='cuda').manual_seed(-1)
|
| 25 |
|
|
|
|
| 26 |
|
| 27 |
+
image = Image.open('/media/mbzuai/Tingting/unique3d-diffuser/hao.png').convert("RGB")
|
| 28 |
forward_args = dict(
|
| 29 |
width=256,
|
| 30 |
height=256,
|
|
|
|
|
|
|
| 31 |
num_images_per_prompt=4,
|
| 32 |
+
num_inference_steps=50,
|
| 33 |
+
width_cond=256,
|
| 34 |
+
height_cond=256,
|
| 35 |
+
generator=generator,
|
| 36 |
guidance_scale=1.5,
|
| 37 |
)
|
| 38 |
|
| 39 |
out = pipe(image, **forward_args).images
|
| 40 |
rgb_np = np.hstack([np.array(img) for img in out])
|
| 41 |
+
Image.fromarray(rgb_np).save(f"test.png")
|
| 42 |
+
|
| 43 |
```
|
| 44 |
|
| 45 |
## Image-to-Normal
|