Instructions to use zhaxie/tooth with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Trellis
How to use zhaxie/tooth with Trellis:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download third_party/utils3d/test/numpy_/transforms/linearize_depth.py from zhaxie/tooth: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/zhaxie/tooth/resolve/main/third_party/utils3d/test/numpy_/transforms/linearize_depth.py
- Command line
-
hf download hf://zhaxie/tooth/third_party/utils3d/test/numpy_/transforms/linearize_depth.py
-
curl -L -o linearize_depth.py https://huggingface.co/zhaxie/tooth/resolve/main/third_party/utils3d/test/numpy_/transforms/linearize_depth.py
1.03 kB
| import os | |
| import sys | |
| sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))) | |
| import utils3d | |
| import numpy as np | |
| import glm | |
| def run(): | |
| for i in range(100): | |
| if i == 0: | |
| spatial = [] | |
| else: | |
| dim = np.random.randint(4) | |
| spatial = [np.random.randint(1, 10) for _ in range(dim)] | |
| near = np.random.uniform(0.1, 100, spatial) | |
| far = np.random.uniform(near*2, 1000, spatial) | |
| depth = np.random.uniform(near, far, spatial) | |
| expected = depth | |
| actual = utils3d.numpy.depth_buffer_to_linear( | |
| utils3d.numpy.project_depth(depth, near, far), | |
| near, far | |
| ) | |
| assert np.allclose(expected, actual), '\n' + \ | |
| 'Input:\n' + \ | |
| f'\tdepth: {depth}\n' + \ | |
| f'\tnear: {near}\n' + \ | |
| f'\tfar: {far}\n' + \ | |
| 'Actual:\n' + \ | |
| f'{actual}\n' + \ | |
| 'Expected:\n' + \ | |
| f'{expected}' | |