Featureextraction.emadl 963 Bytes
Newer Older
Svetlana's avatar
Svetlana committed
1 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 28 29 30 31 32 33 34
package dp;

component Featureextraction {
    ports
        in Z(0:255)^{3, 210, 280} imageIn,
        out Q(0:1)^{13,1,1} affordanceOut;

    implementation CNN {

        def conv(kernel, channels, hasPool=true, convStride=(1,1)){
            Convolution(kernel=kernel, channels=channels, stride=convStride) ->
            Relu() ->
            Pooling(pool_type="max", kernel=(3,3), stride=(2,2), ?=hasPool)
        }
        def fc(){
            FullyConnected(units=4096) ->
            Relu() ->
            Dropout()
        }

        imageIn ->
        conv(kernel=(11,11), channels=96, convStride=(4,4)) ->
        conv(kernel=(5,5), channels=256, convStride=(4,4)) ->
        conv(kernel=(3,3), channels=384, hasPool=false) ->
        conv(kernel=(3,3), channels=384, hasPool=false) ->
        conv(kernel=(3,3), channels=256) ->
        fc() ->
        fc() ->
        FullyConnected(units=13) ->
        Sigmoid() ->
        affordanceOut

    }
}