Alexnet.cnna 1.14 KB
Newer Older
1
architecture Alexnet{
2
    def input Z(0:255)^{h=224,w=224,c=3} image
3
    def output Q(0:1)^{classes=10} predictions
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
4

5
6
7
8
    def group1(i){
        [i] ->
        Convolution(kernel=(5,5), channels=128) ->
        Lrn(nsize=5, alpha=0.0001, beta=0.75) ->
9
        MaxPooling(kernel=(3,3), stride=(2,2), padding="no_loss") ->
10
11
12
13
14
        Relu()
    }
    def group2(i){
        [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
        MaxPooling(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

    image ->
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
    MaxPooling(kernel=(3,3), stride=(2,2), padding="no_loss") ->
30
31
32
33
34
35
36
37
38
    Relu() ->
    Split(n=2) ->
    group1(i=[0|1]) ->
    Concatenate() ->
    Convolution(kernel=(3,3), channels=384) ->
    Relu() ->
    Split(n=2) ->
    group2(i=[0|1]) ->
    Concatenate() ->
39
    fc(->=2) ->
40
    FullyConnected(units=classes) ->
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
41
42
43
    Softmax() ->
    predictions
}