Alexnet.cnna 1.13 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
9
10
11
12
13
14
    def group1(i){
        [i] ->
        Convolution(kernel=(5,5), channels=128) ->
        Lrn(nsize=5, alpha=0.0001, beta=0.75) ->
        MaxPooling(kernel=(3,3), stride=(2,2), padding="valid") ->
        Relu()
    }
    def group2(i){
        [i] ->
        Convolution(kernel=(3,3), channels=192) ->
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
15
        Relu() ->
16
17
18
        Convolution(kernel=(3,3), channels=128) ->
        MaxPooling(kernel=(3,3), stride=(2,2), padding="valid") ->
        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="valid") ->
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
28
    Lrn(nsize=5, alpha=0.0001, beta=0.75) ->
29
30
31
32
33
34
35
36
37
38
    MaxPooling(kernel=(3,3), stride=(2,2), padding="valid") ->
    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
}