Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Depression Screening Tool-2021_203
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
1
Merge Requests
1
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
2021_203
Depression Screening Tool-2021_203
Commits
82cab670
Commit
82cab670
authored
Nov 06, 2021
by
Pathirana W.P.N.P
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
bdc8df3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
0 deletions
+67
-0
smallervggnet.py
smallervggnet.py
+67
-0
No files found.
smallervggnet.py
0 → 100644
View file @
82cab670
# import the necessary packages
from
tensorflow.keras.models
import
Sequential
from
tensorflow.keras.layers
import
BatchNormalization
from
tensorflow.keras.layers
import
Conv2D
from
tensorflow.keras.layers
import
MaxPooling2D
from
tensorflow.keras.layers
import
Activation
from
tensorflow.keras.layers
import
Flatten
from
tensorflow.keras.layers
import
Dropout
from
tensorflow.keras.layers
import
Dense
from
tensorflow.keras
import
backend
as
K
class
SmallerVGGNet
:
@
staticmethod
def
build
(
width
,
height
,
depth
,
classes
,
finalAct
=
"softmax"
):
# initialize the model along with the input shape to be
# "channels last" and the channels dimension itself
model
=
Sequential
()
inputShape
=
(
height
,
width
,
depth
)
chanDim
=
-
1
# if we are using "channels first", update the input shape
# and channels dimension
if
K
.
image_data_format
()
==
"channels_first"
:
inputShape
=
(
depth
,
height
,
width
)
chanDim
=
1
# CONV => RELU => POOL
model
.
add
(
Conv2D
(
32
,
(
3
,
3
),
padding
=
"same"
,
input_shape
=
inputShape
))
model
.
add
(
Activation
(
"relu"
))
model
.
add
(
BatchNormalization
(
axis
=
chanDim
))
model
.
add
(
MaxPooling2D
(
pool_size
=
(
3
,
3
)))
model
.
add
(
Dropout
(
0.25
))
# (CONV => RELU) * 2 => POOL
model
.
add
(
Conv2D
(
64
,
(
3
,
3
),
padding
=
"same"
))
model
.
add
(
Activation
(
"relu"
))
model
.
add
(
BatchNormalization
(
axis
=
chanDim
))
model
.
add
(
Conv2D
(
64
,
(
3
,
3
),
padding
=
"same"
))
model
.
add
(
Activation
(
"relu"
))
model
.
add
(
BatchNormalization
(
axis
=
chanDim
))
model
.
add
(
MaxPooling2D
(
pool_size
=
(
2
,
2
)))
model
.
add
(
Dropout
(
0.25
))
# (CONV => RELU) * 2 => POOL
model
.
add
(
Conv2D
(
128
,
(
3
,
3
),
padding
=
"same"
))
model
.
add
(
Activation
(
"relu"
))
model
.
add
(
BatchNormalization
(
axis
=
chanDim
))
model
.
add
(
Conv2D
(
128
,
(
3
,
3
),
padding
=
"same"
))
model
.
add
(
Activation
(
"relu"
))
model
.
add
(
BatchNormalization
(
axis
=
chanDim
))
model
.
add
(
MaxPooling2D
(
pool_size
=
(
2
,
2
)))
model
.
add
(
Dropout
(
0.25
))
# first (and only) set of FC => RELU layers
model
.
add
(
Flatten
())
model
.
add
(
Dense
(
1024
))
model
.
add
(
Activation
(
"relu"
))
model
.
add
(
BatchNormalization
())
model
.
add
(
Dropout
(
0.5
))
# softmax classifier
model
.
add
(
Dense
(
classes
))
model
.
add
(
Activation
(
finalAct
))
# return the constructed network architecture
return
model
\ No newline at end of file
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