Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
22_23-J 65
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-J 65
22_23-J 65
Commits
0b402857
Commit
0b402857
authored
Jan 28, 2023
by
Warnasooriya M.D.S.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resnet Model Developed
parent
bdeba643
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
138 additions
and
2 deletions
+138
-2
Backend/.ipynb_checkpoints/SF__Dinuka_Pest_Damages_identification_V01-checkpoint.ipynb
...__Dinuka_Pest_Damages_identification_V01-checkpoint.ipynb
+69
-1
Backend/SF__Dinuka_Pest_Damages_identification_V01.ipynb
Backend/SF__Dinuka_Pest_Damages_identification_V01.ipynb
+69
-1
No files found.
Backend/.ipynb_checkpoints/SF__Dinuka_Pest_Damages_identification_V01-checkpoint.ipynb
View file @
0b402857
...
@@ -249,7 +249,75 @@
...
@@ -249,7 +249,75 @@
"execution_count": null,
"execution_count": null,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": []
"source": [
"🟢 ResNetModel"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#Import Dependencies\n",
"import tensorflow as tf\n",
"import tensorflow_hub as hub\n",
"from tensorflow.keras import layers\n",
"from tensorflow.keras.layers import Conv2D , MaxPool2D , Dense , Flatten"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def create_model(model_url , num_classes=3):\n",
"\n",
" feature_extractor_layer = hub.KerasLayer(model_url,\n",
" trainable = False, #freeze the already learned patterns \n",
" name = \"feature_extraction_layer\",\n",
" input_shape = (448, 448,3)) \n",
" #Create our own model\n",
" model = tf.keras.Sequential([\n",
" feature_extractor_layer,\n",
" \n",
" layers.Dense(num_classes , activation=\"softmax\" , name=\"output_layer\")\n",
" ])\n",
"\n",
" return model"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"resnet_url = \"https://tfhub.dev/google/imagenet/resnet_v2_50/feature_vector/5\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#Create Resnet Model\n",
"resnet_model = create_model(resnet_url , \n",
" num_classes = 3)\n",
"#Compile our resnet model\n",
"resnet_model.compile(loss='categorical_crossentropy',\n",
" optimizer = tf.keras.optimizers.Adam(),\n",
" metrics=[\"accuracy\"])\n",
"#Fitting the model\n",
"resnet_hist = resnet_model.fit(train_data,\n",
" epochs=15,\n",
" steps_per_epoch=len(train_data),\n",
" validation_data = test_data,\n",
" validation_steps = len(test_data)\n",
" )"
]
}
}
],
],
"metadata": {
"metadata": {
...
...
Backend/SF__Dinuka_Pest_Damages_identification_V01.ipynb
View file @
0b402857
...
@@ -249,7 +249,75 @@
...
@@ -249,7 +249,75 @@
"execution_count": null,
"execution_count": null,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": []
"source": [
"🟢 ResNetModel"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#Import Dependencies\n",
"import tensorflow as tf\n",
"import tensorflow_hub as hub\n",
"from tensorflow.keras import layers\n",
"from tensorflow.keras.layers import Conv2D , MaxPool2D , Dense , Flatten"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def create_model(model_url , num_classes=3):\n",
"\n",
" feature_extractor_layer = hub.KerasLayer(model_url,\n",
" trainable = False, #freeze the already learned patterns \n",
" name = \"feature_extraction_layer\",\n",
" input_shape = (448, 448,3)) \n",
" #Create our own model\n",
" model = tf.keras.Sequential([\n",
" feature_extractor_layer,\n",
" \n",
" layers.Dense(num_classes , activation=\"softmax\" , name=\"output_layer\")\n",
" ])\n",
"\n",
" return model"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"resnet_url = \"https://tfhub.dev/google/imagenet/resnet_v2_50/feature_vector/5\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#Create Resnet Model\n",
"resnet_model = create_model(resnet_url , \n",
" num_classes = 3)\n",
"#Compile our resnet model\n",
"resnet_model.compile(loss='categorical_crossentropy',\n",
" optimizer = tf.keras.optimizers.Adam(),\n",
" metrics=[\"accuracy\"])\n",
"#Fitting the model\n",
"resnet_hist = resnet_model.fit(train_data,\n",
" epochs=15,\n",
" steps_per_epoch=len(train_data),\n",
" validation_data = test_data,\n",
" validation_steps = len(test_data)\n",
" )"
]
}
}
],
],
"metadata": {
"metadata": {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment