Define net spec for simple conv-pool-deconv pattern common to all coordinate mapping tests.
(ks=3, stride=1, pad=0, pool=2, dstride=2, dpad=0)
| 10 | |
| 11 | |
| 12 | def coord_net_spec(ks=3, stride=1, pad=0, pool=2, dstride=2, dpad=0): |
| 13 | """ |
| 14 | Define net spec for simple conv-pool-deconv pattern common to all |
| 15 | coordinate mapping tests. |
| 16 | """ |
| 17 | n = caffe.NetSpec() |
| 18 | n.data = L.Input(shape=dict(dim=[2, 1, 100, 100])) |
| 19 | n.aux = L.Input(shape=dict(dim=[2, 1, 20, 20])) |
| 20 | n.conv = L.Convolution( |
| 21 | n.data, num_output=10, kernel_size=ks, stride=stride, pad=pad) |
| 22 | n.pool = L.Pooling( |
| 23 | n.conv, pool=P.Pooling.MAX, kernel_size=pool, stride=pool, pad=0) |
| 24 | # for upsampling kernel size is 2x stride |
| 25 | try: |
| 26 | deconv_ks = [s*2 for s in dstride] |
| 27 | except: |
| 28 | deconv_ks = dstride*2 |
| 29 | n.deconv = L.Deconvolution( |
| 30 | n.pool, num_output=10, kernel_size=deconv_ks, stride=dstride, pad=dpad) |
| 31 | return n |
| 32 | |
| 33 | |
| 34 | class TestCoordMap(unittest.TestCase): |
no outgoing calls
no test coverage detected