o
    *j                     @   s   d dl mZmZ d dlmZ d dlmZ d dlmZm	Z	m
Z
 d dlmZ d dlmZ d dlmZ e ZejejejdG d	d
 d
e
ZdS )    )AnyDict)	Pipelines)
OutputKeys)InputModelPipeline)	PIPELINES)Tasks)
get_logger)module_namec                       s   e Zd Zdef fddZdedeeef fddZdeeef deeef fdd	Z	d
eeef deeef fddZ
  ZS )VideoDepthEstimationPipelinemodelc                    s$   t  jdd|i| td dS )z
        use `model` to create a video depth estimation pipeline for prediction
        Args:
            model: model id on modelscope hub.
        r   z%depth estimation model, pipeline initN )super__init__loggerinfo)selfr   kwargs	__class__r   x/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/modelscope/pipelines/cv/video_depth_estimation_pipeline.pyr      s   z%VideoDepthEstimationPipeline.__init__inputreturnc                 C   s   |}d|i}|S )N
video_pathr   )r   r   r   datar   r   r   
preprocess   s   z'VideoDepthEstimationPipeline.preprocessc                 C   s   | j |}|S )N)r   Z	inference)r   r   resultsr   r   r   forward"   s   z$VideoDepthEstimationPipeline.forwardinputsc                 C   s>   | j |}|d }|d }|d }tj|tj|tj|i}|S )Ndepthsdepths_colorposes)r   postprocessr   ZDEPTHSZDEPTHS_COLORZPOSES)r   r    r   r!   r"   r#   Zoutputsr   r   r   r$   &   s   z(VideoDepthEstimationPipeline.postprocess)__name__
__module____qualname__strr   r   r   r   r   r   r$   __classcell__r   r   r   r   r      s
    
"*r   N)typingr   r   Zmodelscope.metainfor   Zmodelscope.outputsr   Zmodelscope.pipelines.baser   r   r   Zmodelscope.pipelines.builderr	   Zmodelscope.utils.constantr
   Zmodelscope.utils.loggerr   r   Zregister_moduleZvideo_depth_estimationr   r   r   r   r   <module>   s   