| | --- |
| | license: mit |
| | tags: |
| | - universal-photometric-stereo |
| | - normal-estimation |
| | --- |
| | |
| | # Model Card for LINO-UniPS |
| |
|
| | This repository contains the weights of `Light of Normals: Unified Feature Representation for Universal Photometric Stereo` |
| |
|
| | ## Usage |
| |
|
| | See the Github repository: https://github.com/houyuanchen111/LINO_UniPS regarding installation instructions. |
| | |
| | The model can then be used as follows: |
| | |
| | ```python |
| | import torch |
| | import pytorch_lightning as pl |
| | from torch.utils.data import DataLoader |
| | from PIL import Image |
| | import numpy as np |
| | import os |
| |
|
| | # load input images |
| | input_images = [ |
| | (np.array(Image.open(f"path/to/your_image_{i}.png").convert("RGB"))) |
| | for i in range(1,8) # Adjust the range based on your images |
| | ] |
| | |
| | # load mask (optional) |
| | mask = Image.open("path/to/your_mask.png") if os.path.exists("path/to/your_mask.png") else None |
| | |
| | # load data_module and model |
| | datamodule = torch.hub.load( |
| | "houyuanchen111/LINO_UniPS", |
| | "load_data", |
| | input_images, |
| | mask |
| | ) |
| | lino = torch.hub.load( |
| | "houyuanchen111/LINO_UniPS", |
| | "lino_unips", |
| | pretrained=True |
| | ) |
| | |
| | # predict |
| | test_loader = DataLoader(datamodule, batch_size=1) |
| | trainer = pl.Trainer(accelerator="auto", devices=1,precision="bf16-mixed") |
| | nml_predict = trainer.predict(model=lino, dataloaders=test_loader) |
| | ``` |