<jupyter_start><jupyter_text>Discriminative Visualization Demo - Subject 1  Evaluate Contrastive Saliency Using White Box as Black Box System (ResNet101)  Setup Dataset<jupyter_code>ref = '../data/subject_1/ref-1.png'
probe = '../data/subject_1/probe-1.png'
gallery = '../data/subject_1/gallery-1.png'<jupyter_output><empty_output><jupyter_text>Display Reference, Probe, and Non-Mate Gallery Images<jupyter_code>from IPython.display import Image, display

display(Image(ref))
display(Image(probe))
display(Image(gallery))<jupyter_output><empty_output><jupyter_text>Run Evaluation<jupyter_code>import warnings
warnings.filterwarnings('ignore')
import numpy as np
np.random.seed(0)
import xfr.models.blackbox as bb

strise = bb.STRise(probe=probe,
                   refs=[ref],
                   gallery=[gallery],
                   black_box='resnetv6_pytorch')
strise.evaluate()<jupyter_output>1/5 Computing prior...
2/5 Generating masks...
3/5 Applying masks...
4/5 Scoring masks...
5/5 Computing saliency map...
Finished!<jupyter_text>Display Contrastive Saliency Map<jupyter_code>import PIL.Image
from xfr.show import blend_saliency_map

overlay = blend_saliency_map(strise.probe/255.0, strise.saliency_map)
PIL.Image.fromarray(np.uint8(255*overlay))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1181959564541213, 'fraction_numerical': 0.02332814930015552, 'mean_word_length': 5.128571428571429, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '202427', 'license': 'MIT', 'n_tokens_mistral': 469, 'n_tokens_neox': 438, 'n_words': 82, 'path': 'demo/blackbox_demo_subject_1.ipynb', 'repo_name': 'rwe0214/xfr', 'size': '1286'}