Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 更快的mathplot保存_Python_Matplotlib - Fatal编程技术网

Python 更快的mathplot保存

Python 更快的mathplot保存,python,matplotlib,Python,Matplotlib,我已尝试启动并运行“英特尔isl/MiDaS无监督深度估计”。这个模型很好,速度也很快,但是当我试图在mathplot中保存输出图像时,问题就出现了。保存图像所需的时间似乎呈线性增长。这是我用来保存输出的代码 plt.imshow(output) plt.axis('off') out = "/content/test_vid/new_model/%d.jpg" % number plt.savefig(out, bbox_inches='tight') 我还对它进行了计

我已尝试启动并运行“英特尔isl/MiDaS无监督深度估计”。这个模型很好,速度也很快,但是当我试图在mathplot中保存输出图像时,问题就出现了。保存图像所需的时间似乎呈线性增长。这是我用来保存输出的代码

plt.imshow(output)
plt.axis('off')

out = "/content/test_vid/new_model/%d.jpg" % number
plt.savefig(out, bbox_inches='tight')
我还对它进行了计时,得到了以下图表:

y轴是每次迭代的时间,单位为秒

x轴用于每个图像

我知道时间数组在增长,可能会减慢进程?但即使没有它,每次迭代也需要更长的时间

是否有其他方法保存图像

我读过mathplot,如果你对所有的绘图都使用同一个轴,速度应该会更快,但我没有,所以?(我保存图像)我有点迷路了。希望有人能帮忙

如果有人感兴趣,我已经链接了github代码-->链接: