Alexnet.cnna 1.51 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

5
6
7
8
9
10
11
12
13

    unroll<t=5> beamSearchStart (width=5, max_length=50){
        FullyConnected(units=4096) ->
        Relu() ->
        Dropout()
    }



Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
14
    def split1(i){
15
16
17
        [i] ->
        Convolution(kernel=(5,5), channels=128) ->
        Lrn(nsize=5, alpha=0.0001, beta=0.75) ->
18
        Pooling(pool_type="max", kernel=(3,3), stride=(2,2), padding="no_loss") ->
19
20
        Relu()
    }
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
21
    def split2(i){
22
23
        [i] ->
        Convolution(kernel=(3,3), channels=192) ->
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
24
        Relu() ->
25
        Convolution(kernel=(3,3), channels=128) ->
26
        Pooling(pool_type="max", kernel=(3,3), stride=(2,2), padding="no_loss") ->
27
        Relu()
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
28
29
30
31
32
33
    }
    def fc(){
        FullyConnected(units=4096) ->
        Relu() ->
        Dropout()
    }
34

35
36
37



38
    data ->
39
    Convolution(kernel=(11,11), channels=96, stride=(4,4), padding="no_loss") ->
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
40
    Lrn(nsize=5, alpha=0.0001, beta=0.75) ->
41
    Pooling(pool_type="max", kernel=(3,3), stride=(2,2), padding="no_loss") ->
42
43
44
45
46
    unroll<t> BeamSearchStart (width=5, max_length=50){
        FullyConnected(units=4096) ->
        Relu() ->
        Dropout()
    } ->
47
48
    Relu() ->
    Split(n=2) ->
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
49
    split1(i=[0|1]) ->
50
51
52
53
    Concatenate() ->
    Convolution(kernel=(3,3), channels=384) ->
    Relu() ->
    Split(n=2) ->
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
54
    split2(i=[0|1]) ->
55
    Concatenate() ->
56
    FullyConnected(units=10) ->
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
57
    Softmax() ->
58
    predictions;
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
59
}