CoolFace
Apppublic

DIaac/FGSM_attack_demo

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
show_performance.cpython-310.pyc20 linesDownload Raw Back to __pycache__
1o

2�BfT�@s8ddlZddlmZddlZddlmZmZdd�Z	dS)�N�)�
fgsm_evaluate�construct_CREIcCs~t�ddd�}|dkrt�ddd�}n|dkrt�ddd�}g}g}g}g}g}|D]<}	t|d||�\}3}}t||	||�\}
}}t|4|
||||�}|�|
�|�|�|�|�|�|�|�|
|||g�q*tjdd�\}}|j||dd	�|j||d5dd�|j||d
dd�|j||dd	�|jddd�|�	d�6|��|��|�d�t
j�|�\}}|�d|�d|�d��|S)Nrg333333�?g{�G�z�?zCIFAR-10z	CIFAR-100)�7�)�figsizez$Acc$)�labelz$Conf_+$z--)r�	linestylez$Conf_-$z$CREI$z8$\epsilon$�)�fontsizez%Performance over Epsilon for model {}Tz./attachments/PoE/�/z_PoE.png)�np�arangerr�append�plt�subplots�plot�9set_xlabel�	set_title�format�legend�grid�os�path�splitext�savefig)�10model_name�11batch_size�datasetZepsilonsZ12accuraciesZcorrect_confidencesZincorrect_confidencesZcreis�metrics�epsilon�13acc_before�conf_correct_before�conf_incorrect_before�	acc_after�conf_correct_after�conf_incorrect_afterZcreiZfig1�ax1�	base_name�	extension�r*�:D:\CodeLearning\FGSM_attack_demo\utils\show_performance.py�show_performances>1415161718r,)19r�matplotlib.pyplot�pyplotr�numpyr
�show_evaluationrrr,r*r*r*r+�<module>s20