Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modified: BETA_E_Model_T&T.ipynb #82

Merged
merged 1 commit into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 30 additions & 25 deletions BETA_E_Model_T&T.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 19,
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-27T17:34:12.077394600Z",
Expand All @@ -898,14 +898,14 @@
"Freezing 0 layers in the base model...\n",
"Percentage of the base model that is frozen: 0.00%\n",
"Total model layers: 814\n",
"Model: \"model\"\n",
"Model: \"model_3\"\n",
"_____________________________________________________________________________________________________________\n",
" Layer (type) Output Shape Param # Connected to Trainable \n",
"=============================================================================================================\n",
" input_1 (InputLayer) [(None, 224, 224, 3 0 [] Y \n",
" input_4 (InputLayer) [(None, 224, 224, 3 0 [] Y \n",
" )] \n",
" \n",
" stem_conv (Conv2D) (None, 112, 112, 64 1728 ['input_1[0][0]'] Y \n",
" stem_conv (Conv2D) (None, 112, 112, 64 1728 ['input_4[0][0]'] Y \n",
" ) \n",
" \n",
" stem_bn (BatchNormalization) (None, 112, 112, 64 256 ['stem_conv[0][0]'] Y \n",
Expand Down Expand Up @@ -3016,25 +3016,24 @@
" \n",
" top_activation (Activation) (None, 7, 7, 2560) 0 ['top_bn[0][0]'] Y \n",
" \n",
" global_average_pooling2d (Glob (None, 2560) 0 ['top_activation[0][0]'] Y \n",
" alAveragePooling2D) \n",
" FC_INPUT_Avg-Pooling (GlobalAv (None, 2560) 0 ['top_activation[0][0]'] Y \n",
" eragePooling2D) \n",
" \n",
" dense (Dense) (None, 512) 1311232 ['global_average_pooling2d[0][0 Y \n",
" ]'] \n",
" FC_C_Dense-L1-512 (Dense) (None, 512) 1311232 ['FC_INPUT_Avg-Pooling[0][0]'] Y \n",
" \n",
" dropout (Dropout) (None, 512) 0 ['dense[0][0]'] Y \n",
" FC_C_Dropout-L1-0.1 (Dropout) (None, 512) 0 ['FC_C_Dense-L1-512[0][0]'] Y \n",
" \n",
" batch_normalization (BatchNorm (None, 512) 2048 ['dropout[0][0]'] Y \n",
" FC_C_Avg-Pooling-L1 (BatchNorm (None, 512) 2048 ['FC_C_Dropout-L1-0.1[0][0]'] Y \n",
" alization) \n",
" \n",
" dense_1 (Dense) (None, 512) 262656 ['batch_normalization[0][0]'] Y \n",
" FC_C_Dense-L2-512 (Dense) (None, 512) 262656 ['FC_C_Avg-Pooling-L1[0][0]'] Y \n",
" \n",
" batch_normalization_1 (BatchNo (None, 512) 2048 ['dense_1[0][0]'] Y \n",
" rmalization) \n",
" FC_C_Avg-Pooling-L2 (BatchNorm (None, 512) 2048 ['FC_C_Dense-L2-512[0][0]'] Y \n",
" alization) \n",
" \n",
" dense_2 (Dense) (None, 128) 65664 ['batch_normalization_1[0][0]'] Y \n",
" FC_C_Dense-L3-128 (Dense) (None, 128) 65664 ['FC_C_Avg-Pooling-L2[0][0]'] Y \n",
" \n",
" dense_3 (Dense) (None, 2) 258 ['dense_2[0][0]'] Y \n",
" FC_OUTPUT_Dense-2 (Dense) (None, 2) 258 ['FC_C_Dense-L3-128[0][0]'] Y \n",
" \n",
"=============================================================================================================\n",
"Total params: 65,741,586\n",
Expand Down Expand Up @@ -9922,7 +9921,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 17,
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-28T02:31:32.994176700Z",
Expand All @@ -9939,14 +9938,14 @@
"Freezing 0 layers in the base model...\n",
"Percentage of the base model that is frozen: 0.00%\n",
"Total model layers: 814\n",
"Model: \"model\"\n",
"Model: \"model_1\"\n",
"_____________________________________________________________________________________________________________\n",
" Layer (type) Output Shape Param # Connected to Trainable \n",
"=============================================================================================================\n",
" input_5 (InputLayer) [(None, 224, 224, 3 0 [] Y \n",
" input_2 (InputLayer) [(None, 224, 224, 3 0 [] Y \n",
" )] \n",
" \n",
" stem_conv (Conv2D) (None, 112, 112, 64 1728 ['input_5[0][0]'] Y \n",
" stem_conv (Conv2D) (None, 112, 112, 64 1728 ['input_2[0][0]'] Y \n",
" ) \n",
" \n",
" stem_bn (BatchNormalization) (None, 112, 112, 64 256 ['stem_conv[0][0]'] Y \n",
Expand Down Expand Up @@ -17993,7 +17992,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 20,
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-28T07:04:23.573633300Z",
Expand All @@ -18008,7 +18007,7 @@
"Training the model...\n",
"\u001b[0;33m\n",
"Setup Verbose:\u001b[0m\n",
"\u001b[0m\u001b[0m\u001b[0;36mSetting TensorBoard Log dir to \u001b[0m\u001b[0;32m[logs/fit/y2024_m01_d06-h17_m48_s14]\u001b[0m\u001b[0;36m...\u001b[0m\n",
"\u001b[0m\u001b[0m\u001b[0;36mSetting TensorBoard Log dir to \u001b[0m\u001b[0;32m[logs/fit/y2024_m01_d06-h18_m12_s19]\u001b[0m\u001b[0;36m...\u001b[0m\n",
"\u001b[0m\u001b[0m\u001b[0;36mUse_extended_tensorboard \u001b[0m\u001b[0;32m[False]\u001b[0m\u001b[0;36m.\u001b[0m\n",
"\u001b[0m\u001b[0m\u001b[0;36mDebug_OUTPUT_DPS \u001b[0m\u001b[0;32m[True]\u001b[0m\u001b[0;36m.\u001b[0m\n",
"\u001b[0m\u001b[0m\u001b[0;36mOneCycleLr_UFTS \u001b[0m\u001b[0;32m[False]\u001b[0m\u001b[0;36m.\u001b[0m\n",
Expand All @@ -18017,7 +18016,9 @@
"\u001b[0m\u001b[0mEpoch: \u001b[0m\u001b[0;36m1\u001b[0m\u001b[0m/\u001b[0m\u001b[0;32m486 (TSEC: 0)\u001b[0m\u001b[0;34m | \u001b[0m\u001b[0;32m[Learning the patterns]\u001b[0m\n",
"\u001b[0m\u001b[0m\u001b[0;33mTaking a subset of \u001b[0m\u001b[0;32m[|4096|AdvSubset:True]\u001b[0m\u001b[0;33m...\u001b[0m\n",
"\u001b[0;33mPreparing train data...\u001b[0m\n",
"\u001b[0;33m- Fitting ImageDataGenerator...\u001b[0m\n"
"\u001b[0;33m- Loading fitted ImageDataGenerator...\u001b[0m\n",
"\u001b[0;33m- ImageDataGenerator fit done.\u001b[0m\n",
"\u001b[0;33m- Augmenting Image Data...\u001b[0m\n"
]
}
],
Expand Down Expand Up @@ -18227,11 +18228,15 @@
"# Define a function to plot the confusion matrix\n",
"def plot_confusion_matrix(epoch, logs):\n",
" # Use the model to predict the values from the test dataset.\n",
" test_pred_raw = model.predict(x_test)\n",
" test_pred = np.argmax(test_pred_raw, axis=1)\n",
" test_pred_raw = model.predict(x_test, verbose=0)\n",
" test_pred = np.argmax(test_pred_raw, axis=1) # Convert predictions from one-hot encoded to binary\n",
"\n",
" # Convert true labels from one-hot encoded to binary\n",
" y_true = np.argmax(y_test, axis=1)\n",
"\n",
" # Calculate the confusion matrix.\n",
" cm = confusion_matrix(y_test, test_pred)\n",
" cm = confusion_matrix(y_true, test_pred)\n",
" \n",
" # Log the confusion matrix as an image summary.\n",
" figure = plt.figure(figsize=(8, 8))\n",
" sns.heatmap(cm, annot=True, fmt=\"d\", cmap=plt.cm.Blues)\n",
Expand Down
Binary file modified Data/image_SUB_generator.pkl
Binary file not shown.
Loading