signature.py 文件源码

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

项目:lstm_handwriting 作者: shubh24 项目源码 文件源码
def get_pearson_coeff(similar_stroke):
    stroke1 = similar_stroke[0]
    stroke2 = similar_stroke[1]
    min_len = min(len(stroke1), len(stroke2))
    sx1 = [stroke1[i][0] for i in range(0, min_len)]
    sx2 = [stroke2[i][0] for i in range(0, min_len)]
    sy1 = [stroke1[i][1] for i in range(0, min_len)]
    sy2 = [stroke2[i][1] for i in range(0, min_len)]

    x_pearson = pearsonr(sx1, sy1)[0] 
    y_pearson = pearsonr(sy1, sy2)[0]

    if x_pearson > 0.5 or y_pearson > 0.5:
        print similar_stroke[2], similar_stroke[3]
        print x_pearson, y_pearson
        plt.plot(sx1, label = "Stroke 1 X Co-ordinate")
        plt.plot(sx2, label = "Stroke 2 X Co-ordinate")
        plt.plot(sy1, label = "Stroke 1 Y Co-ordinate")
        plt.plot(sy2, label = "Stroke 2 Y Co-ordinate")
        plt.legend(ncol= 2, fancybox=True)
        plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号