在Python中与池进行多处理,并返回的变量
我正在使用一些Python脚本来处理图像。图像在500x500或4000x4000像素之间。脚本在每个像素上进行迭代,因此它们很耗时,因此我设置了多处理器功能。我找不到任何文档。.因此,如果我将脚本迭代遍及池。映射一个像素在一个时间高度上,它会将尺寸附加到返回的数组中。我通常会有一个返回的数组高度,宽度,颜色通道#,但是MP功能将返回列表,而不是高度,高度,宽度,颜色通道#,每次迭代的额外通道。好的..所以,孩子的过程将他们的数据放入自己的记忆空间中,这很好..但是细节到底是什么?我找不到,我应该在堆栈上拿最后一个数字吗?采用一个现在的高度,0:高度,0:宽度,0:通道计数,并将其重塑为我会照常会得到的数组大小?还是第一个?我找不到此信息
I'm using some python scripts to process images. An image is some between 500x500 or 4000x4000 pixels. The scripts do iterations over every pixel, so they're time consuming, so I set up the multiprocessor function. There's something I can't find any documentation on.. so, if I have the script iterate through with Pool.map one pixel at a time height-wise, it appends a dimension to the returned array. I would usually have a returned array height, width, # of color channels, but the mp functions would return a list instead of an array that is height, height, width, # of color channels, 1 extra channel for every iteration. OK.. so the child processes put their data into their own slice of memory space, which is fine.. but what exactly are the details? I can't find it, should I just take the last number on the stack? take an array that is now height, 0:height, 0:width, 0:channel count, and reshape it to the array size I would have gotten as usual? Or is it the 1st one? I can't find this information
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论