car_stop_model.py 文件源码

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

项目:BDD_Driving_Model 作者: gy20073 项目源码 文件源码
def course_speed_to_joint_bin(labels):
    # each of the labels[i, :] is the course and speed
    # convert each pair to the corresponding bin location
    course, speed = course_speed_to_discrete(labels)

    n = FLAGS.discretize_n_bins
    l = len(course)

    # follow the convention of speed first and speed second
    out = np.zeros((l, n, n), dtype=np.float32)

    for i, item in enumerate(zip(course, speed)):
        ci, si = item
        out[i, ci, si] = 1.0

        # do the gaussian smoothing
        out[i, :, :] = gaussian_filter(out[i, :, :],
                        sigma=FLAGS.discretize_label_gaussian_sigma,
                        mode='constant', cval=0.0)
    # renormalization of the distribution
    out = out / np.sum(out, axis=(1,2), keepdims=True)

    out = np.reshape(out, [l, n*n])
    return out
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号