Simplified cifar10 architecture

parent 8d8f7ce8
Pipeline #109887 failed with stage
in 2 minutes and 19 seconds
...@@ -74,7 +74,7 @@ public class IntegrationCaffe2Test extends AbstractSymtabTest { ...@@ -74,7 +74,7 @@ public class IntegrationCaffe2Test extends AbstractSymtabTest {
public void testDontRetrain1() { public void testDontRetrain1() {
// The training hash is stored during the first training, so the second one is skipped // The training hash is stored during the first training, so the second one is skipped
Log.getFindings().clear(); Log.getFindings().clear();
String[] args = {"-m", "src/test/resources/models/", "-r", "cifar10.Cifar10Classifier", "-b", "CAFFE2"}; String[] args = {"-m", "src/test/resources/models/", "-r", "simpleCifar10.Cifar10Classifier", "-b", "CAFFE2"};
EMADLGeneratorCli.main(args); EMADLGeneratorCli.main(args);
assertTrue(Log.getFindings().isEmpty()); assertTrue(Log.getFindings().isEmpty());
......
cifar10.CifarNetwork src/test/resources/training_data cifar10.CifarNetwork src/test/resources/training_data
simpleCifar10.CifarNetwork src/test/resources/training_data
cNNCalculator.Network src/test/resources/training_data cNNCalculator.Network src/test/resources/training_data
MultipleOutputs data/MultipleOutputs MultipleOutputs data/MultipleOutputs
InstanceTest.NetworkB data/InstanceTest.NetworkB InstanceTest.NetworkB data/InstanceTest.NetworkB
......
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
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
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
}
}
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment