Team Ai
Modelpublic

fernandoperlar/preprocessing_image

sourceHugging Faceupdated 5y agoView on Hugging Face
0likes
Join.cpython-38.pyc16 linesDownload Raw Back to __pycache__
1U

2F�a3�@s:ddlmZddlZddlZddlmZGdd�d�Z	dS)�N)�
preprocessingc@seZdZdd�Zdd�ZdS)�JoincGs3||_dS)N)�models)�selfr�r�[c:\Users\ferna\OneDrive\Trabajo\CEIEC\MammoEchoThermo\mammo-echo-thermo\src\scripts\Join.py�__init__sz
Join.__init__cs&tjt|j�ddd�\�}��d|j�d|j���|D]}|��q8|d���	�}�fdd�|D�}t4|�D�]�\}}t�t�
|j�tj��d	�d5d}tj|dd�}|j|�|�}|j|�|j|�\}}	|j|j�|�d}6|�d
|j|j�����|jddd�}|d�|d�|d�d�|d�d�|d�|j|�|dtjdf�d�|d�d�|d�d�|d�tj�|��|d�t�|7d��|d�d�|d�|	�|djdt� |8���t� |9�t!|j�k�rdndd�|d�d�qpt�"�dS)N�T)�nrows�ncols�constrained_layoutzImage: z	, Class: rcsg|]}��|��qSr)�
add_subfigure)�.0�gs��figrr�10<listcomp>sz*Join.visualize_heatmap.<locals>.<listcomp>�float32g�?��)�axiszModel: �)r11rZOriginal�off.�Filter��zPredicted: �g�r)�color)#�plt�subplots�lenr�suptitle�image�category�remove�get_subplotspec�get_gridspec�	enumerate�cv�cvtColor�imread�
COLOR_BGR2RGB�astype�np�expand_dims�compute_heatmap�get_heatmap�model�predict�name�title�imshow�	set_titler�filter�newaxisr�array_to_img�round�argmax�int�show)rr"Z12model_rowsZ	model_row�gridspec�row�img�heatmap�jet_heatmap�superimposed_img�	predicted�axrrr�visualize_heatmap13s614$,8zJoin.visualize_heatmapN)�__name__�15__module__�__qualname__rrFrrrrrsr)16�matplotlib.pyplot�pyplotr�cv2r(�numpyr-�kerasrrrrrr�<module>s