def MYST_depth4_CCFF(ImWarp, STlayerN, dimShape, stddev, params):
    makeImageSummary("image", ImWarp, params)
    for l in range(STlayerN):
        with tf.name_scope("ST{0}".format(l)):
            [STconv1dim, STconv2dim] = dimShape
            STconv2fcDim = 6 * 6 * STconv2dim
            with tf.variable_scope("conv1"):
                weight, bias = createVariable([3, 3, 1, STconv1dim], stddev)
                STconv1 = tf.nn.conv2d(
                    ImWarp, weight, strides=[1, 1, 1, 1
                                             ], padding="VALID") + bias
                STrelu1 = tf.nn.relu(STconv1)
                STmaxpool1 = tf.nn.max_pool(STrelu1,
                                            ksize=[1, 2, 2, 1],
                                            strides=[1, 2, 2, 1],
                                            padding="VALID")
            with tf.variable_scope("conv2"):
                weight, bias = createVariable([4, 4, STconv1dim, STconv2dim],
                                              stddev)
                STconv2 = tf.nn.conv2d(
                    STmaxpool1, weight, strides=[1, 1, 1, 1
                                                 ], padding="VALID") + bias
                STrelu2 = tf.nn.relu(STconv2)
                STmaxpool2 = tf.nn.max_pool(STrelu2,
                                            ksize=[1, 2, 2, 1],
                                            strides=[1, 2, 2, 1],
                                            padding="VALID")
            STmaxpool2vec = tf.reshape(STmaxpool2, [-1, STconv2fcDim])
            with tf.variable_scope("fc4"):
                weight, bias = createVariable([STconv2fcDim, params.pDim], 0,
                                              True)
                STfc4 = tf.matmul(STmaxpool2vec, weight) + bias
            warpMtrx = warp.vec2mtrxBatch(STfc4, params)
            ImWarp = data.ImWarpIm(ImWarp, warpMtrx, params)
            makeImageSummary("imageST{0}".format(l), ImWarp, params)
Esempio n. 2
0
def ST_depth1_F(ImWarp, p, STlayerN, dimShape, stddev, params):
    makeImageSummary("image", ImWarp, params)
    for l in range(STlayerN):
        with tf.name_scope("ST{0}".format(l)):
            ImWarpVec = tf.reshape(ImWarp, [-1, params.H * params.W])
            with tf.variable_scope("fc1"):
                weight, bias = createVariable(
                    [params.H * params.W, params.pDim], 0, True)
                STfc1 = tf.matmul(ImWarpVec, weight) + bias
            warpMtrx = warp.vec2mtrxBatch(STfc1, params)
            ImWarp = data.ImWarpIm(ImWarp, warpMtrx, params)
            makeImageSummary("imageST{0}".format(l), ImWarp, params)
            p = warp.compose(p, STfc1, params)
    return ImWarp, p
Esempio n. 3
0
def ST_depth2_CF(ImWarp, p, STlayerN, dimShape, stddev, params):
    makeImageSummary("image", ImWarp, params)
    for l in range(STlayerN):
        with tf.name_scope("ST{0}".format(l)):
            [STconv1dim] = dimShape
            STconv1fcDim = (params.H - 8) * (params.W - 8) * STconv1dim
            with tf.variable_scope("conv1"):
                weight, bias = createVariable([9, 9, 1, STconv1dim], stddev)
                STconv1 = tf.nn.conv2d(
                    ImWarp, weight, strides=[1, 1, 1, 1
                                             ], padding="VALID") + bias
                STrelu1 = tf.nn.relu(STconv1)
            STrelu1vec = tf.reshape(STrelu1, [-1, STconv1fcDim])
            with tf.variable_scope("fc2"):
                weight, bias = createVariable([STconv1fcDim, params.pDim], 0,
                                              True)
                STfc2 = tf.matmul(STrelu1vec, weight) + bias
            warpMtrx = warp.vec2mtrxBatch(STfc2, params)
            ImWarp = data.ImWarpIm(ImWarp, warpMtrx, params)
            makeImageSummary("imageST{0}".format(l), ImWarp, params)
            p = warp.compose(p, STfc2, params)
    return ImWarp, p
Esempio n. 4
0
def STN(opt, ImWarp, p, STlayerN, dimShape, stddev):
    util.makeImageSummary("image", ImWarp, opt)
    for l in range(STlayerN):
        with tf.name_scope("ST{0}".format(l)):
            [STconv1dim, STconv2dim, STfc3dim] = dimShape
            STconv2fcDim = (opt.H - 12) // 2 * (opt.W - 12) // 2 * STconv2dim
            with tf.variable_scope("conv1"):
                weight, bias = createVariable([7, 7, 1, STconv1dim], stddev)
                STconv1 = tf.nn.conv2d(
                    ImWarp, weight, strides=[1, 1, 1, 1
                                             ], padding="VALID") + bias
                STrelu1 = tf.nn.relu(STconv1)
            with tf.variable_scope("conv2"):
                weight, bias = createVariable([7, 7, STconv1dim, STconv2dim],
                                              stddev)
                STconv2 = tf.nn.conv2d(
                    STrelu1, weight, strides=[1, 1, 1, 1
                                              ], padding="VALID") + bias
                STrelu2 = tf.nn.relu(STconv2)
                STmaxpool2 = tf.nn.max_pool(STrelu2,
                                            ksize=[1, 2, 2, 1],
                                            strides=[1, 2, 2, 1],
                                            padding="VALID")
            STmaxpool2vec = tf.reshape(STmaxpool2, [-1, STconv2fcDim])
            with tf.variable_scope("fc3"):
                weight, bias = createVariable([STconv2fcDim, STfc3dim], stddev)
                STfc3 = tf.matmul(STmaxpool2vec, weight) + bias
                STrelu3 = tf.nn.relu(STfc3)
            with tf.variable_scope("fc4"):
                weight, bias = createVariable([STfc3dim, opt.pDim], 0, True)
                STfc4 = tf.matmul(STrelu3, weight) + bias
            warpMtrx = warp.vec2mtrxBatch(STfc4, opt)
            ImWarp = data.ImWarpIm(ImWarp, warpMtrx, opt)
            util.makeImageSummary("imageST{0}".format(l), ImWarp, opt)
            p = warp.compose(p, STfc4, opt)
    return ImWarp, p