Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMADL2CPP
Commits
2da70ed9
Commit
2da70ed9
authored
Mar 07, 2019
by
Christopher Jan-Steffen Brix
Browse files
Simplified cifar10 architecture
parent
8d8f7ce8
Pipeline
#109887
failed with stage
in 2 minutes and 19 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/test/java/de/monticore/lang/monticar/emadl/IntegrationCaffe2Test.java
View file @
2da70ed9
...
...
@@ -74,7 +74,7 @@ public class IntegrationCaffe2Test extends AbstractSymtabTest {
public
void
testDontRetrain1
()
{
// The training hash is stored during the first training, so the second one is skipped
Log
.
getFindings
().
clear
();
String
[]
args
=
{
"-m"
,
"src/test/resources/models/"
,
"-r"
,
"
c
ifar10.Cifar10Classifier"
,
"-b"
,
"CAFFE2"
};
String
[]
args
=
{
"-m"
,
"src/test/resources/models/"
,
"-r"
,
"
simpleC
ifar10.Cifar10Classifier"
,
"-b"
,
"CAFFE2"
};
EMADLGeneratorCli
.
main
(
args
);
assertTrue
(
Log
.
getFindings
().
isEmpty
());
...
...
src/test/resources/models/data_paths.txt
View file @
2da70ed9
cifar10.CifarNetwork src/test/resources/training_data
simpleCifar10.CifarNetwork src/test/resources/training_data
cNNCalculator.Network src/test/resources/training_data
MultipleOutputs data/MultipleOutputs
InstanceTest.NetworkB data/InstanceTest.NetworkB
...
...
src/test/resources/models/simpleCifar10/ArgMax.emadl
0 → 100644
View file @
2da70ed9
package
simpleCifar10
;
component
ArgMax
<
Z
(
1
:
oo
)
n
=
2
>{
ports
in
Q
^{
n
}
inputVector
,
out
Z
(
0
:
oo
)
maxIndex
;
implementation
Math
{
maxIndex
=
0
;
Q
maxValue
=
inputVector
(
1
);
for
i
=
2
:
n
if
inputVector
(
i
)
>
maxValue
maxIndex
=
i
-
1
;
maxValue
=
inputVector
(
i
);
end
end
}
}
\ No newline at end of file
src/test/resources/models/simpleCifar10/Cifar10Classifier.emadl
0 → 100644
View file @
2da70ed9
package
simpleCifar10
;
import
Network
;
import
CalculateClass
;
component
Cifar10Classifier
{
ports
in
Z
(
0
:
255
)^{
3
,
32
,
32
}
image
,
out
Z
(
0
:
9
)
classIndex
;
instance
CifarNetwork
<
10
>
net
;
instance
ArgMax
<
10
>
calculateClass
;
connect
image
->
net
.
data
;
connect
net
.
softmax
->
calculateClass
.
inputVector
;
connect
calculateClass
.
maxIndex
->
classIndex
;
}
\ No newline at end of file
src/test/resources/models/simpleCifar10/CifarNetwork.cnnt
0 → 100644
View file @
2da70ed9
configuration CifarNetwork{
num_epoch:10
batch_size:5
normalize:true
context:cpu
load_checkpoint:false
optimizer:adam{
learning_rate:0.01
learning_rate_decay:0.8
step_size:1000
weight_decay:0.0001
}
}
src/test/resources/models/simpleCifar10/CifarNetwork.emadl
0 → 100644
View file @
2da70ed9
package
simpleCifar10
;
component
CifarNetwork
<
Z
(
2
:
oo
)
classes
=
10
>{
ports
in
Z
(
0
:
255
)^{
3
,
32
,
32
}
data
,
out
Q
(
0
:
1
)^{
classes
}
softmax
;
implementation
CNN
{
def
conv
(
kernel
,
channels
,
stride
=
1
,
act
=
true
){
Convolution
(
kernel
=(
kernel
,
kernel
),
channels
=
channels
,
stride
=(
stride
,
stride
))
->
}
def
resLayer
(
channels
,
stride
=
1
,
addSkipConv
=
false
){
(
conv
(
kernel
=
3
,
channels
=
channels
,
stride
=
stride
)
->
conv
(
kernel
=
3
,
channels
=
channels
,
act
=
false
)
|
conv
(
kernel
=
1
,
channels
=
channels
,
stride
=
stride
,
act
=
false
,
?
=
addSkipConv
)
)
->
Add
()
->
}
data
->
resLayer
(
channels
=
8
,
addSkipConv
=
true
)
->
resLayer
(
channels
=
16
,
stride
=
2
,
addSkipConv
=
true
)
->
resLayer
(
channels
=
16
,
->=
2
)
->
resLayer
(
channels
=
32
,
stride
=
2
,
addSkipConv
=
true
)
->
resLayer
(
channels
=
32
,
->=
2
)
->
resLayer
(
channels
=
64
,
stride
=
2
,
addSkipConv
=
true
)
->
resLayer
(
channels
=
64
,
->=
2
)
->
GlobalPooling
(
pool_type
=
"avg"
)
->
FullyConnected
(
units
=
128
)
->
Dropout
()->
FullyConnected
(
units
=
classes
)
->
Softmax
()
->
softmax
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment