Spaces:
Build error
Build error
Download PIFu/lib/model/DepthNormalizer.py from VISION23/Image-and-3D-Model-Creator: direct link, hf CLI and curl.
- Browser
- Download file 497 Bytes
-
https://huggingface.co/spaces/VISION23/Image-and-3D-Model-Creator/resolve/main/PIFu/lib/model/DepthNormalizer.py
- Command line
-
hf download hf://spaces/VISION23/Image-and-3D-Model-Creator/PIFu/lib/model/DepthNormalizer.py
-
curl -L -o DepthNormalizer.py https://huggingface.co/spaces/VISION23/Image-and-3D-Model-Creator/resolve/main/PIFu/lib/model/DepthNormalizer.py
497 Bytes
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| class DepthNormalizer(nn.Module): | |
| def __init__(self, opt): | |
| super(DepthNormalizer, self).__init__() | |
| self.opt = opt | |
| def forward(self, z, calibs=None, index_feat=None): | |
| ''' | |
| Normalize z_feature | |
| :param z_feat: [B, 1, N] depth value for z in the image coordinate system | |
| :return: | |
| ''' | |
| z_feat = z * (self.opt.loadSize // 2) / self.opt.z_size | |
| return z_feat | |