<jupyter_start><jupyter_text>Cats vrs Dogs> Im going to prepare the data to train my `Conv NNet` using the data that i've already downladed from my previous projects `cats-vrs-dogs` using `sklearn-image-classification`. There are 2 folders `cats_gray` and `dogs_gray` which contains 100 images of `100x100` grayscale images. I've already moved these files in the root directory.  Imports<jupyter_code>import os
import numpy as np
import cv2
import matplotlib.pyplot as plt
from sklearn.preprocessing import LabelEncoder
dogs_path = 'dogs_gray'
cats_path = 'cats_gray'
le = LabelEncoder()
target_names = np.array(["cat", "dog"])
target = np.array(le.fit_transform(target_names))<jupyter_output><empty_output><jupyter_text>> `0` for cat and `1` for dog<jupyter_code>data = []<jupyter_output><empty_output><jupyter_text>Cats<jupyter_code>for file in os.listdir(cats_path):
    image = np.array(cv2.imread(os.path.join(cats_path, file)))
    image = image/255
    image = image[:, :, 0] # drop the last channel
    data.append([image, np.eye(2)[0]])<jupyter_output><empty_output><jupyter_text>Dogs<jupyter_code>for file in os.listdir(dogs_path):
    image = np.array(cv2.imread(os.path.join(dogs_path, file)))
    image = image/255
    image = image[:, :, 0] # drop the last channel
    data.append([image, np.eye(2)[1]])<jupyter_output><empty_output><jupyter_text>Shuffling the data<jupyter_code>np.random.shuffle(data)<jupyter_output><empty_output><jupyter_text>Saving the data<jupyter_code>np.save('cats_v_dogs1.npy', data)
print("SAVED!!")<jupyter_output>SAVED!!<jupyter_text>Loading the Data<jupyter_code>data_ = np.load('cats_v_dogs.npy', allow_pickle=True)
len(data_)<jupyter_output><empty_output><jupyter_text>> That's all about data preparation<jupyter_code>plt.imshow(data_[0][0])
data_[0][0].shape<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13140676117775354, 'fraction_numerical': 0.017448200654307525, 'mean_word_length': 7.191964285714286, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 35, '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': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '132681', 'license': 'MIT', 'n_tokens_mistral': 716, 'n_tokens_neox': 688, 'n_words': 138, 'path': 'keras-nn/11_CNN_DogsVrs_Cats/.ipynb_checkpoints/Data Preparation-checkpoint.ipynb', 'repo_name': 'CrispenGari/tensorflow-python', 'size': '1834'}