Skip to content

Commit

Permalink
da in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
RParedesPalacios committed Nov 29, 2019
1 parent 7619a2e commit b72e902
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
9 changes: 2 additions & 7 deletions examples/NN/2_CIFAR10/2_cifar_conv_da.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,8 @@ int main(int argc, char **argv){
layer l=in;

// Data augmentation
// l = ShiftRandom(l, {-0.2f, +0.2f}, {-0.2f, +0.2f});
// l = RotateRandom(l, {-30.0f, +30.0f});
// l = ScaleRandom(l, {0.85f, 2.0f});
// l = FlipRandom(l, 1);
// l = CropRandom(l, {28, 28});
// l = CropScaleRandom(l, {0.f, 1.0f});
// l = CutoutRandom(l, {0.0f, 0.3f}, {0.0f, 0.3f});
l = CropScaleRandom(l, {0.8f, 1.0f});
l = Flip(l,1);

l=MaxPool(ReLu(Conv(l,32,{3,3},{1,1})),{2,2});
l=MaxPool(ReLu(Conv(l,64,{3,3},{1,1})),{2,2});
Expand Down
8 changes: 6 additions & 2 deletions examples/NN/2_CIFAR10/4_cifar_vgg16_bn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ layer Block1(layer l,int filters) {
}
layer Block3_2(layer l,int filters) {
l=ReLu(BatchNormalization(Conv(l,filters,{3,3},{1,1})));
l=BatchNormalization(ReLu(Conv(l,filters,{3,3},{1,1})));
l=ReLu(BatchNormalization(Conv(l,filters,{3,3},{1,1})));
return l;
}

Expand All @@ -46,6 +46,10 @@ int main(int argc, char **argv){
layer in=Input({3,32,32});
layer l=in;

// Data augmentation
l = CropScaleRandom(l, {0.8f, 1.0f});
l = Flip(l,1);

l=MaxPool(Block3_2(l,64));
l=MaxPool(Block3_2(l,128));
l=MaxPool(Block1(Block3_2(l,256),256));
Expand All @@ -71,7 +75,7 @@ int main(int argc, char **argv){
);

// plot the model
plot(net,"model.pdf");
plot(net,"model.pdf","TB"); //Top Bottom plot

// get some info from the network
summary(net);
Expand Down
5 changes: 2 additions & 3 deletions examples/NN/2_CIFAR10/6_cifar_resnet_da_bn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ int main(int argc, char **argv){
layer l=in;

// Data augmentation
l = FlipRandom(l, 1);
l = ShiftRandom(l, {-0.2f, +0.2f}, {-0.2f, +0.2f});
l = ScaleRandom(l, {0.9f, 1.1f});
l = CropScaleRandom(l, {0.8f, 1.0f});
l = Flip(l,1);

// Resnet-18
l=ReLu(BG(Conv(l,64,{3,3},{1,1})));
Expand Down
5 changes: 2 additions & 3 deletions examples/NN/2_CIFAR10/7_cifar_resnet50_da_bn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ int main(int argc, char **argv){
layer l=in;

// Data augmentation
l = FlipRandom(l, 1);
l = ShiftRandom(l, {-0.1f, +0.1f}, {-0.1f, +0.1f});
l = ScaleRandom(l, {0.9f, 1.1f});
l = CropScaleRandom(l, {0.8f, 1.0f});
l = Flip(l,1);

// Resnet-50
l=ReLu(BG(Conv(l,64,{3,3},{1,1})));
Expand Down

0 comments on commit b72e902

Please sign in to comment.