sketch_rnn.py 文件源码

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

项目:Pytorch-Sketch-RNN 作者: alexis-jacq 项目源码 文件源码
def make_image(sequence, epoch, name='_output_'):
    """plot drawing with separated strokes"""
    strokes = np.split(sequence, np.where(sequence[:,2]>0)[0]+1)
    fig = plt.figure()
    ax1 = fig.add_subplot(111)
    for s in strokes:
        plt.plot(s[:,0],-s[:,1])
    canvas = plt.get_current_fig_manager().canvas
    canvas.draw()
    pil_image = PIL.Image.frombytes('RGB', canvas.get_width_height(),
                 canvas.tostring_rgb())
    name = str(epoch)+name+'.jpg'
    pil_image.save(name,"JPEG")
    plt.close("all")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号