Commit 5ff0053d authored by Christopher Jan-Steffen Brix's avatar Christopher Jan-Steffen Brix
Browse files

Added example project

parent 229e98d3
train.log
target/
data/vGG16/mnist.pkl.gz
data/vGG16/st.h5
model/
package cNNCalculator;
component Add{
ports
in Z(0:999) num1,
in Z(0:999) num2,
out Z(0:1998) sum;
implementation Math{
sum = num1 + num2;
}
}
package cNNCalculator;
component Argmaxs{
ports
in Q(0:1)^10 input1,
in Q(0:1)^10 input2,
in Q(0:1)^10 input3,
out Z(0:999) max;
implementation Math{
max = amax(input1) + 10*amax(input2) + 100*amax(input3);
}
}
package cNNCalculator;
component Calculator {
ports
in Q(0:1)^10 in1_1,
in Q(0:1)^10 in1_2,
in Q(0:1)^10 in1_3,
in Q(0:1)^10 in2_1,
in Q(0:1)^10 in2_2,
in Q(0:1)^10 in2_3,
out Z(0:1998) out1;
instance Argmaxs args1;
instance Argmaxs args2;
instance Add add;
connect in1_1 -> args1.input1;
connect in1_2 -> args1.input2;
connect in1_3 -> args1.input3;
connect in2_1 -> args2.input1;
connect in2_2 -> args2.input2;
connect in2_3 -> args2.input3;
connect args1.max -> add.num1;
connect args2.max -> add.num2;
connect add.sum -> out1;
}
package cNNCalculator;
component Connector {
ports in Q(0:1)^{1, 28, 28} image1,
in Q(0:1)^{1, 28, 28} image2,
in Q(0:1)^{1, 28, 28} image3,
in Q(0:1)^{1, 28, 28} image4,
in Q(0:1)^{1, 28, 28} image5,
in Q(0:1)^{1, 28, 28} image6,
out Z(0:1998) res;
instance VGG16 predictor1;
instance VGG16 predictor2;
instance VGG16 predictor3;
instance VGG16 predictor4;
instance VGG16 predictor5;
instance VGG16 predictor6;
instance Calculator cal;
connect image1 -> predictor1.image;
connect image2 -> predictor2.image;
connect image3 -> predictor3.image;
connect image4 -> predictor4.image;
connect image5 -> predictor5.image;
connect image6 -> predictor6.image;
connect predictor1.predictions -> cal.in1_1;
connect predictor2.predictions -> cal.in1_2;
connect predictor3.predictions -> cal.in1_3;
connect predictor4.predictions -> cal.in2_1;
connect predictor5.predictions -> cal.in2_2;
connect predictor6.predictions -> cal.in2_3;
connect cal.out1 -> res;
}
configuration VGG16{
num_epoch:1
batch_size:64
normalize:true
load_checkpoint:false
optimizer:adam{
learning_rate:0.01
learning_rate_decay:0.8
step_size:1000
weight_decay: 0.01
}
}
package cNNCalculator;
component VGG16{
ports in Q(0:1)^{1, 28, 28} image,
out Q(0:1)^{10} predictions;
implementation CNN {
def conv(filter, channels){
Convolution(kernel=(filter,filter), channels=channels) ->
Relu()
}
def fc(){
FullyConnected(units=100) ->
Relu() ->
Dropout(p=0.5)
}
image ->
conv(filter=2, channels=64, ->=2) ->
Pooling(pool_type="max", kernel=(2,2), stride=(1,1)) ->
fc() ->
FullyConnected(units=100) ->
Softmax() ->
predictions
}
}
cNNCalculator.VGG16 data/vGG16
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