o
    ;ήc                     @   sp   d dl mZ d dlZd dlmZ d dlmZ d dlm	Z	 ddl
mZ g dZg dZg d	ZG d
d deZdS )    )ListN)Image)log_softmax   )BaseSession)r   r   r      r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   c                   @   s"   e Zd Zdedee fddZdS )ClothSessionimgreturnc           	   	   C   s  | j d | |ddd}|}t|d d}tj|ddd}t|d}t|d}tj|	ddd	}|
|jtj}g }| }|t |d
d}|| | }|t |d
d}|| | }|t |d
d}|| |S )N)      ?r   r   )   r   r   r   T)axiskeepdimsuint8L)modeRGB)inner_sessionrun	normalizer   npargmaxsqueezer   	fromarrayastyperesizesizeLANCZOScopy
putpalettepallete1convertappendpallete2pallete3)	selfr	   ort_outspredmaskmasksmask1mask2mask3 r-   :/tmp/pip-target-vg8gfxp4/lib/python/rembg/session_cloth.pypredict9   s0   





zClothSession.predictN)__name__
__module____qualname__PILImager   r/   r-   r-   r-   r.   r   8   s    r   )typingr   numpyr   PILr   	PIL.Imager3   scipy.specialr   session_baser   r    r#   r$   r   r-   r-   r-   r.   <module>   s    