o
    oiY
                     @   s<   d dl mZ d dlmZ ddlmZ dgZG dd dZdS )    )Optional)HFONNXComunnityModelLoader   )DepthEstimationDepthAnythingONNXBuilderc                
   @   s2   e Zd Ze	d
dededee defdd	ZdS )r   depth-anything-v2-smallmodelN
model_name
model_type	cache_dirreturnc                 C   s`   | dvrt |  dt| ||d}|jddddd}| jd	d
}t|||  d| dS )a  Export a DepthAnything model to an ONNX model file.

        Args:
            model_name: The name of the model to be loaded. Valid model names include:
                - `depth-anything-v2-small`
                - `depth-anything-v2-base`
                - `depth-anything-v2-large`
            model_type:
                The type of the model to be loaded. Valid model types include:
                    - `model`
                    - `model_bnb4`
                    - `model_fp16`
                    - `model_int8`
                    - `model_q4`
                    - `model_quantized`
                    - `model_uint8`
            cache_dir:
                The directory where the model should be cached.

        Returns:
            str: The name of the output ONNX file.

        .. code-block:: python

            images = kornia.utils.sample.get_sample_images()
            model = DepthAnythingONNXBuilder.build()
            model.save(images)

        )r   zdepth-anything-v2-basezdepth-anything-v2-largez is not a valid model name.)r
   r   Tinputoutput)pixel_valuespredicted_depth)downloadio_name_mappingF)save_)pre_processorname)
ValueErrorr   
load_modelload_preprocessingto_onnxr   )r	   r
   r   loader
onnx_modelpreproc r   a/home/ubuntu/.local/lib/python3.10/site-packages/kornia/models/depth_estimation/depth_anything.pybuild   s   !zDepthAnythingONNXBuilder.build)r   r   N)__name__
__module____qualname__staticmethodstrr   r   r    r   r   r   r   r      s    N)typingr   kornia.models._hf_modelsr   baser   __all__r   r   r   r   r   <module>   s
   