从fit图像构建数据集的有效方法

问题描述 投票:1回答:1

我有一套适合的图像:大约32000张图像的分辨率(256,256)。我要构建的数据集是矩阵状的,因此输出形状为(32000,256 * 256)。

简单的解决方案是for循环,类似于:

#file_names is a list of paths
samples=[]
for file_name in file_names:
    hdu=pyfits.open(file_name)
    samples.append(hdu[0].data.flatten())
    hdu.close()
#then i can use numpy.concatenate to have a numpy ndarray

这个解决方案非常非常慢。那么构建如此庞大的数据集的最佳解决方案是什么?

python python-3.x dataset pyfits
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.