Alexnet.cnna 1.19 KB
Newer Older
1
architecture Alexnet{
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    def input Z(0:255)^{H,W,C} image
    def output Q(0:1)^{NUM_CLASSES} predictions

    def test(){
        Convolution(kernel=filter, channels=3^(2*2)/2, stride=4+3*7, no_bias=(6==2*3), no_bias=((3,3)==(3,3)))
    }
    def conv(filter, channels, hasPool=true, convStride=1){
        Convolution(kernel=filter, channels=channels, stride=convStride) ->
        Relu() ->
        MaxPooling(kernel=(3,3), stride=2, _if=hasPool)
    }
    def fc(){
        FullyConnected(units=4096) ->
        Relu() ->
        Dropout()
    }
    def split1(i, groups){
        Split(index=i, n=groups) ->
        conv(filter=(5,5), channels=128) ->
        Lrn(nsize=5, alpha=0.0001, beta=0.75)
    }
    def split2(i, groups){
        Split(index=i, n=groups) ->
        conv(filter=(3,3), channels=192, hasPool=false) ->
        conv(filter=(3,3), channels=128)
    }
28
29

    image ->
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
    conv(filter=(11,11), channels=96, convStride=4) ->
    Lrn(nsize=5, alpha=0.0001, beta=0.75) ->

    split1(i=[0|1], groups=2) ->

    conv(filter=(3,3), channels=384 ,hasPool=false) ->

    split2(i=[0|1], groups=2) ->

    fc(_for=[1->2]) ->
    FullyConnected(units=NUM_CLASSES) ->
    Softmax() ->
    predictions
}