Download pifuhd/lib/model/DepthNormalizer.py from Timilehin/2D-3D: direct link, hf CLI and curl.
- Browser
- Download file 539 Bytes
-
https://huggingface.co/spaces/Timilehin/2D-3D/resolve/main/pifuhd/lib/model/DepthNormalizer.py
- Command line
-
hf download hf://spaces/Timilehin/2D-3D/pifuhd/lib/model/DepthNormalizer.py
-
curl -L -o DepthNormalizer.py https://huggingface.co/spaces/Timilehin/2D-3D/resolve/main/pifuhd/lib/model/DepthNormalizer.py
539 Bytes
| # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. | |
| 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, xyz, calibs=None, index_feat=None): | |
| ''' | |
| normalize depth value | |
| args: | |
| xyz: [B, 3, N] depth value | |
| ''' | |
| z_feat = xyz[:,2:3,:] * (self.opt.loadSize // 2) / self.opt.z_size | |
| return z_feat |