<jupyter_start><jupyter_text>CNN with Original Data<jupyter_code>test_it.reset()
preds = model_CNN_original.predict(test_it, steps = 27)
y_predict = np.argmax(preds,axis=1)

cr_CNN_original = pd.DataFrame(classification_report(test_it.classes, y_predict, target_names=test_it.class_indices, output_dict=True)).transpose()

cr_CNN_original
y_test_array = np.array(test_it.labels)
y_pred = np.array(y_predict)
fig, ax = plt.subplots(figsize=(15, 15))
cmp = ConfusionMatrixDisplay(
    confusion_matrix(y_test_array, y_pred),
    display_labels=class_names,)

cmp.plot(ax=ax, cmap = 'Blues')
plt.title ('Confustion Matrix for CNN model with Original Data')
plt.xticks(rotation=90)
plt.show();<jupyter_output><empty_output><jupyter_text>CNN with Augmented Data<jupyter_code>test_it.reset()
preds = model_CNN_augmented.predict(test_it, steps = 27)
y_predict = np.argmax(preds,axis=1)

cr_CNN_aug = pd.DataFrame(classification_report(test_it.classes, y_predict, target_names=test_it.class_indices, output_dict=True)).transpose()

cr_CNN_aug
y_test_array = np.array(test_it.labels)
y_pred = np.array(y_predict)
fig, ax = plt.subplots(figsize=(15, 15))
cmp = ConfusionMatrixDisplay(
    confusion_matrix(y_test_array, y_pred),
    display_labels=class_names,)

cmp.plot(ax=ax, cmap = 'Blues')
plt.title ('Confustion Matrix for CNN model with Augmented Data')
plt.xticks(rotation=90)
plt.show();<jupyter_output><empty_output><jupyter_text>ResNet with Original Data<jupyter_code>test_it.reset()
preds = model_ResNet_original.predict(test_it, steps = 27)
y_predict = np.argmax(preds,axis=1)

cr_ResNet_original = pd.DataFrame(classification_report(test_it.classes, y_predict, target_names=test_it.class_indices, output_dict=True)).transpose()

cr_ResNet_original
y_test_array = np.array(test_it.labels)
y_pred = np.array(y_predict)
fig, ax = plt.subplots(figsize=(15, 15))
cmp = ConfusionMatrixDisplay(
    confusion_matrix(y_test_array, y_pred),
    display_labels=class_names,)

cmp.plot(ax=ax, cmap = 'Blues')
plt.title ('Confustion Matrix for ResNet model with Original Data')
plt.xticks(rotation=90)
plt.show();<jupyter_output><empty_output><jupyter_text>ResNet with Augmented Data<jupyter_code>test_it.reset()
preds = model_ResNet_Augmented.predict(test_it, steps = 27)
y_predict = np.argmax(preds,axis=1)

cr_ResNet_aug = pd.DataFrame(classification_report(test_it.classes, y_predict, target_names=test_it.class_indices, output_dict=True)).transpose()

cr_ResNet_aug
y_test_array = np.array(test_it.labels)
y_pred = np.array(y_predict)
fig, ax = plt.subplots(figsize=(15, 15))
cmp = ConfusionMatrixDisplay(
    confusion_matrix(y_test_array, y_pred),
    display_labels=class_names,)

cmp.plot(ax=ax, cmap = 'Blues')
plt.title ('Confustion Matrix for ResNet model with Augmented Data')
plt.xticks(rotation=90)
plt.show();<jupyter_output><empty_output><jupyter_text>Precision Comparision<jupyter_code>cr_Vgg16_aug = pd.read_csv('VGG16_Augmented_90.csv', index_col = 0)
cr_Vgg16_original =  pd.read_csv('VGG16_original_86.csv', index_col = 0)
plt.subplots(figsize=(15, 8))
plt.xticks(rotation=90)

X_axis = np.arange (len(cr_CNN_original.index))

plt.plot(X_axis - 0.25, cr_CNN_original.iloc[:,0],  label = "CNN with Original Data", color = 'mediumblue')
plt.plot(X_axis, cr_ResNet_original.iloc[:,0], label = "ResNet with Original Data", color = 'darkslategray')
plt.plot(X_axis + 0.25, cr_Vgg16_original.iloc[:,0], label = "ResNet with Original Data", color = 'steelblue')

plt.bar(X_axis - 0.25, cr_CNN_aug.iloc[:,0], 0.25, label = "CNN with Augmented Data", color = 'aqua')
plt.bar(X_axis, cr_ResNet_aug.iloc[:,0], 0.25, label = "ResNet with Augmented Data", color = 'lightseagreen')
plt.bar(X_axis + 0.25, cr_Vgg16_aug.iloc[:,0], 0.25, label = "Vgg16 with Augmented Data", color = 'skyblue')


plt.xticks(X_axis, cr_CNN_original.index)

plt.title("Precision Comparisons")

plt.legend(loc = 'lower left')
plt.show()
plt.subplots(figsize=(15, 8))
plt.xticks(rotation=90)

X_axis = np.arange (len(cr_CNN_original.index))

plt.plot(X_axis - 0.25, cr_CNN_original.iloc[:,1],  label = "CNN with Original Data", color = 'mediumblue')
plt.plot(X_axis, cr_ResNet_original.iloc[:,1], label = "ResNet with Original Data", color = 'darkslategray')
plt.plot(X_axis + 0.25, cr_Vgg16_original.iloc[:,1], label = "ResNet with Original Data", color = 'steelblue')

plt.bar(X_axis - 0.25, cr_CNN_aug.iloc[:,1], 0.25, label = "CNN with Augmented Data", color = 'aqua')
plt.bar(X_axis, cr_ResNet_aug.iloc[:,1], 0.25, label = "ResNet with Augmented Data", color = 'lightseagreen')
plt.bar(X_axis + 0.25, cr_Vgg16_aug.iloc[:,1], 0.25, label = "Vgg16 with Augmented Data", color = 'skyblue')


plt.xticks(X_axis, cr_CNN_original.index)

plt.title("Recall Comparisons")

plt.legend(loc = 'lower left')
plt.show()
plt.subplots(figsize=(15, 8))
plt.xticks(rotation=90)

X_axis = np.arange (len(cr_CNN_original.index))

plt.plot(X_axis - 0.25, cr_CNN_original.iloc[:,2],  label = "CNN with Original Data", color = 'mediumblue')
plt.plot(X_axis, cr_ResNet_original.iloc[:,2], label = "ResNet with Original Data", color = 'darkslategray')
plt.plot(X_axis + 0.25, cr_Vgg16_original.iloc[:,2], label = "ResNet with Original Data", color = 'steelblue')

plt.bar(X_axis - 0.25, cr_CNN_aug.iloc[:,2], 0.25, label = "CNN with Augmented Data", color = 'aqua')
plt.bar(X_axis, cr_ResNet_aug.iloc[:,2], 0.25, label = "ResNet with Augmented Data", color = 'lightseagreen')
plt.bar(X_axis + 0.25, cr_Vgg16_aug.iloc[:,2], 0.25, label = "Vgg16 with Augmented Data", color = 'skyblue')


plt.xticks(X_axis, cr_CNN_original.index)

plt.title("F1-Score Comparisons")

plt.legend(loc = 'lower left')
plt.show()<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup