0% found this document useful (0 votes)
18 views9 pages

Training ResNet50 on Custom Dataset

The document discusses using various Python libraries like Augmentor and split-folders to perform data augmentation and splitting on image datasets. It then loads a ResNet50 model from Keras and attempts to train it on the augmented datasets but encounters errors regarding missing TensorFlow modules.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views9 pages

Training ResNet50 on Custom Dataset

The document discusses using various Python libraries like Augmentor and split-folders to perform data augmentation and splitting on image datasets. It then loads a ResNet50 model from Keras and attempts to train it on the augmented datasets but encounters errors regarding missing TensorFlow modules.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

3/10/24, 6:07 PM ResNet50-Copy2

In [1]: !pip install Augmentor #### installing Augmentor library for augmentation of dataset #

Defaulting to user installation because normal site-packages is not writeable


Requirement already satisfied: Augmentor in c:\users\nat\appdata\roaming\python\pytho
n311\site-packages (0.2.12)
Requirement already satisfied: Pillow>=5.2.0 in c:\programdata\anaconda3\envs\project
\lib\site-packages (from Augmentor) (10.1.0)
Requirement already satisfied: tqdm>=4.9.0 in c:\programdata\anaconda3\envs\project\l
ib\site-packages (from Augmentor) (4.66.1)
Requirement already satisfied: numpy>=1.11.0 in c:\programdata\anaconda3\envs\project
\lib\site-packages (from Augmentor) (1.25.2)
Requirement already satisfied: colorama in c:\programdata\anaconda3\envs\project\lib
\site-packages (from tqdm>=4.9.0->Augmentor) (0.4.6)

In [1]: import Augmentor #### importing library ####


p = [Link](r"C:\Users\NAT\Desktop\COMMISSION 2.0\RESNET50_FOR AUG\Mites")
p.flip_top_bottom(probability=0.4)
p.rotate_random_90(probability=1.0)
[Link](probability=0.9, max_shear_left=20, max_shear_right=20)
[Link](probability=0.3, magnitude=1)
p.skew_corner(probability=0.01, magnitude=1)
p.skew_left_right(probability=0.02, magnitude=1)
p.skew_tilt(probability=0.03, magnitude=1)
p.skew_top_bottom(probability=0.04, magnitude=1)
#p.random_brightness(probability=0.4, min_factor=0, max_factor=0.65)
[Link](700) #### number of output images after augmentation of Mites ####

Initialised with 49 image(s) found.


Output directory set to C:\Users\NAT\Desktop\COMMISSION 2.0\RESNET50_FOR AUG\Mites\ou
tput.
Processing <[Link] image mode=RGB size=853x640 at 0x1C70004CC50>: 11%|█
| 77/700 [00:23<03:09, 3.29 Samples/s]

localhost:8888/nbconvert/html/[Link]?download=false 1/9
3/10/24, 6:07 PM ResNet50-Copy2

---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
Cell In[1], line 12
10 p.skew_top_bottom(probability=0.04, magnitude=1)
11 #p.random_brightness(probability=0.4, min_factor=0, max_factor=0.65)
---> 12 [Link](700)

File ~\AppData\Roaming\Python\Python311\site-packages\Augmentor\[Link], in P
[Link](self, n, multi_threaded)
362 with tqdm(total=len(augmentor_images), desc="Executing Pipeline", unit=" Samp
les") as progress_bar:
363 with ThreadPoolExecutor(max_workers=None) as executor:
--> 364 for result in [Link](self, augmentor_images):
365 progress_bar.set_description("Processing %s" % result)
366 progress_bar.update(1)

File C:\ProgramData\anaconda3\Lib\concurrent\futures\_base.py:619, in [Link].<l


ocals>.result_iterator()
616 while fs:
617 # Careful not to keep a reference to the popped future
618 if timeout is None:
--> 619 yield _result_or_cancel([Link]())
620 else:
621 yield _result_or_cancel([Link](), end_time - [Link]())

File C:\ProgramData\anaconda3\Lib\concurrent\futures\_base.py:317, in _result_or_canc


el(***failed resolving arguments***)
315 try:
316 try:
--> 317 return [Link](timeout)
318 finally:
319 [Link]()

File C:\ProgramData\anaconda3\Lib\concurrent\futures\_base.py:451, in [Link](s


elf, timeout)
448 elif self._state == FINISHED:
449 return self.__get_result()
--> 451 self._condition.wait(timeout)
453 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
454 raise CancelledError()

File C:\ProgramData\anaconda3\Lib\[Link], in [Link](self, timeout)


318 try: # restore state no matter what (e.g., KeyboardInterrupt)
319 if timeout is None:
--> 320 [Link]()
321 gotit = True
322 else:

KeyboardInterrupt:

In [ ]: p = [Link](r"C:\Users\NAT\Desktop\COMMISSION 2.0\RESNET50_FOR AUG\Dandruff


p.flip_top_bottom(probability=0.4)
p.rotate_random_90(probability=1.0)
[Link](probability=0.9, max_shear_left=20, max_shear_right=20)
[Link](probability=0.3, magnitude=1)
p.skew_corner(probability=0.01, magnitude=1)
p.skew_left_right(probability=0.02, magnitude=1)
p.skew_tilt(probability=0.03, magnitude=1)
p.skew_top_bottom(probability=0.04, magnitude=1)

localhost:8888/nbconvert/html/[Link]?download=false 2/9
3/10/24, 6:07 PM ResNet50-Copy2
#p.random_brightness(probability=0.4, min_factor=0, max_factor=0.65)
[Link](700) #### number of output images after augmentation of Dandruff ####

In [26]: %cd Desktop\COMMISSION 2.0

[WinError 3] The system cannot find the path specified: 'Desktop\\COMMISSION 2.0'
C:\Users\NAT\Desktop\COMMISSION 2.0

In [2]: !pip install split-folders #### installing splitfolders libary ####

Defaulting to user installation because normal site-packages is not writeable


Requirement already satisfied: split-folders in c:\users\nat\appdata\roaming\python\p
ython311\site-packages (0.5.1)

In [3]: import splitfolders #### importing splitfolders library to automatically split datset

In [27]: input_folder = "INPUT_DATASET_700SAMPLES_02182024" #### input_folder path ####


output = "PROCESSED_DATASET_700SAMPLES_02182024" #### create the output folder path ##
[Link](input_folder, output, seed=42, ratio=(.6, .2, .2)) #### ratio for t

Copying files: 1496 files [00:10, 145.77 files/s]

In [ ]: //////

In [2]: from [Link] import Conv2D, Flatten, Dense, MaxPool2D, BatchNormalizat


from [Link].resnet50 import preprocess_input, decode_prediction
from [Link] import ImageDataGenerator, load_img
from [Link].resnet50 import ResNet50
from [Link] import image
from [Link] import Sequential
from [Link] import Model
import [Link] as plt
import numpy as np

#### importing necessary libraries for training ResNet50 model ####

---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[2], line 1
----> 1 from [Link] import Conv2D, Flatten, Dense, MaxPool2D, BatchN
ormalization, GlobalAveragePooling2D
2 from [Link].resnet50 import preprocess_input, decode_p
redictions
3 from [Link] import ImageDataGenerator, load_img

ModuleNotFoundError: No module named 'tensorflow'

In [3]: img_height, img_width = (224,224) #### setting the image height and width ####
batch_size = 32 #### Batch sze for training ####
train_data_dir = r"PROCESSED_DATASET_700SAMPLES_02182024\train" #### location of train
valid_data_dir = r"PROCESSED_DATASET_700SAMPLES_02182024\val" #### location of valid
test_data_dir = r"PROCESSED_DATASET_wmekusmekusCopy\test" #### location of testi

In [3]: train_datagen = ImageDataGenerator (preprocessing_function=preprocess_input,


validation_split=0.4)

train_generator = train_datagen.flow_from_directory(
train_data_dir,

localhost:8888/nbconvert/html/[Link]?download=false 3/9
3/10/24, 6:07 PM ResNet50-Copy2
target_size=(img_height, img_width),
batch_size=batch_size,
class_mode='categorical',
subset="training") #### set as training data ####

valid_generator = train_datagen.flow_from_directory(
valid_data_dir, #### same directory as training data ####
target_size=(img_height, img_width),
batch_size=batch_size,
class_mode='categorical',
subset= 'validation') #### set as validation data ####

#### preprocessing #### necessary to be able to start the training process ####

Found 539 images belonging to 2 classes.


Found 118 images belonging to 2 classes.

In [4]: test_generator = train_datagen.flow_from_directory(


test_data_dir, #### same directory as training data ####
target_size=(img_height, img_width),
batch_size=1,
class_mode='categorical',
subset= 'validation') #### set as validation data ####

#### preprocessing #### necessary to be able to start the testing process ####

Found 118 images belonging to 2 classes.

In [6]: x,y=test_generator.next()
[Link]

(1, 416, 416, 3)


Out[6]:

In [7]: #### this is the code for training ####

base_model = ResNet50(include_top=False, weights='imagenet') ### using ResNet50 algori


x = base_model.output #### taking the output of base_model ####
x = GlobalAveragePooling2D()(x) #### adding additional layer ####
x = Dense (1024, activation='relu')(x) #### another additional layer ####
predictions = Dense (train_generator.num_classes, activation='softmax')(x) #### return
model = Model(inputs=base_model.input, outputs=predictions) #### transfer learning. us

for layer in base_model.layers:


[Link] = False

[Link](optimizer = 'adam', loss='categorical_crossentropy', metrics = ['accurac

[Link](train_generator,
epochs = 10)

localhost:8888/nbconvert/html/[Link]?download=false 4/9
3/10/24, 6:07 PM ResNet50-Copy2
WARNING:tensorflow:From C:\ProgramData\anaconda3\envs\Project\Lib\site-packages\keras
\src\[Link]: The name tf.executing_eagerly_outside_functions is deprecated.
Please use [Link].v1.executing_eagerly_outside_functions instead.

WARNING:tensorflow:From C:\ProgramData\anaconda3\envs\Project\Lib\site-packages\keras
\src\layers\normalization\batch_normalization.py:979: The name [Link].fused_batch_norm
is deprecated. Please use [Link].fused_batch_norm instead.

WARNING:tensorflow:From C:\ProgramData\anaconda3\envs\Project\Lib\site-packages\keras
\src\optimizers\__init__.py:309: The name [Link] is deprecated. Please us
e [Link] instead.

Epoch 1/10
WARNING:tensorflow:From C:\ProgramData\anaconda3\envs\Project\Lib\site-packages\keras
\src\utils\tf_utils.py:492: The name [Link] is deprecated. Pleas
e use [Link] instead.

WARNING:tensorflow:From C:\ProgramData\anaconda3\envs\Project\Lib\site-packages\keras
\src\engine\base_layer_utils.py:384: The name tf.executing_eagerly_outside_functions
is deprecated. Please use [Link].v1.executing_eagerly_outside_functions instead.

17/17 [==============================] - 82s 4s/step - loss: 1.4117 - accuracy: 0.662


3
Epoch 2/10
17/17 [==============================] - 72s 4s/step - loss: 0.2601 - accuracy: 0.877
6
Epoch 3/10
17/17 [==============================] - 93s 6s/step - loss: 0.1220 - accuracy: 0.962
9
Epoch 4/10
17/17 [==============================] - 78s 4s/step - loss: 0.0593 - accuracy: 0.992
6
Epoch 5/10
17/17 [==============================] - 100s 6s/step - loss: 0.0350 - accuracy: 0.99
81
Epoch 6/10
17/17 [==============================] - 87s 5s/step - loss: 0.0196 - accuracy: 0.998
1
Epoch 7/10
17/17 [==============================] - 100s 6s/step - loss: 0.0122 - accuracy: 1.00
00
Epoch 8/10
17/17 [==============================] - 92s 5s/step - loss: 0.0082 - accuracy: 1.000
0
Epoch 9/10
17/17 [==============================] - 97s 6s/step - loss: 0.0064 - accuracy: 1.000
0
Epoch 10/10
17/17 [==============================] - 105s 6s/step - loss: 0.0044 - accuracy: 1.00
00
<[Link] at 0x15440015e10>
Out[7]:

In [8]: !pip install pyyaml h5py #### necessary library to be able to save the model ####

[Link]('Saved_Model\ResNet50_MiteOrDandruff02182024_700smpls10epoch_Resnet50copy2.

localhost:8888/nbconvert/html/[Link]?download=false 5/9
3/10/24, 6:07 PM ResNet50-Copy2
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pyyaml in c:\programdata\anaconda3\envs\project\lib\si
te-packages (6.0.1)
Requirement already satisfied: h5py in c:\programdata\anaconda3\envs\project\lib\site
-packages (3.10.0)
Requirement already satisfied: numpy>=1.17.3 in c:\programdata\anaconda3\envs\project
\lib\site-packages (from h5py) (1.25.2)
C:\ProgramData\anaconda3\envs\Project\Lib\site-packages\keras\src\engine\[Link]:
3103: UserWarning: You are saving your model as an HDF5 file via `[Link]()`. This
file format is considered legacy. We recommend using instead the native Keras format,
e.g. `[Link]('my_model.keras')`.
saving_api.save_model(

In [9]: #### evaluation of the model using testing dataset ####


#### results will show accruacy % and loss % ####

test_loss, test_acc = [Link](test_generator, verbose=2)


print('\nTest accuracy:', test_acc)

118/118 - 27s - loss: 0.3734 - accuracy: 0.9322 - 27s/epoch - 225ms/step

Test accuracy: 0.9322034120559692

In [10]: #### importing necessary libraries for testing ####

import pandas as pd
import seaborn as sn
import tensorflow as tf

#### testing the saved model ####


#### results will show the accuracy % and generates confusion matrix table ####

model = [Link].load_model("Saved_Model\ResNet50_MiteOrDandruff02182024_700smp
filenames = test_generator.filenames
nb_samples = len(test_generator)
y_prob=[]
y_act=[]
test_generator.reset()

for _ in range(nb_samples):
X_test,Y_test = test_generator.next()
y_prob.append([Link](X_test))
y_act.append(Y_test)

predicted_class = [list(train_generator.class_indices.keys())[[Link]()] for i in y_p


actual_class = [list(train_generator.class_indices.keys())[[Link]()] for i in y_act]

out_df = [Link]([Link]([predicted_class,actual_class]).T,columns=['predicted_
confusion_matrix = [Link] (out_df['actual_class'],out_df['predicted_class'], rown

[Link](confusion_matrix, cmap='Blues', annot=True, fmt='d')


[Link]()
print('test accuracy : {}'.format(([Link] (confusion_matrix).sum()/confusion_matr

localhost:8888/nbconvert/html/[Link]?download=false 6/9
3/10/24, 6:07 PM ResNet50-Copy2
1/1 [==============================] - 1s 868ms/step
1/1 [==============================] - 0s 156ms/step
1/1 [==============================] - 0s 148ms/step
1/1 [==============================] - 0s 156ms/step
1/1 [==============================] - 0s 150ms/step
1/1 [==============================] - 0s 160ms/step
1/1 [==============================] - 0s 170ms/step
1/1 [==============================] - 0s 151ms/step
1/1 [==============================] - 0s 160ms/step
1/1 [==============================] - 0s 162ms/step
1/1 [==============================] - 0s 155ms/step
1/1 [==============================] - 0s 178ms/step
1/1 [==============================] - 0s 150ms/step
1/1 [==============================] - 0s 152ms/step
1/1 [==============================] - 0s 154ms/step
1/1 [==============================] - 0s 167ms/step
1/1 [==============================] - 0s 159ms/step
1/1 [==============================] - 0s 148ms/step
1/1 [==============================] - 0s 152ms/step
1/1 [==============================] - 0s 156ms/step
1/1 [==============================] - 0s 178ms/step
1/1 [==============================] - 0s 170ms/step
1/1 [==============================] - 0s 168ms/step
1/1 [==============================] - 0s 151ms/step
1/1 [==============================] - 0s 151ms/step
1/1 [==============================] - 0s 165ms/step
1/1 [==============================] - 0s 163ms/step
1/1 [==============================] - 0s 177ms/step
1/1 [==============================] - 0s 157ms/step
1/1 [==============================] - 0s 209ms/step
1/1 [==============================] - 0s 158ms/step
1/1 [==============================] - 0s 155ms/step
1/1 [==============================] - 0s 144ms/step
1/1 [==============================] - 0s 143ms/step
1/1 [==============================] - 0s 161ms/step
1/1 [==============================] - 0s 143ms/step
1/1 [==============================] - 0s 153ms/step
1/1 [==============================] - 0s 156ms/step
1/1 [==============================] - 0s 163ms/step
1/1 [==============================] - 0s 164ms/step
1/1 [==============================] - 0s 158ms/step
1/1 [==============================] - 0s 156ms/step
1/1 [==============================] - 0s 168ms/step
1/1 [==============================] - 0s 162ms/step
1/1 [==============================] - 0s 152ms/step
1/1 [==============================] - 0s 150ms/step
1/1 [==============================] - 0s 144ms/step
1/1 [==============================] - 0s 163ms/step
1/1 [==============================] - 0s 160ms/step
1/1 [==============================] - 0s 151ms/step
1/1 [==============================] - 0s 143ms/step
1/1 [==============================] - 0s 178ms/step
1/1 [==============================] - 0s 155ms/step
1/1 [==============================] - 0s 146ms/step
1/1 [==============================] - 0s 141ms/step
1/1 [==============================] - 0s 147ms/step
1/1 [==============================] - 0s 153ms/step
1/1 [==============================] - 0s 171ms/step
1/1 [==============================] - 0s 147ms/step
1/1 [==============================] - 0s 160ms/step

localhost:8888/nbconvert/html/[Link]?download=false 7/9
3/10/24, 6:07 PM ResNet50-Copy2
1/1 [==============================] - 0s 154ms/step
1/1 [==============================] - 0s 146ms/step
1/1 [==============================] - 0s 161ms/step
1/1 [==============================] - 0s 153ms/step
1/1 [==============================] - 0s 156ms/step
1/1 [==============================] - 0s 154ms/step
1/1 [==============================] - 0s 157ms/step
1/1 [==============================] - 0s 159ms/step
1/1 [==============================] - 0s 184ms/step
1/1 [==============================] - 0s 179ms/step
1/1 [==============================] - 0s 162ms/step
1/1 [==============================] - 0s 159ms/step
1/1 [==============================] - 0s 146ms/step
1/1 [==============================] - 0s 158ms/step
1/1 [==============================] - 0s 163ms/step
1/1 [==============================] - 0s 172ms/step
1/1 [==============================] - 0s 172ms/step
1/1 [==============================] - 0s 176ms/step
1/1 [==============================] - 0s 154ms/step
1/1 [==============================] - 0s 161ms/step
1/1 [==============================] - 0s 160ms/step
1/1 [==============================] - 0s 156ms/step
1/1 [==============================] - 0s 159ms/step
1/1 [==============================] - 0s 157ms/step
1/1 [==============================] - 0s 174ms/step
1/1 [==============================] - 0s 179ms/step
1/1 [==============================] - 0s 217ms/step
1/1 [==============================] - 0s 176ms/step
1/1 [==============================] - 0s 175ms/step
1/1 [==============================] - 0s 176ms/step
1/1 [==============================] - 0s 162ms/step
1/1 [==============================] - 0s 167ms/step
1/1 [==============================] - 0s 156ms/step
1/1 [==============================] - 0s 184ms/step
1/1 [==============================] - 0s 161ms/step
1/1 [==============================] - 0s 183ms/step
1/1 [==============================] - 0s 161ms/step
1/1 [==============================] - 0s 165ms/step
1/1 [==============================] - 0s 153ms/step
1/1 [==============================] - 0s 152ms/step
1/1 [==============================] - 0s 149ms/step
1/1 [==============================] - 0s 147ms/step
1/1 [==============================] - 0s 164ms/step
1/1 [==============================] - 0s 157ms/step
1/1 [==============================] - 0s 173ms/step
1/1 [==============================] - 0s 165ms/step
1/1 [==============================] - 0s 162ms/step
1/1 [==============================] - 0s 163ms/step
1/1 [==============================] - 0s 164ms/step
1/1 [==============================] - 0s 151ms/step
1/1 [==============================] - 0s 157ms/step
1/1 [==============================] - 0s 171ms/step
1/1 [==============================] - 0s 165ms/step
1/1 [==============================] - 0s 166ms/step
1/1 [==============================] - 0s 168ms/step
1/1 [==============================] - 0s 159ms/step
1/1 [==============================] - 0s 162ms/step
1/1 [==============================] - 0s 171ms/step

localhost:8888/nbconvert/html/[Link]?download=false 8/9
3/10/24, 6:07 PM ResNet50-Copy2

test accuracy : 93.22033898305084

In [25]:

C:\Users\NAT\Desktop\COMMISSION 2.0\Saved_Model

In [ ]:

localhost:8888/nbconvert/html/[Link]?download=false 9/9

Common questions

Powered by AI

Training with data augmentation led to significant improvements in model performance, as evidenced by high classification accuracy. The model achieved a test accuracy of 93.22%, showing it could generalize well to unseen data. Augmentation artificially increases the variety of training samples, helping the model become more robust by preventing overfitting and enabling it to learn features invariant to transformations. This results in higher model robustness and prediction accuracy on validation and test datasets .

Several warnings were noted, especially deprecated warnings like 'The name tf.executing_eagerly_outside_functions is deprecated.' These can be mitigated by updating the code to use current API functions, such as switching calls to 'tf.compat.v1' alternatives. Additionally, a 'ModuleNotFoundError' indicated missing dependencies, which can be resolved by ensuring all required packages are correctly installed and compatible with the current working environment through proper dependency management and environment setup .

Using TensorFlow Keras presents challenges such as compatibility issues, deprecated features, and the need for careful version management. For instance, warnings appear when using deprecated methods within TensorFlow, as seen in the migration from functionalities like 'tf.nn.fused_batch_norm' to their 'tf.compat.v1' alternatives. Moreover, installation and path configuration issues can stall progress (e.g., 'ModuleNotFoundError: No module named tensorflow'). These challenges require users to maintain updated software environments and adapt to new library updates .

The ResNet50 model was initialized with weights pre-trained on ImageNet, and additional layers were added, including a Global Average Pooling layer and dense layers for specific output predictions. During training, the model achieved high accuracy, with epochs showing progressive improvement, reaching 100% accuracy by the 8th epoch. This indicates that ResNet50 was effective for the classification task, likely due to its depth and pre-trained weights that provided a foundation for transfer learning, thus improving training efficiency and outcomes .

Transfer learning with ResNet50 facilitated efficient and effective training by leveraging pre-trained weights from ImageNet, significantly reducing the initial learning load required. By freezing the lower layers of the ResNet50—effectively preserving learned features—while training additional layers for specific tasks, the model adapted quickly to classify between two classes with minimal data. This approach capitalizes on the model's deep feature extraction capability, achieving optimal accuracy and generalization with fewer data resources .

After training, model evaluation involved using a testing dataset to assess performance, specifically measuring accuracy and loss. A confusion matrix was employed, which is significant for revealing precise classification performance—not only showing overall accuracy but also detailing the number of true vs. false predictions across classes. This granularity helps in identifying specific areas where the model might be misclassifying, aiding further improvements in precision and recall .

The data augmentation techniques applied include flipping images top-bottom with a 0.4 probability, rotating images randomly by 90 degrees with a probability of 1.0, and applying shear transformations with a 0.9 probability using max shear factors left and right of 20 degrees. Additionally, various skew transformations were applied with different probabilities and magnitudes. These techniques are used to artificially expand the size of the training dataset, improve model generalization, and help the model learn invariant features under these transformations .

The pipeline processing interruption is indicated by a 'KeyboardInterrupt' error, often stemming from either a manual interruption by the user or a timeout occurring during an operation like data loading or augmentation. This suggests possible inefficiencies or non-responsive tasks in the pipeline execution, which might be due to processing large datasets or computational overheads. To mitigate this, optimizing pipeline tasks, leveraging parallel processing or chunking large operations could result in more efficient execution .

The split-folders library was used to manage the splitting of a dataset into training, validation, and testing datasets in a specified ratio, ensuring a balanced distribution of data across different subsets. Specifically, the data was divided with a ratio of 60% for training, 20% for validation, and 20% for testing. This automated splitting process is essential for creating a robust dataset ready for model training and evaluation, optimizing the model's performance by providing balanced and varied data exposure .

The model's accuracy improved sharply from 66.23% in the first epoch to complete accuracy by the seventh epoch. This swift improvement is likely due to the effective application of transfer learning embellished with incremental improvements from data augmentation. The layered approach of freezing early layers and modifying later ones for task-specific training allows the model to focus learning on distinguishing features relevant to the task, thus leading to significant gains in accuracy over a few training epochs .

You might also like