Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
sjjsmuel
caries_classifier
Commits
3e75a279
Commit
3e75a279
authored
Apr 30, 2020
by
sjjsmuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use best model from pretrain
parent
a7b7cf67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
train_classifier.py
train_classifier.py
+12
-0
No files found.
train_classifier.py
View file @
3e75a279
...
...
@@ -6,6 +6,7 @@ from network.Resnet50 import Resnet50
from
helpers.DataLoader
import
DataLoader
from
tensorflow.keras.callbacks
import
ModelCheckpoint
,
TensorBoard
,
EarlyStopping
from
tensorflow.keras.optimizers
import
RMSprop
,
SGD
from
tensorflow.keras.models
import
load_model
import
pathlib
...
...
@@ -100,6 +101,12 @@ model.compile(optimizer=RMSprop(), loss='categorical_crossentropy', metrics=['ac
Pre-Train FC Layers
'''
callbacks_prefit
=
[
ModelCheckpoint
(
filepath
=
str
(
checkpoint_path
)
+
'/best_pre_train.hdf5'
,
save_best_only
=
True
,
monitor
=
'val_loss'
,
verbose
=
1
),
EarlyStopping
(
monitor
=
'val_loss'
,
patience
=
10
),
TensorBoard
(
options
.
output_path
+
'/logs/{}_prefit'
.
format
(
time
)),
]
...
...
@@ -112,6 +119,11 @@ history = model.fit(train_dataset,
#model.save_weights('last_pre_train_model.h5')
print
(
'
\n
History dict:'
,
history
.
history
)
'''
Run refinement training on best model of pre-train
'''
model
=
load_model
(
str
(
checkpoint_path
)
+
'/best_pre_train.hdf5'
)
for
layer
in
model
.
layers
[
-
39
:]:
layer
.
trainable
=
True
...
...
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