o
    ॵi                     @   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   k/home/ubuntu/.local/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   	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   DEPTHSDEPTHS_COLORPOSES)r   r!   r   r"   r#   r$   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   modelscope.metainfor   modelscope.outputsr   modelscope.pipelines.baser   r   r   modelscope.pipelines.builderr	   modelscope.utils.constantr
   modelscope.utils.loggerr   r   register_modulevideo_depth_estimationr   r   r   r   r   <module>   s   