首页 文章

用于python强化学习的模拟和可视化库?

提问于
浏览
0

我知道keras,阻止nn的其他几个Python库,其中包括RL . 但是有一个库可以使可视化的任务变得容易吗?在代理/环境的3D模型方面,看模拟等......我可以在网上看到一些RL视频,显示模拟的代理/环境,但要么他们从头开始制作视觉模型,要么使用其他语言/技术......(或者他们很老)

2 回答

  • 3

    您可能对OpenAI GymMuJoCo感兴趣的3D环境模拟/可视化 .

  • 3

    一般来说,这是3D可视化库和3D科学可视化库之间的差异,它具有比先前更多的可视化方法(直接调用散点图,曲面等) .

    由于您没有指定要绘制的实际示例,因此我只能提供被认为简单的可行库(考虑到Python的3D lib世界) .

    一个是VPython,其中有very explicit syntax towards 3D primitives . This将是用于构建球体和框的有效代码:

    from visual import *
    ball = sphere(pos=(-5,0,0), radius=0.5, color=color.cyan)
    wallR = box(pos=(6,0,0), size=(0.2,12,12), color=color.green)
    

    如果您的模拟依赖于非常明确定义的对象,如图像,曲面,散点等,您可能需要查看matplotlib的3D功能:

    import numpy as np
    from mpl_toolkits.mplot3d import Axes3D
    import matplotlib.pyplot as plt
    
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    xs = np.random.randint(0,100,100)
    ys = np.random.randint(0,100,100)
    zs = np.random.randint(0,100,100)
    ax.scatter(xs, ys, zs, c=c)
    plt.show()
    

    另外Mayavi有很多高级别的电话来熟悉情节(但我认为在日期'm writing this is still not available in Python 3, someone correct me if I'错了):

    import numpy
    from mayavi.mlab import *
    
    def test_surf():
        """Test surf on regularly spaced co-ordinates like MayaVi."""
        def f(x, y):
            sin, cos = numpy.sin, numpy.cos
            return sin(x + y) + sin(2 * x - y) + cos(3 * x + 4 * y)
    
        x, y = numpy.mgrid[-7.:7.05:0.1, -5.:5.05:0.05]
        s = surf(x, y, f)
        #cs = contour_surf(x, y, f, contour_z=0)
        return s
    

    Mayavi本身基于VTK,它也有一个Python API . 其他相关的图书馆是:

    • pyQtGraph:非常好,如果你想在PySide或PyQt中嵌入你的可视化(2D和3D) .

    • Glumpy

    • Vispy:我希望这个图书馆有很棒的东西 . 如果记忆没有让我失望它是由带来使用pyQtGraph,Glumpy和Galry等库的人们制作的 .

    • Galry

    还有其他像OpenSceneGraphOpenGLCoin3D的绑定,但许多都记录不完整,或者学习曲线非常艰难 .

    作为额外的你可能还想考虑Blender,因为你可以在里面使用Python,它有一个非常丰富的3D建模环境 .

相关问题