Augment.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:RFCN-tensorflow 作者: xdever 项目源码 文件源码
def mirror(image, boxes):
    def doMirror(image, boxes):
        image = tf.reverse(image, axis=[2])
        x0,y0,x1,y1 = tf.unstack(boxes, axis=1)

        w=tf.cast(tf.shape(image)[2], tf.float32)
        x0_m=w-x1
        x1_m=w-x0

        return image, tf.stack([x0_m,y0,x1_m,y1], axis=1)

    uniform_random = tf.random_uniform([], 0, 1.0)
    return tf.cond(uniform_random < 0.5, lambda: tf.tuple([image, boxes]), lambda: doMirror(image, boxes))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号