Spaces:
Build error
Build error
File size: 1,482 Bytes
159500c |
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 |
"""
TransNormal: Surface Normal Estimation for Transparent Objects
This package provides a diffusion-based pipeline for estimating surface normals
from RGB images, with particular effectiveness on transparent objects.
Example usage:
from transnormal import TransNormalPipeline, create_dino_encoder
import torch
# Create DINO encoder
dino_encoder = create_dino_encoder(
model_name="dinov3_vith16plus",
weights_path="path/to/dinov3_weights",
projector_path="path/to/projector.pt",
device="cuda",
)
# Load pipeline
pipe = TransNormalPipeline.from_pretrained(
"path/to/transnormal_model",
dino_encoder=dino_encoder,
torch_dtype=torch.float16,
)
pipe = pipe.to("cuda")
# Run inference
normal_map = pipe("path/to/image.jpg", output_type="np")
"""
__version__ = "1.0.0"
__author__ = "TransNormal Team"
from .pipeline import TransNormalPipeline
from .dino_encoder import DINOv3Encoder, create_dino_encoder
from .utils import (
resize_max_res,
resize_back,
get_tv_resample_method,
get_pil_resample_method,
normal_to_rgb,
save_normal_map,
load_image,
concatenate_images,
)
__all__ = [
"TransNormalPipeline",
"DINOv3Encoder",
"create_dino_encoder",
"resize_max_res",
"resize_back",
"get_tv_resample_method",
"get_pil_resample_method",
"normal_to_rgb",
"save_normal_map",
"load_image",
"concatenate_images",
]
|