File size: 1,159 Bytes
364a4b6
 
5c8adfd
 
364a4b6
5c8adfd
364a4b6
5c8adfd
364a4b6
5c8adfd
364a4b6
5c8adfd
364a4b6
5c8adfd
364a4b6
5c8adfd
 
 
364a4b6
5c8adfd
 
364a4b6
5c8adfd
535c9db
364a4b6
6f85465
 
 
 
 
5c8adfd
 
364a4b6
5c8adfd
 
 
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
---
library_name: diffusers
pipeline_tag: image-to-image
license: apache-2.0
---
# Model Card for StableNormal

This repository contains the weights of StableNormal: Reducing Diffusion Variance for Stable and Sharp Normal

## Usage

See the Github repository: https://github.com/Stable-X/StableNormal regarding installation instructions.

The model can then be used as follows:

```python
import torch
from PIL import Image

# Load an image
input_image = Image.open("path/to/your/image.jpg")

# Create predictor instance
predictor = torch.hub.load("hugoycj/StableNormal", "StableNormal_turbo", trust_repo=True, yoso_version='yoso-normal-v1-5')

# Generate normal map using alpha channel for masking
normal_map = predictor(rgba_image, data_type="object")  # Will mask out background, if alpha channel is avalible, else use birefnet
normal_map = predictor(rgba_image, data_type="outdoor")  # Will use Mask2Former to mask out sky and plants
normal_map = predictor(rgba_image, data_type="indoor") # Will not mask out

# Apply the model to the image
normal_image = predictor(input_image)

# Save or display the result
normal_image.save("output/normal_map.png")
```