<jupyter_start><jupyter_text>Mount to Google Drive and import required libraries<jupyter_code>from google.colab import drive
# directory for drive to serve files from
drive.mount('/content/drive')
# verify it's you<jupyter_output>Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True).<jupyter_text>Append the Google Drive repository-specific path to the system path: should be the path to the root of the repository containing this notebook<jupyter_code>import matplotlib.pyplot as plt
import tensorflow as tf
import sys
import os

# sys.path.append('/content/drive/My\ Drive/asl_alphabet_image_classification/')
# change directory to notebook source code location
%cd drive/My\ Drive/asl_alphabet_image_classification/notebooks/src
from notebook_helpers import *
sys.path.append('../src/')
from notebook_helpers import *<jupyter_output>WARNING:tensorflow:Error in loading the saved optimizer state. As a result, your model is starting with a freshly initialized optimizer.<jupyter_text>Load in validation data Path to validation data used for Keras ImageDataGenerator: check this is correct, should be fine as long as you followed repo set up instructions<jupyter_code>validation_generator = load_val_generator('../../../data/asl_alphabet_validation')<jupyter_output><empty_output><jupyter_text>Edge detection quick look this is the image shown to the classifier after all the preprocessing is done<jupyter_code>plt.imshow(array_to_img(validation_generator[0][0][0]))<jupyter_output><empty_output><jupyter_text>Load in our classifier model Path to classifier model: check this is correct, should be fine as long as you followed repo set up instructions<jupyter_code>classifier = load_saved_model('../../models/model19.keras')<jupyter_output>running
Model: "sequential_4"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
conv2d_4 (Conv2D)            (None, 200, 200, 128)     1280      
_________________________________________________________________
dropout_4 (Dropout)          (None, 200, 200, 128)     0         
_________________________________________________________________
flatten_4 (Flatten)          (None, 5120000)           0         
_________________________________________________________________
dense_3 (Dense)              (None, 29)                148480029 
=================================================================
Total params: 148,481,309
Trainable params: 148,481,309
Non-trainable params: 0
_________________________________________________________________
None<jupyter_text>Evaluate  Evaluate our model on our validation generator and print the accuracy and loss<jupyter_code>evaluation = evaluate_model_on_gen(classifier, validation_generator)<jupyter_output>Accuracy on 30 samples in given generator:  0.9333333373069763
Loss on 30 samples in given generator:  73.62400817871094<jupyter_text>Get a results table with the actual and predicted image labels<jupyter_code>results = predict_on_gen_and_report(classifier, validation_generator)
results<jupyter_output><empty_output><jupyter_text>As we can see, the model is predicting correct classes for all images except M(actual):N and R(actual):U, not perfect, however these are somewhat reasonable or at least expected letters to fail on upon visual inspection of the samples<jupyter_code>plt.imshow(array_to_img(validation_generator[0][0][12]))
plt.title('M')
plt.imshow(array_to_img(validation_generator[0][0][13]))
plt.title('N')
plt.imshow(array_to_img(validation_generator[0][0][17]))
plt.title('R')
plt.imshow(array_to_img(validation_generator[0][0][20]))
plt.title('U')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10974332111052908, 'fraction_numerical': 0.03300157150340492, 'mean_word_length': 6.358381502890174, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '287142', 'license': 'MIT', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1004, 'n_words': 303, 'path': 'notebooks/final/Final_notebook.ipynb', 'repo_name': 'sam-thurman/asl_alphabet_image_classification', 'size': '3818'}