<jupyter_start><jupyter_text>Visualization with Small sample dataset as demo  1. Unzip sample dataset<jupyter_code>%cd data
!bash download_for_Demo.sh
!unzip HRSID_sample.zip
%cd ..<jupyter_output>/home/kang/SAR_OD/anonymous-hub/SAROD<jupyter_text>2. test & save images with sample dataset<jupyter_code>!python visual.py --device 0\
--rl_weight SAROD_RL\
--h_detector_weight yolov5_480.pt\
--l_detector_weight yolov5_96.pt\
--test_path data/test/images
import os
import random
import matplotlib.pyplot as plt
import cv2
from PIL import Image

img_list = os.listdir('image/visualization')
img_list.sort()
rand_sample = random.sample(range(len(img_list)//8), 1)

sample_list = []
for i in range(8):
    sample_list.append(img_list[rand_sample[0]*8+i])
sample_list.sort()


fig = plt.figure()
fig, ax_lst = plt.subplots(4, 2, figsize=(20,20))
for i in range(4):
    for j in range(2):
        ax_lst[i][j].set_xticks([])
        ax_lst[i][j].set_yticks([])

img1 = Image.open(os.path.join('image/visualization', sample_list[0]))
img2 = Image.open(os.path.join('image/visualization', sample_list[1]))
img3 = Image.open(os.path.join('image/visualization', sample_list[2]))
img4 = Image.open(os.path.join('image/visualization', sample_list[3]))
img5 = Image.open(os.path.join('image/visualization', sample_list[4]))
img6 = Image.open(os.path.join('image/visualization', sample_list[5]))
img7 = Image.open(os.path.join('image/visualization', sample_list[6]))
img8 = Image.open(os.path.join('image/visualization', sample_list[7]))
    
ax_lst[0][0].set_title('patch1_ground truth')
ax_lst[0][0].imshow(img1)
ax_lst[0][1].set_title('patch1_predict')
ax_lst[0][1].imshow(img2)
ax_lst[1][0].set_title('patch2_ground truth')
ax_lst[1][0].imshow(img3)
ax_lst[1][1].set_title('patch2_predict')
ax_lst[1][1].imshow(img4)
ax_lst[2][0].set_title('patch3_ground truth')
ax_lst[2][0].imshow(img5)
ax_lst[2][1].set_title('patch3_predict')
ax_lst[2][1].imshow(img6)
ax_lst[3][0].set_title('patch4_ground truth')
ax_lst[3][0].imshow(img7)
ax_lst[3][1].set_title('patch4_predict')
ax_lst[3][1].imshow(img8)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1765536723163842, 'fraction_numerical': 0.04143126177024482, 'mean_word_length': 6.9588014981273405, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '379455', 'license': 'MIT', 'n_tokens_mistral': 886, 'n_tokens_neox': 866, 'n_words': 124, 'path': 'demo_visualization.ipynb', 'repo_name': 'JunHyungKang/SAROD_ICIP', 'size': '2124'}