Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
deepFriedConvnet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Luc Giffon
deepFriedConvnet
Commits
94285510
Commit
94285510
authored
6 years ago
by
Luc Giffon
Browse files
Options
Downloads
Patches
Plain Diff
exp script end_to_end_with_2_layers_only_dense_with_augment
parent
14155b72
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
main/experiments/scripts/november_2018/end_to_end_with_2_layers_only_dense_with_augment/deepstrom_classif_end_to_end.py
+12
-9
12 additions, 9 deletions
...s_only_dense_with_augment/deepstrom_classif_end_to_end.py
with
12 additions
and
9 deletions
main/experiments/scripts/november_2018/end_to_end_with_2_layers_only_dense_with_augment/deepstrom_classif_end_to_end.py
+
12
−
9
View file @
94285510
...
...
@@ -54,13 +54,13 @@ Kernel related:
"""
import
skluc.main.data.mldatasets
as
dataset
import
numpy
as
np
import
tensorflow
as
tf
from
tensorflow.python.keras.layers
import
Dense
from
tensorflow.python.keras.regularizers
import
l2
from
tensorflow.python.keras.initializers
import
he_normal
from
tensorflow.python.keras.preprocessing.image
import
ImageDataGenerator
from
skluc.main.tensorflow_.kernel_approximation.fastfood_layer
import
FastFoodLayer
from
skluc.main.tensorflow_.kernel_approximation.nystrom_layer
import
DeepstromLayerEndToEnd
...
...
@@ -168,6 +168,13 @@ def main(paraman, resman, printman):
X_test
,
y_test
=
data
.
test
.
data
,
data
.
test
.
labels
X_val
,
y_val
=
data
.
validation
.
data
,
data
.
validation
.
labels
datagen
=
ImageDataGenerator
(
rotation_range
=
20
,
width_shift_range
=
0.2
,
height_shift_range
=
0.2
,
horizontal_flip
=
True
)
datagen
.
fit
(
X_train
)
paraman
.
init_kernel_dict
(
X_train
)
# # Model definition
...
...
@@ -185,11 +192,8 @@ def main(paraman, resman, printman):
repr_sub
=
convnet_model
(
subs
)
logger
.
debug
(
paraman
[
"
kernel_dict
"
])
input_classifier
=
None
if
paraman
[
"
network
"
]
==
"
deepstrom
"
:
deepstrom_layer
=
DeepstromLayerEndToEnd
(
subsample_size
=
paraman
[
"
--nys-size
"
],
kernel_name
=
paraman
[
"
kernel
"
],
...
...
@@ -258,8 +262,8 @@ def main(paraman, resman, printman):
j
=
0
for
i
in
range
(
paraman
[
"
--num-epoch
"
]):
logger
.
debug
(
memory_usage
())
for
X_batch
,
Y_batch
in
b
at
ch_generator
(
X_train
,
y_train
,
paraman
[
"
--batch-size
"
]
,
False
):
k
=
0
for
X_batch
,
Y_batch
in
d
at
agen
.
flow
(
X_train
,
y_train
,
batch_size
=
paraman
[
"
--batch-size
"
]):
if
paraman
[
"
network
"
]
==
"
deepstrom
"
:
feed_dict
=
{
x
:
X_batch
,
y
:
Y_batch
,
subs
:
nys_subsample
}
else
:
...
...
@@ -267,9 +271,8 @@ def main(paraman, resman, printman):
_
,
loss
,
acc
,
summary_str
=
sess
.
run
([
train_optimizer
,
cross_entropy
,
accuracy_op
,
merged_summary
],
feed_dict
=
feed_dict
)
if
j
%
100
==
0
:
logger
.
info
(
"
epoch: {}/{}; batch: {}/{}; batch_shape: {}; loss: {}; acc: {}
"
.
format
(
i
,
paraman
[
"
--num-epoch
"
],
j
+
1
,
int
(
data
.
train
[
0
].
shape
[
0
]
/
paraman
[
"
--batch-size
"
])
+
1
,
"
epoch: {}/{}; batch: {}/{}; batch_shape: {}; loss: {}; acc: {}
"
.
format
(
i
,
paraman
[
"
--num-epoch
"
],
j
+
1
,
int
(
data
.
train
[
0
].
shape
[
0
]
/
paraman
[
"
--batch-size
"
])
+
1
,
X_batch
.
shape
,
loss
,
acc
))
if
paraman
[
"
--tensorboard
"
]:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment