Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pipeline_tag: image-to-image
|
| 4 |
+
library_name: diffusers
|
| 5 |
+
---
|
| 6 |
+
# Model Card for NiRNE
|
| 7 |
+
|
| 8 |
+
This repository contains the weights of NiRNE, the image-to-normal estimator of Hi3DGen
|
| 9 |
+
|
| 10 |
+
## Usage
|
| 11 |
+
|
| 12 |
+
See the Github repository: https://github.com/lzt02/NiRNE regarding installation instructions.
|
| 13 |
+
|
| 14 |
+
The model can then be used as follows:
|
| 15 |
+
|
| 16 |
+
```python
|
| 17 |
+
import torch
|
| 18 |
+
from PIL import Image
|
| 19 |
+
# Load an image
|
| 20 |
+
input_image = Image.open("path/to/your/image.jpg")
|
| 21 |
+
# Create predictor instance
|
| 22 |
+
predictor = torch.hub.load("lzt02/NiRNE", "NiRNE", trust_repo=True)
|
| 23 |
+
# Generate normal map using alpha channel for masking
|
| 24 |
+
normal_map = predictor(rgba_image, data_type="object") # Will mask out background, if alpha channel is avalible, else use birefnet
|
| 25 |
+
# Apply the model to the image
|
| 26 |
+
normal_image = predictor(input_image)
|
| 27 |
+
# Save or display the result
|
| 28 |
+
normal_image.save("output/normal_map.png")
|
| 29 |
+
```
|