Skip to content

Commit

Permalink
working on p3
Browse files Browse the repository at this point in the history
  • Loading branch information
Atashnezhad committed Nov 20, 2023
1 parent e10bb11 commit d39bdaa
Showing 1 changed file with 111 additions and 27 deletions.
138 changes: 111 additions & 27 deletions tutorial/P3_trasnfer_learning.ipynb
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "initial_id",
"cell_type": "markdown",
"source": [
"# Install drillvision"
],
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2023-11-19T23:01:14.962884700Z",
"start_time": "2023-11-19T23:01:12.698957700Z"
}
"collapsed": false
},
"id": "622c05a88fb1ad42"
},
{
"cell_type": "code",
"execution_count": 1,
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -133,49 +135,61 @@
],
"source": [
"!pip install drillvision"
]
},
{
"cell_type": "code",
"execution_count": 2,
"outputs": [],
"source": [
"from neural_network_model.transfer_learning import TransferModel"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-19T23:03:12.479404900Z",
"start_time": "2023-11-19T23:03:08.237223100Z"
"start_time": "2023-11-19T23:01:12.698957700Z"
}
},
"id": "84ca0b4d0189f28d"
"id": "initial_id"
},
{
"cell_type": "markdown",
"source": [
"# Import appropriate modules"
],
"metadata": {
"collapsed": false
},
"id": "439b3b5a21172450"
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"outputs": [],
"source": [
"from neural_network_model.transfer_learning import TransferModel\n",
"from pathlib import Path"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-19T23:03:18.103265500Z",
"start_time": "2023-11-19T23:03:18.086228500Z"
"end_time": "2023-11-20T16:51:03.501628800Z",
"start_time": "2023-11-20T16:50:59.045558600Z"
}
},
"id": "3669aa9df2c03862"
"id": "84ca0b4d0189f28d"
},
{
"cell_type": "markdown",
"source": [
"# Initiate TransferModel object and set the directory for dataset"
],
"metadata": {
"collapsed": false
},
"id": "34462e32d53d05bc"
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 2,
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2023-11-19 17:04:39,056 - INFO - Data was prepared\n"
"2023-11-20 10:51:28,192 - INFO - Data was prepared\n"
]
}
],
Expand All @@ -187,12 +201,22 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-19T23:04:39.062545700Z",
"start_time": "2023-11-19T23:04:38.981546Z"
"end_time": "2023-11-20T16:51:28.201827400Z",
"start_time": "2023-11-20T16:51:28.113667400Z"
}
},
"id": "2ba10e6cc8c4643c"
},
{
"cell_type": "markdown",
"source": [
"# Illustrate the distribution of images across various classes in the dataset"
],
"metadata": {
"collapsed": false
},
"id": "3df1d198986baf26"
},
{
"cell_type": "code",
"execution_count": 7,
Expand Down Expand Up @@ -232,6 +256,16 @@
},
"id": "c3e459d730220077"
},
{
"cell_type": "markdown",
"source": [
"# Examine the images and assess their width and height to identify any discrepancies in dimensions"
],
"metadata": {
"collapsed": false
},
"id": "cd41f9f350cbf147"
},
{
"cell_type": "code",
"execution_count": 8,
Expand Down Expand Up @@ -288,6 +322,16 @@
},
"id": "75722466fedc4d4f"
},
{
"cell_type": "markdown",
"source": [
"# Plot the images using cmap jet"
],
"metadata": {
"collapsed": false
},
"id": "5394be1157063d66"
},
{
"cell_type": "code",
"execution_count": 9,
Expand All @@ -313,6 +357,16 @@
},
"id": "5d89fcd09e4483df"
},
{
"cell_type": "markdown",
"source": [
"# Utilize transfer learning for training and specify the save path for the trained transfer_model along with its given name."
],
"metadata": {
"collapsed": false
},
"id": "134ca2f14e87a109"
},
{
"cell_type": "code",
"execution_count": 11,
Expand Down Expand Up @@ -349,6 +403,16 @@
},
"id": "df17c7ccf46c4eee"
},
{
"cell_type": "markdown",
"source": [
"# Graph the metrics against the iteration number for visualization."
],
"metadata": {
"collapsed": false
},
"id": "d4e6c530f420b6ee"
},
{
"cell_type": "code",
"execution_count": 12,
Expand Down Expand Up @@ -432,6 +496,16 @@
},
"id": "fce9e3bb6b88543b"
},
{
"cell_type": "markdown",
"source": [
"# Generate plots for images belonging to the specified classes, and employ the model to predict their respective labels"
],
"metadata": {
"collapsed": false
},
"id": "1abfacbcf41826df"
},
{
"cell_type": "code",
"execution_count": 15,
Expand Down Expand Up @@ -508,6 +582,16 @@
},
"id": "3b1ec4518767e307"
},
{
"cell_type": "markdown",
"source": [
"# Apply Grad-CAM (Gradient-weighted Class Activation Mapping) to visualize and interpret the activations of a specific layer in the model"
],
"metadata": {
"collapsed": false
},
"id": "59fd765de4675e88"
},
{
"cell_type": "code",
"execution_count": 16,
Expand Down

0 comments on commit d39bdaa

Please sign in to comment.