Source code for Fixed-Point GAN for Cloud Detection

Related tags

Deep Learning fcd
Overview

FCD: Fixed-Point GAN for Cloud Detection

PyTorch source code of Nyborg & Assent (2020).

Abstract

The detection of clouds in satellite images is an essential preprocessing task for big data in remote sensing. Convolutional neural networks (CNNs) have greatly advanced the state-of-the-art in the detection of clouds in satellite images, but existing CNN-based methods are costly as they require large amounts of training images with expensive pixel-level cloud labels. To alleviate this cost, we propose Fixed-Point GAN for Cloud Detection (FCD), a weakly-supervised approach. Training with only image-level labels, we learn fixed-point translation between clear and cloudy images, so only clouds are affected during translation. Doing so enables our approach to predict pixel-level cloud labels by translating satellite images to clear ones and setting a threshold to the difference between the two images. Moreover, we propose FCD+, where we exploit the label-noise robustness of CNNs to refine the prediction of FCD, leading to further improvements. We demonstrate the effectiveness of our approach on the Landsat-8 Biome cloud detection dataset, where we obtain performance close to existing fully-supervised methods that train with expensive pixel-level labels. By fine-tuning our FCD+ with just 1% of the available pixel-level labels, we match the performance of fully-supervised methods.

Dependencies

To setup a conda environment named fcd with all dependencies installed, run

conda env create -f environment.yml
conda activate fcd

This will install the following packages:

tqdm
opencv-python
rasterio
tifffile
pillow
matplotlib
pytorch
torchvision
cudatoolkit
tensorboard
albumentations
sklearn
segmentation-models-pytorch

Usage

To download the full Landsat-8 Biome dataset (96 Landsat-8 scenes, about 182 GB when extracted), run

python download_landsat8_biome.py

To prepare 128x128 patches with image-level labels for training, run

python prepare_landsat8_biome.py 

Train FCD

To train Fixed-Point GAN for Cloud Detection (FCD), run

python main.py --mode train --dataset L8Biome --image_size 128 --batch_size 16 --experiment_name FCD

You can monitor the training progress by starting TensorBoard for the runs dir:

tensorboard --logdir=runs

Train FCD+

When FCD is trained, we can generate pixel-level cloud masks for the training dataset by running

python main.py --mode generate_masks --batch_size 64 --experiment_name FCD

This will generate cloud masks for the Landsat-8 scenes in the training dataset, and save them in outputs/FCD/results/tifs. Then, to divide these cloud masks into the corresponding patches for training, we can run

python prepare_landsat8_biome.py --generated_masks outputs/FCD/results/tifs

resulting in a generated_mask.tif in addition to the ground truth mask.tif for every training patch.

Then, to train FCD+ with generated_mask.tif as targets, run

python supervised_main.py --mode train --batch_size 64 --train_mask_file generated_mask.tif \
                          --classifier_head True --experiment_name FCD+

Finally, to fine-tune the resulting model on 1% of actual pixel-wise ground truth, run

python supervised_main.py --mode train --batch_size 64 --keep_ratio 0.01 --lr 1e-5 --freeze_encoder True \
                          --model_weights outputs/FCDPlus/models/best.pt \
                          --experiment_name FCD+1Pct 

Train models compared with in paper

See the bash scripts in the scripts folder for the exact runs done in the paper.

Citation

If you find our work useful for your research, please site our paper:

TODO citation info here

Acknowledgements

This repository is based on mahfuzmohammad/Fixed-Point-GAN and yunjey/stargan.

You might also like...
Weakly Supervised 3D Object Detection from Point Cloud with Only Image Level Annotation

SCCKTIM Weakly Supervised 3D Object Detection from Point Cloud with Only Image-Level Annotation Our code will be available soon. The class knowledge t

PointRCNN: 3D Object Proposal Generation and Detection from Point Cloud, CVPR 2019.
PointRCNN: 3D Object Proposal Generation and Detection from Point Cloud, CVPR 2019.

PointRCNN PointRCNN: 3D Object Proposal Generation and Detection from Point Cloud Code release for the paper PointRCNN:3D Object Proposal Generation a

FuseDream: Training-Free Text-to-Image Generationwith Improved CLIP+GAN Space OptimizationFuseDream: Training-Free Text-to-Image Generationwith Improved CLIP+GAN Space Optimization
FuseDream: Training-Free Text-to-Image Generationwith Improved CLIP+GAN Space OptimizationFuseDream: Training-Free Text-to-Image Generationwith Improved CLIP+GAN Space Optimization

FuseDream This repo contains code for our paper (paper link): FuseDream: Training-Free Text-to-Image Generation with Improved CLIP+GAN Space Optimizat

DR-GAN: Automatic Radial Distortion Rectification Using Conditional GAN in Real-Time
DR-GAN: Automatic Radial Distortion Rectification Using Conditional GAN in Real-Time

DR-GAN: Automatic Radial Distortion Rectification Using Conditional GAN in Real-Time Introduction This is official implementation for DR-GAN (IEEE TCS

Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context Code in both PyTorch and TensorFlow

Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context This repository contains the code in both PyTorch and TensorFlow for our paper

Code for
Code for "PV-RAFT: Point-Voxel Correlation Fields for Scene Flow Estimation of Point Clouds", CVPR 2021

PV-RAFT This repository contains the PyTorch implementation for paper "PV-RAFT: Point-Voxel Correlation Fields for Scene Flow Estimation of Point Clou

Official Code for ICML 2021 paper
Official Code for ICML 2021 paper "Revisiting Point Cloud Shape Classification with a Simple and Effective Baseline"

Revisiting Point Cloud Shape Classification with a Simple and Effective Baseline Ankit Goyal, Hei Law, Bowei Liu, Alejandro Newell, Jia Deng Internati

Code for paper
Code for paper "ASAP-Net: Attention and Structure Aware Point Cloud Sequence Segmentation"

ASAP-Net This project implements ASAP-Net of paper ASAP-Net: Attention and Structure Aware Point Cloud Sequence Segmentation (BMVC2020). Overview We i

Code for "FPS-Net: A convolutional fusion network for large-scale LiDAR point cloud segmentation".

FPS-Net Code for "FPS-Net: A convolutional fusion network for large-scale LiDAR point cloud segmentation", accepted by ISPRS journal of Photogrammetry

Comments
  • 'generate_masks' is not an option for training

    'generate_masks' is not an option for training

    Hi! I read your paper and found it very interesting! . I am pursuing my master thesis in the field of cloud detection. I am trying to setup the code here and following the steps you have mentioned. I have run the second step : python fcd_main.py --mode train --dataset L8Biome --image_size 128 --batch_size 16 --experiment_name FCD

    Now, I want to move to the next step: python fcd_main.py --mode generate_masks --batch_size 64 --experiment_name FCD

    When the run this command, The get the below error:

    fcd_main.py: error: argument --mode: invalid choice: 'generate_masks' (choose from 'train', 'test', 'visualize')

    I could not find generate_masks anywhere in the code base except for the Readme. Please let me know how to proceed.

    opened by NakitaOza 2
  • Generated Masks

    Generated Masks

    Hi again!

    When I run the step 3 python fcd_main.py --mode test --batch_size 64 --experiment_name FCD , it calls the function make_pseudo_masks. Assuming save=True, in outputs/FCD/results/fcd_pseudo_masks we have a list of .tiff files with names like patch_2689.tiff. After this step when I run step 4 python prepare_landsat8_biome.py --generated_masks outputs/FCD/results/fcd_pseudo_masks, the code fails saying :

    FileNotFoundError: [Errno 2] No such file or directory: ..... results/fcd_pseudo_masks/Barren_LC80420082013220LGN00_mask.tif

    I am not sure how this works actually. From what I understand, step3 makes pseudo patches. I am not sure how step4 uses this information. I have no file named : Barren_LC80420082013220LGN00_mask.tif anywhere in my code. My data folder has the below structure:

    • data /
      • test /
      • thumbnail /
      • train /
        • clear /
          • patch_0 /
            • image.tif
            • maks.tif
          • patch_1 / . .
        • cloudy /
          • patch_2689 /
            • image.tif
            • maks.tif
          • patch_2690 / . .
      • val /
      • assignment.txt
    opened by NakitaOza 1
Owner
Joachim Nyborg
PhD student at the Department of Computer Science, Aarhus University
Joachim Nyborg
[ICLR 2022 Oral] F8Net: Fixed-Point 8-bit Only Multiplication for Network Quantization

F8Net Fixed-Point 8-bit Only Multiplication for Network Quantization (ICLR 2022 Oral) OpenReview | arXiv | PDF | Model Zoo | BibTex PyTorch implementa

Snap Research 76 Dec 13, 2022
Style-based Point Generator with Adversarial Rendering for Point Cloud Completion (CVPR 2021)

Style-based Point Generator with Adversarial Rendering for Point Cloud Completion (CVPR 2021) An efficient PyTorch library for Point Cloud Completion.

Microsoft 119 Jan 2, 2023
Implementation of the "PSTNet: Point Spatio-Temporal Convolution on Point Cloud Sequences" paper.

PSTNet: Point Spatio-Temporal Convolution on Point Cloud Sequences Introduction Point cloud sequences are irregular and unordered in the spatial dimen

Hehe Fan 63 Dec 9, 2022
Implementation of the "Point 4D Transformer Networks for Spatio-Temporal Modeling in Point Cloud Videos" paper.

Point 4D Transformer Networks for Spatio-Temporal Modeling in Point Cloud Videos Introduction Point cloud videos exhibit irregularities and lack of or

Hehe Fan 101 Dec 29, 2022
Synthetic LiDAR sequential point cloud dataset with point-wise annotations

SynLiDAR dataset: Learning From Synthetic LiDAR Sequential Point Cloud This is official repository of the SynLiDAR dataset. For technical details, ple

null 78 Dec 27, 2022
[ICCV 2021 Oral] SnowflakeNet: Point Cloud Completion by Snowflake Point Deconvolution with Skip-Transformer

This repository contains the source code for the paper SnowflakeNet: Point Cloud Completion by Snowflake Point Deconvolution with Skip-Transformer (ICCV 2021 Oral). The project page is here.

AllenXiang 65 Dec 26, 2022
A list of papers about point cloud based place recognition, also known as loop closure detection in SLAM (processing)

A list of papers about point cloud based place recognition, also known as loop closure detection in SLAM (processing)

Xin Kong 17 May 16, 2021
Investigating Attention Mechanism in 3D Point Cloud Object Detection (arXiv 2021)

Investigating Attention Mechanism in 3D Point Cloud Object Detection (arXiv 2021) This repository is for the following paper: "Investigating Attention

null 52 Nov 19, 2022
Part-Aware Data Augmentation for 3D Object Detection in Point Cloud

Part-Aware Data Augmentation for 3D Object Detection in Point Cloud This repository contains a reference implementation of our Part-Aware Data Augment

Jaeseok Choi 62 Jan 3, 2023
3D cascade RCNN for object detection on point cloud

3D Cascade RCNN This is the implementation of 3D Cascade RCNN: High Quality Object Detection in Point Clouds. We designed a 3D object detection model

Qi Cai 22 Dec 2, 2022