论文名称使用生成对抗网络从卫星图像中去除云和雾
摘要 先进的地球观测卫星产生源源不断的数据。这些数据集在生态系统研究中有广泛的应用,如植被健康监测、水质、灾害监测和一系列其他领域。在地球观测卫星中,多光谱遥感数据在过去几十年中得到了广泛应用,并将继续成为科学界地球观测数据集的核心。由于云和雾,多光谱遥感数据受到环境影响,因此大部分数据变得不可用。因此,能够使用高级AI/ML技术从这些数据中去除这些环境杂质以产生不间断的数据流是非常有价值的。在这里,我们演示了如何使用生成对抗网络(GAN)从Landsat多光谱数据中去除雾和云,以重新生成和填补不间断卫星数据的空白。
1环境配置
运行train过程中,缺少哪个包就pip安装。
2数据集
在data/RICE_DATASET路径下,按照RICE1、2文件中的提示,把数据放入。这个是通过索引文件txt中文件名称进行调用,数据都放在一起。可能需要根据生成你已经有的影像生成txt文件。
import os
def generate_txt_from_png(folder_path, output_file):
# 获取文件夹中的所有文件名
files = os.listdir(folder_path)
# 过滤出所有的 PNG 文件
png_files = [file for file in files if file.endswith('.png')]
# 将文件名写入 txt 文件
with open(output_file, 'w') as f:
for png_file in png_files:
f.write(png_file + '\n')
# 使用示例
folder_path = r'F:\Cloud-removal-model-collection-main\data\RICE1\test\cloud' # 替换为你文件夹的路径
output_file = r'F:\Cloud-removal-model-collection-main\data\RICE1\train\test.txt' # 替换为你想要生成的 txt 文件名
generate_txt_from_png(folder_path, output_file)
3模型运行
运行train.ty文件,
报错1 无法调用
File "E:\qymx\Cloud-and-Fog-removal-System-using-Generative-Adversarial-Networks-Satellite-Image-Processing-master\train.py", line 21, in <module>
from eval import test
File "E:\qymx\Cloud-and-Fog-removal-System-using-Generative-Adversarial-Networks-Satellite-Image-Processing-master\eval.py", line 2, in <module>
from skimage.measure import compare_ssim as SSIM
ImportError: cannot import name 'compare_ssim' from 'skimage.measure' (D:\an\anaconda\envs\inpaint2\lib\site-packages\skimage\measure\__init__.py)
使用conda命令conda install scikit-image
安装的是最新版本的scikit-image,其中的调用方式发生变化。
将代码,修改为
from skimage.metrics import structural_similarity as SSIM
进行正常训练
有报错了
raise ValueError(
ValueError: Since image dtype is floating point, you must specify the data_range parameter. Please read the documentation carefully (including the note). It is recommended that you always specify the data_range anyway.
在代码,加入数据的范围,
ssim = SSIM(img1, img2, data_range=255)