Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ECCCo-jl
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Patrick Altmeyer
ECCCo-jl
Commits
a1aff096
Commit
a1aff096
authored
1 year ago
by
Pat Alt
Browse files
Options
Downloads
Patches
Plain Diff
more things
parent
5eac0ff1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!76
69 initial run including fmnist lenet and new method
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
experiments/mnist.jl
+1
-1
1 addition, 1 deletion
experiments/mnist.jl
experiments/models/additional_models.jl
+1
-2
1 addition, 2 deletions
experiments/models/additional_models.jl
src/utils.jl
+19
-0
19 additions, 0 deletions
src/utils.jl
with
21 additions
and
3 deletions
experiments/mnist.jl
+
1
−
1
View file @
a1aff096
...
...
@@ -13,7 +13,7 @@ test_data = load_mnist_test()
# Additional models:
add_models
=
Dict
(
:
lenet5
=>
lenet5
,
"LeNet-5"
=>
lenet5
,
)
# Default builder:
...
...
This diff is collapsed.
Click to expand it.
experiments/models/additional_models.jl
+
1
−
2
View file @
a1aff096
...
...
@@ -21,7 +21,6 @@ function MLJFlux.build(b::LeNetBuilder, rng, n_in, n_out)
k
,
c1
,
c2
=
b
.
filter_size
,
b
.
channels1
,
b
.
channels2
mod
(
k
,
2
)
==
1
||
error
(
"`filter_size` must be odd. "
)
p
=
div
(
k
-
1
,
2
)
# padding to preserve image size on convolution:
preproc
(
x
)
=
reshape
(
x
,
(
_n_in
,
_n_in
,
1
,
:
))
# Model:
front
=
Flux
.
Chain
(
...
...
@@ -37,7 +36,7 @@ function MLJFlux.build(b::LeNetBuilder, rng, n_in, n_out)
Dense
(
120
,
84
,
relu
),
Dense
(
84
,
n_out
),
)
chain
=
Flux
.
Chain
(
preproc
,
front
,
back
)
chain
=
Flux
.
Chain
(
ECCCo
.
ToConv
(
_n_in
)
,
front
,
back
)
return
chain
end
...
...
This diff is collapsed.
Click to expand it.
src/utils.jl
+
19
−
0
View file @
a1aff096
"""
pre_process(x; noise=0.03f0)
Helper function to add tiny noise to inputs.
"""
function
pre_process
(
x
;
noise
::
Float32
=
0.03f0
)
ϵ
=
Float32
.
(
randn
(
size
(
x
))
*
noise
)
x
+=
ϵ
return
x
end
"A simple functor to convert a vector to a convolutional layer."
struct
ToConv
n_in
::
Int
end
"""
(f::ToConv)(x)
Method to convert a vector to a convolutional layer.
"""
function
(
f
::
ToConv
)(
x
)
return
reshape
(
x
,
(
f
.
n_in
,
f
.
n_in
,
1
,
:
))
end
\ No newline at end of file
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