<jupyter_start><jupyter_text>1. Setup<jupyter_code>import sys
sys.path.append('..')
import matplotlib.pyplot as plt
from utils.dataset_utils import *
%matplotlib inline
%load_ext autoreload
%autoreload 2<jupyter_output><empty_output><jupyter_text>2. Load icoseg_subset_80<jupyter_code>train, val, test = load_icoseg_subset_80()
train_images, train_masks = train
val_images, val_masks = val
test_images, test_masks = test

print(val_images[0].dtype)
print(val_images[0].shape)
print(val_images[3].shape)
print(val_images[5].shape)<jupyter_output>uint8
(375, 500, 3)
(500, 324, 3)
(334, 500, 3)<jupyter_text>3. Initial shapes of images<jupyter_code>def collect_shapes(images):
    return [img.shape for img in images]
img_shapes = collect_shapes(train_images)\
                +\
             collect_shapes(val_images)\
                +\
             collect_shapes(test_images)\

img_h = np.array([s[0] for s in img_shapes])
img_w = np.array([s[1] for s in img_shapes])
print(f'img_h: [{img_h.min()} -> {img_h.max()}]')
print(f'img_w: [{img_w.min()} -> {img_w.max()}]')

plt.figure()
plt.subplot(1, 2, 1)
plt.title('img height')
plt.hist(img_h)
plt.xlabel('pixels')
plt.subplot(1, 2, 2)
plt.title('img width')
plt.hist(img_w)
plt.xlabel('pixels')
plt.show()<jupyter_output>img_h: [200 -> 500]
img_w: [318 -> 500]
{'fraction_non_alphanumeric': 0.15841584158415842, 'fraction_numerical': 0.04112718964204113, 'mean_word_length': 5.083333333333333, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '606272', 'license': 'MIT', 'n_tokens_mistral': 583, 'n_tokens_neox': 537, 'n_words': 98, 'path': '2018-2019/project/stats/icoseg_subset_80_stats.ipynb', 'repo_name': 'Tudor67/Neural-Networks-Assignments', 'size': '1313'}