自行搭建的paddle环境种运行入门教程里的“识别数字”案例,一直打印<matplotlib.figure.figure at>无法显示图表
配置环境:Centos7,使用CPU运行代码模型 I1026 12:30:14.331498 3313 Util.cpp:166] commandline: --use_gpu=False --trainer_count=1 [INFO 2017-10-26 12:30:14,373 layers.py:2539] output for __conv_pool_0___conv: c = 20, h = 24, w = 24, size = 11520 [INFO 2017-10-26 12:30:14,377 layers.py:2667] output for __conv_pool_0___pool: c = 20, h = 12, w = 12, size = 2880 [INFO 2017-10-26 12:30:14,379 layers.py:2539] output for __conv_pool_1___conv: c = 50, h = 8, w = 8, size = 3200 [INFO 2017-10-26 12:30:14,381 layers.py:2667] output for __conv_pool_1___pool: c = 50, h = 4, w = 4, size = 800 I1026 12:30:14.454530 3313 GradientMachine.cpp:85] Initing parameters.. I1026 12:30:14.459592 3313 GradientMachine.cpp:92] Init parameters done. <matplotlib.figure.Figure at 0x6291a50> <matplotlib.figure.Figure at 0x6291a50> <matplotlib.figure.Figure at 0x6291a50> <matplotlib.figure.Figure at 0x6291a50> <matplotlib.figure.Figure at 0x6291a50>
@Ihuzb 你check一下matplotlib的backend是什么?如果是Agg的话,确实不会画出来,如果是在docker里面运行,那很有可能没有display
我又使用入门教程里的“新手入门”案例跑了一下,同样没有图表,提示: I1026 15:36:49.296114 3495 GradientMachine.cpp:92] Init parameters done. /usr/lib/python2.7/site-packages/paddle/v2/dataset/uci_housing.py:41: UserWarning: This call to matplotlib.use() has no effect because the backend has already been chosen; matplotlib.use() must be called before pylab, matplotlib.pyplot, or matplotlib.backends is imported for the first time.
The backend was originally set to u'TkAgg' by the following code:
File "c.py", line 39, in
matplotlib.use('Agg') <matplotlib.figure.Figure at 0x7633610> <matplotlib.figure.Figure at 0x7633610> <matplotlib.figure.Figure at 0x7633610> <matplotlib.figure.Figure at 0x7633610> <matplotlib.figure.Figure at 0x7633610> <matplotlib.figure.Figure at 0x7633610> <matplotlib.figure.Figure at 0x7633610> 请问是 因为matplotlib.use('Agg')的问题嘛?
嗯,如果是本地环境,不需要matplotlib.use('Agg')
抱歉,再麻烦您一下,请问需要在哪里进行设置呢?代码我都复制的教程里的,我在代码的头部加入 import matplotlib matplotlib.use('PS') 也没法修改。
我看你用的是uci_housing数据集,这个数据集会画图,而且设置了backend https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/v2/dataset/uci_housing.py#L41 你可以把uci_housing.py拷贝到你自己的目录,然后把相关的逻辑拿掉
好想是要在 jupyter的才会显示,你可以保存训练的cost,之后使用matplotlib再画出来就可以了 如:https://github.com/yeyupiaoling/TestImagesClassify/blob/master/code/ShowCost.py