Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
caries_classifier
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
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
sjjsmuel
caries_classifier
Commits
0d44104b
Commit
0d44104b
authored
May 05, 2020
by
sjjsmuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove pre-train
parent
ec31a4c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
38 deletions
+3
-38
train_classifier.py
train_classifier.py
+3
-38
No files found.
train_classifier.py
View file @
0d44104b
...
...
@@ -101,49 +101,15 @@ test_dataset = test_loader.load_dataset()
network
=
Resnet50
(
n_classes
,
img_width
,
img_height
,
channels
,
resnet_file
)
model
=
network
.
get_model
()
#compile the model
for
layer
in
model
.
layers
[
154
:]:
layer
.
trainable
=
True
#compile the model
model
.
compile
(
optimizer
=
RMSprop
(),
loss
=
'categorical_crossentropy'
,
metrics
=
[
'accuracy'
])
# Print Network summary
# model.summary()
'''
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
)),
]
history
=
model
.
fit
(
train_dataset
,
epochs
=
options
.
num_epochs_pre_train
,
validation_data
=
validation_dataset
,
callbacks
=
callbacks_prefit
,
verbose
=
2
)
#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
[
154
:]:
layer
.
trainable
=
True
model
.
compile
(
optimizer
=
SGD
(
lr
=
1e-4
,
momentum
=
0.9
),
loss
=
'categorical_crossentropy'
,
metrics
=
[
'accuracy'
])
# Reload Training Data to shuffle and augment in a different way then before
train_dataset
=
train_loader
.
load_dataset
()
validation_dataset
=
validation_loader
.
load_dataset
()
callbacks
=
[
ModelCheckpoint
(
filepath
=
str
(
checkpoint_path
)
+
'/model.{epoch:03d}-{val_loss:.3f}.hdf5'
,
...
...
@@ -166,7 +132,6 @@ history = model.fit(train_dataset,
callbacks
=
callbacks
,
verbose
=
2
)
print
(
'
\n
History dict:'
,
history
.
history
)
...
...
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