Image-to-3D
Transformers
Safetensors
depth_anything_3
feature-extraction
depth-anything-3
depth-estimation
multi-view-geometry
custom_code
Instructions to use bigshanedogg/DA3-LARGE with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bigshanedogg/DA3-LARGE with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("bigshanedogg/DA3-LARGE", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download image_processing_depth_anything_3.py from bigshanedogg/DA3-LARGE: direct link, hf CLI and curl.
- Browser
- Download file 1.99 kB
-
https://huggingface.co/bigshanedogg/DA3-LARGE/resolve/main/image_processing_depth_anything_3.py
- Command line
-
hf download hf://bigshanedogg/DA3-LARGE/image_processing_depth_anything_3.py
-
curl -L -o image_processing_depth_anything_3.py https://huggingface.co/bigshanedogg/DA3-LARGE/resolve/main/image_processing_depth_anything_3.py
1.99 kB
| """Depth Anything 3 preprocessing: the package's ``InputProcessor`` (vendored in ``da3_input_processor.py``) behind the | |
| transformers image-processor interface. Images (PIL / numpy / paths) -> ``pixel_values`` (1, N, 3, H, W), resized | |
| ("upper_bound_resize" to 504 by default, sides multiples of 14) and ImageNet-normalised; camera parameters given | |
| with the images come back resized to match (``extrinsics`` / ``intrinsics``).""" | |
| from transformers.feature_extraction_utils import BatchFeature | |
| from transformers.image_processing_utils import BaseImageProcessor | |
| from .da3_input_processor import InputProcessor | |
| class DepthAnything3ImageProcessor(BaseImageProcessor): | |
| model_input_names = ["pixel_values"] | |
| def __init__(self, process_res: int = 504, process_res_method: str = "upper_bound_resize", **kwargs): | |
| super().__init__(**kwargs) | |
| self.process_res = process_res | |
| self.process_res_method = process_res_method | |
| def preprocess(self, images, extrinsics=None, intrinsics=None, process_res=None, process_res_method=None, | |
| return_tensors=None, **kwargs) -> BatchFeature: | |
| if not isinstance(images, (list, tuple)): | |
| images = [images] | |
| tensor, extrinsics, intrinsics = InputProcessor()( | |
| list(images), | |
| extrinsics.copy() if extrinsics is not None else None, | |
| intrinsics.copy() if intrinsics is not None else None, | |
| process_res or self.process_res, | |
| process_res_method or self.process_res_method, | |
| **kwargs, | |
| ) | |
| # InputProcessor returns (N, 3, H, W); the package API adds the batch axis (_prepare_model_inputs) | |
| data = {"pixel_values": tensor[None].float()} | |
| if extrinsics is not None: | |
| data["extrinsics"] = extrinsics[None] | |
| if intrinsics is not None: | |
| data["intrinsics"] = intrinsics[None] | |
| return BatchFeature(data, tensor_type=return_tensors) | |
| __all__ = ["DepthAnything3ImageProcessor"] | |