Alexnet.cnna 1.25 KB
Newer Older
1
architecture Alexnet(img_height=224, img_width=224, img_channels=3, classes=10){
2
    def input Z(0:255)^{img_channels, img_height, img_width} data
3
    def output Q(0:1)^{classes} predictions
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
4

Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
5
    def split1(i){
6
7
8
        [i] ->
        Convolution(kernel=(5,5), channels=128) ->
        Lrn(nsize=5, alpha=0.0001, beta=0.75) ->
9
        Pooling(pool_type="max", kernel=(3,3), stride=(2,2), padding="no_loss") ->
10
11
        Relu()
    }
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
12
    def split2(i){
13
14
        [i] ->
        Convolution(kernel=(3,3), channels=192) ->
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
15
        Relu() ->
16
        Convolution(kernel=(3,3), channels=128) ->
17
        Pooling(pool_type="max", kernel=(3,3), stride=(2,2), padding="no_loss") ->
18
        Relu()
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
19
20
21
22
23
24
    }
    def fc(){
        FullyConnected(units=4096) ->
        Relu() ->
        Dropout()
    }
25

26
    data ->
27
    Convolution(kernel=(11,11), channels=96, stride=(4,4), padding="no_loss") ->
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
28
    Lrn(nsize=5, alpha=0.0001, beta=0.75) ->
29
    Pooling(pool_type="max", kernel=(3,3), stride=(2,2), padding="no_loss") ->
30
31
    Relu() ->
    Split(n=2) ->
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
32
    split1(i=[0|1]) ->
33
34
35
36
    Concatenate() ->
    Convolution(kernel=(3,3), channels=384) ->
    Relu() ->
    Split(n=2) ->
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
37
    split2(i=[0|1]) ->
38
    Concatenate() ->
39
    fc(->=2) ->
40
    FullyConnected(units=10) ->
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
41
    Softmax() ->
42
    predictions
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
43
}