Libraries Used Flashcards
matplotlib.pyplot as plt
Used for creating visualizations in Python, like graphs and charts. I used it to plot training and validation accuracy and loss over the epochs. It also helped me visualize predictions and the confusion matrix. This helps to understand the model’s performance in a clear way.
numpy as np
numpy is a library for numerical calculations, particularly working with arrays. I used numpy to process input images. EX. I converted image files to numpy arrays and increased their dimensions for processing. This helps it be compatible with my ML framework, tensorflow (and regular Python lists aren’t compatible)
tensorflow as tf
TensorFlow is a machine learning framework for building and training deep learning models. It supports Keras, a Python neural network library. I used it to define and train the neural network, tf.Sequential, load the trained EfficientNetB2 model for transfer learning. Preprocessing images and manage datasets with TensorFlow utilities and evaluate the model. Also handle predictions
from tensorflow.kwras, import Sequential, layers
Provide utilities for defining neural network architectures and adding layers to the model. The Sequential API was used to define the model step by step and add lagers like Dense, Dropout, and GlobalAverafePooling2D to customize the final architecture for classification
Dense, Dropout, and GlobalAveragePooling2D
Building blocks for creating the deep learning models. These layers are important and are the main components of my model
GlobalAveragePooling2D
It reduces the spatial dimensions of the features Maps. It specifically calculates the average of the inputs height and width dimensions. 1. Takes an input with specified number of dimensions, downsample the input by merging small clusters of features into larger ones and, calculates average values of each feature map, returns the average value as output
Dense Layer
A fully connected layer with its preceding layer. So basically, the preceeding layer outputs a matrix. It changes the dimension of the vectors by using every neuron.
Dropout
Reduces overfitting by randomly dropping neurons during training. It helps prevent the network from becoming too dependent on certain nodes. It encourages the network to learn generalized features.
From tensorflow.kwras.applications.efficientnet import EfficientNetB2
EfficientNetB2 - a pretrained CNN (convolutional neural network made for performance and efficiency.
EfficientNetB2 - It’s good because I can leverage its transfer learning and use its pre-trained weights on ImageNet
from tensorflow.keras.applications.efficientnet import preprocess_input
A utility to normalize images. It is made to normalize and match the EfficientNet’s pre-trained model expectations
It ensures the images’ pixel values are scaled correctly [-1, 1] from the standard RGB format
Confusion Matrix
Matrix that visualize how well a model classifies things. It helps identify which classes are being misclassified.
Classification Report - Precision
Tells you how many of the predicted instances of positives were actually correct. High precision means the model avoids false positives
Classification Report - Recall
Measures how many of the actual positives are correctly predicted (amount). High recall indicates the model avoids false negatives
F-1 score
The mean of Precision and recall. It includes both of them in one measure
Support
Tells you how many samples from each class were evaluated