Cloud and Fog removal System using Generative Adversarial Networks - Satellite Image Processing代码运行

论文名称使用生成对抗网络从卫星图像中去除云和雾

代码地址https://github.com/Akash-Ramjyothi/Cloud-and-Fog-removal-System-using-Generative-Adversarial-Networks-Satellite-Image-Processing

摘要 先进的地球观测卫星产生源源不断的数据。这些数据集在生态系统研究中有广泛的应用,如植被健康监测、水质、灾害监测和一系列其他领域。在地球观测卫星中,多光谱遥感数据在过去几十年中得到了广泛应用,并将继续成为科学界地球观测数据集的核心。由于云和雾,多光谱遥感数据受到环境影响,因此大部分数据变得不可用。因此,能够使用高级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)

  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值