<jupyter_start><jupyter_text>Hindi/Devanagari MNIST<jupyter_code>DATA_FOLDER = "./data"

TRAIN_FOLDER_NAME = "Train"
TEST_FOLDER_NAME = "Test"

DEVANAGARI_DATA_FOLDER = os.path.join(os.path.join(DATA_FOLDER, "DevanagariHandwrittenCharacterDataset"))
print(DEVANAGARI_DATA_FOLDER)

# Data parameters
IMG_HEIGHT = 32
IMG_WIDTH = 32

labels_to_keep = [
    "digit_0", "digit_1", "digit_2", "digit_3", "digit_4", "digit_5", "digit_6", "digit_7", "digit_8", "digit_9"
]
num_classes = len(labels_to_keep)
class_names_to_labels = dict([(cls_name, lbl) for cls_name, lbl in zip(labels_to_keep, list(range(len(labels_to_keep))))])
# print(class_names_to_labels)
labels_to_class_names = dict([(v, k) for k, v in class_names_to_labels.items()])
train_folders = glob.glob(os.path.join(DEVANAGARI_DATA_FOLDER, TRAIN_FOLDER_NAME, "*"))

images = []

for folder in train_folders:
    files = glob.glob(os.path.join(folder, "*"))
    set_of_files = random.sample(files, 20)
    # print(set_of_files)
    for f in set_of_files:
        im = Image.open(f)
        images.append(im)

random.shuffle(images)

columns = len(images) // 5
rows = len(images) // columns

fig = plt.figure(figsize=(100, 20))
for i, im in enumerate(images):
    fig.add_subplot(rows, columns, i+1)
    plt.imshow(im, cmap='gray', vmin=0, vmax=255)
    plt.axis("off")

plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1478770131771596, 'fraction_numerical': 0.019765739385065886, 'mean_word_length': 5.635922330097087, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '554182', 'license': 'MIT', 'n_tokens_mistral': 589, 'n_tokens_neox': 563, 'n_words': 93, 'path': 'dataset-visualizations.ipynb', 'repo_name': 'shenoy-anurag/machine-learning', 'size': '1366'}