<jupyter_start><jupyter_text>**Loading the data**<jupyter_code>(X_train,y_train),(X_test,y_test)=keras.datasets.cifar10.load_data()<jupyter_output>Downloading data from https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz
170500096/170498071 [==============================] - 4s 0us/step
170508288/170498071 [==============================] - 4s 0us/step<jupyter_text>**Splitting Phase**<jupyter_code>X_train.shape

X_test.shape
y_train=y_train.reshape(-1,)
y_train[:5]
objects=["airplane","automobile","bird","cat","deer","dog","frog","horse","ship","truck"]
objects[2]
objects[0]
def data(X,y,index):
    plt.figure(figsize=(14,2))
    plt.imshow(X[index])
    plt.xlabel(objects[y[index]])
data(X_train,y_train,5)
data(X_train,y_train,88)
data(X_train,y_train,19)
data(X_train,y_train,3)
data(X_train,y_train,12)<jupyter_output><empty_output><jupyter_text>**Normalization**<jupyter_code>X_train=X_train/255
X_test=X_test/255<jupyter_output><empty_output><jupyter_text>**Model Building**<jupyter_code>model=models.Sequential([layers.Flatten(input_shape=(32,32,3)),layers.Dense(3000,activation='relu'),layers.Dense(1000,activation='relu'),layers.Dense(10,activation='softmax')])
model.compile(optimizer='SGD',loss='sparse_categorical_crossentropy',metrics=['accuracy'])
model.fit(X_train,y_train,epochs=20)
model.evaluate(X_test,y_test)
y_pred=model.predict(X_test)
y_pred_objects=[np.argmax(element) for element in y_pred]


print("Classification Report: \n",classification_report(y_test, y_pred_objects))
model1=models.Sequential([layers.Conv2D(filters=32,kernel_size=(3,3),activation='relu',input_shape=(32,32,3)),layers.MaxPooling2D((2,2)),layers.Conv2D(filters=64,kernel_size=(3,3),activation='relu'),layers.MaxPooling2D((2,2)), layers.Flatten(),layers.Dense(64,activation='relu'),layers.Dense(10,activation='softmax') ])

model1.compile(optimizer='adam',loss='sparse_categorical_crossentropy',metrics=['accuracy'])
model1.fit(X_train,y_train,epochs=25)
model1.evaluate(X_test,y_test)
y_test=y_test.reshape(-1,)
data(X_test,y_test,10)
y_pred=model1.predict(X_test)
y_pred[:5]
objects1=[np.argmax(element) for element in y_pred]
objects1[:5]
y_test[:5]
data(X_test,y_test,5)
objects[objects1[5]]
data(X_test,y_test,8)
objects[objects1[8]]
data(X_test,y_test,95)
objects[objects1[95]]<jupyter_output><empty_output><jupyter_text>**Model Saving**<jupyter_code>model.save('CIFARmodel.h5')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20346677672307056, 'fraction_numerical': 0.05530334296326868, 'mean_word_length': 15.717241379310344, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '168339', 'license': 'MIT', 'n_tokens_mistral': 1060, 'n_tokens_neox': 982, 'n_words': 67, 'path': 'CIFAR10-Object-Classification.ipynb', 'repo_name': 'Raksha-Srinivasan/CIFAR10-Image-Classificaton', 'size': '2423'}