Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Deeply Hydrated
gun-classification-model
Commits
43737205
Commit
43737205
authored
Nov 25, 2021
by
Mikkel
Browse files
add batch norm
parent
aef4f0a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
model.py
View file @
43737205
...
...
@@ -13,9 +13,9 @@ img_height = 120
img_width
=
120
# Hyperparameters
batch_size
=
128
epochs
=
10
learning_rate
=
0.00
1
batch_size
=
64
epochs
=
5
learning_rate
=
0.00
3
# Create the training dataset
train_ds
=
tf
.
keras
.
utils
.
image_dataset_from_directory
(
...
...
@@ -48,11 +48,13 @@ model = Sequential([
# Encoder
layers
.
Conv2D
(
8
,
3
,
activation
=
'relu'
),
layers
.
BatchNormalization
(),
layers
.
MaxPooling2D
(),
layers
.
Conv2D
(
16
,
3
,
activation
=
'relu'
),
layers
.
BatchNormalization
(),
layers
.
MaxPooling2D
(),
layers
.
Conv2D
(
32
,
3
,
activation
=
'relu'
),
#
layers.
Conv2D(2, 3, activation='relu'), ???
layers
.
BatchNormalization
(),
layers
.
Flatten
(),
# Decoder
...
...
@@ -66,7 +68,7 @@ print(model.summary())
# Compile model
model
.
compile
(
loss
=
'categorical_crossentropy'
,
optimizer
=
keras
.
optimizers
.
SGD
(
learning_rate
=
learning_rate
),
metrics
=
[
'accuracy'
])
optimizer
=
keras
.
optimizers
.
Adam
(
learning_rate
=
learning_rate
),
metrics
=
[
'accuracy'
])
# Train the model on the dataset
history
=
model
.
fit
(
train_ds
,
batch_size
=
batch_size
,
epochs
=
epochs
,
...
...
Write
Preview
Supports
Markdown
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