def _run_icp(self, cloud_source, ego_motion, cloud_target): transform, residual = icp(cloud_source, ego_motion, cloud_target) logging.info('Running ICP:') logging.info('ego_motion: %s\n%s', ego_motion, ego_motion.eval()) logging.info('transform: %s\n%s', transform, transform.eval()) logging.info('residual: %s\n%s', residual, residual[0, :PRINT_CAP, :].eval()) return transform, residual
def inference(source, target): """Builds model.""" ego_motion = tf.Variable(tf.zeros([6]), name='ego_motion') res_height = tf.Variable(tf.fill([1], 0.0), name='res_height') tf.summary.scalar('tx', ego_motion[0]) tf.summary.scalar('ty', ego_motion[1]) tf.summary.scalar('tz', ego_motion[2]) tf.summary.scalar('rx', ego_motion[3]) tf.summary.scalar('ry', ego_motion[4]) tf.summary.scalar('rz', ego_motion[5]) tf.summary.scalar('res_height', res_height[0]) dist_to_center = tf.norm((source - RES_CENTER)[:, :, :2], axis=2, keep_dims=True) res = tf.maximum(RES_RADIUS - dist_to_center, 0.0) / RES_RADIUS res *= res_height res = tf.concat([tf.zeros_like(res), tf.zeros_like(res), res], axis=2) shifted_source = source + res ego_motion = tf.stack([ego_motion] * FLAGS.batch_size) transform, residual = icp(shifted_source, ego_motion, target) return transform, residual