o
    *jw                     @   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	 d dl
mZ d dlmZ d dlmZ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Pipeline)	PIPELINES)	LoadImage)	ModelFile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 )ImageBodyReshapingPipelinemodelc                    s$   t  jdd|i| td dS )z
        use `model` to create a image body reshaping pipeline for prediction
        Args:
            model: model id on modelscope hub.
        r   zbody reshaping model init doneN )super__init__loggerinfo)selfr   kwargs	__class__r   v/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/modelscope/pipelines/cv/image_body_reshaping_pipeline.pyr      s   z#ImageBodyReshapingPipeline.__init__inputreturnc                 C   s   t |}d|i}|S )Nimg)r	   Zconvert_to_ndarray)r   r   r   resultr   r   r   
preprocess   s   
z%ImageBodyReshapingPipeline.preprocessc                 C   s   | j |d }d|i}|S )Nr   outputs)r   Z	inference)r   r   outputr   r   r   r   forward!   s   z"ImageBodyReshapingPipeline.forwardinputsc                 C   s   |d }t j|iS )Nr   )r   Z
OUTPUT_IMG)r   r"   Z
output_imgr   r   r   postprocess&   s   
z&ImageBodyReshapingPipeline.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   Zmodelscope.pipelines.builderr   Zmodelscope.preprocessorsr	   Zmodelscope.utils.constantr
   r   Zmodelscope.utils.loggerr   r   Zregister_moduleZimage_body_reshapingr   r   r   r   r   <module>   s   