Commit ca3c7833 authored by Emanuele Dalsasso's avatar Emanuele Dalsasso
Browse files

Update normalization function to avoid -inf when applying the log on GRD

parent 4cc1eb76
%% Cell type:markdown id: tags:
**[Download the notebook](https://gitlab.telecom-paris.fr/ring/sar2sar/-/raw/master/SAR2SAR_GRD_test.ipynb?inline=false) and then import it under Google Colab**
<a href="https://colab.research.google.com/" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
%% Cell type:markdown id: tags:
# SAR2SAR: a self-supervised despeckling algorithm for SAR images
## Emanuele Dalsasso, Loïc Denis, Florence Tupin
Please note that the training set is only composed of **GRD** SAR images, thus this testing code is specific to this data.
%% Cell type:markdown id: tags:
## Resources
- [Paper (ArXiv)](https://arxiv.org/abs/2006.15037)
To cite the article:
@article{dalsasso2020sar2sar,
title={{SAR2SAR}: a self-supervised despeckling algorithm for {SAR} images},
author={Emanuele Dalsasso and Loïc Denis and Florence Tupin},
journal={arXiv preprint arXiv:2006.15037},
year={2020}
}
%% Cell type:markdown id: tags:
## 0. Enable GPU and save copy on Drive to enable editing
Runtime -> Change runtime type -> Hardware accelerator: GPU
File -> Save a copy in Drive
%% Cell type:markdown id: tags:
## 1. Download network weights and code
%% Cell type:code id: tags:
```
from google_drive_downloader import GoogleDriveDownloader as gdd
gdd.download_file_from_google_drive(file_id='1U8UT87k1AmiKhgE-fSkqSq5xmv32pOnu',
dest_path='./SAR2SAR-GRD-test.zip',
unzip=True)
``` python
!wget https://gitlab.telecom-paris.fr/ring/SAR2SAR/-/raw/master/network_weights/SAR2SAR-GRD-test.zip
!unzip /content/SAR2SAR-GRD-test.zip
```
%% Cell type:markdown id: tags:
## 2. Install compatible version of tensorflow
%% Cell type:code id: tags:
```
``` python
!pip uninstall -y tensorflow
```
%% Cell type:code id: tags:
```
``` python
!pip install tensorflow-gpu==1.13.1
```
%% Cell type:markdown id: tags:
## 3. Test on real data
Some **GRD** images in **amplitude** format can be found in the folder _/content/SAR2SAR-GRD-test/test_data/_
To test on custom data, upload your single channel GRD images in a numpy array with shape [ydim, xdim] in the folder _/content/SAR2SAR-GRD-test/test_data/_
Results are stored in _/content/test_
At each time a test is run, clean the _/content/test_ directory otherwise the results will be overwritten.
%% Cell type:code id: tags:
```
``` python
!python /content/SAR2SAR-GRD-test/main.py
```
%% Cell type:markdown id: tags:
When image dimension exeeds 256, the U-Net is scanned over the image with a default stride of 64 pixels. To change it to a custom value, run the cell below (here it is set to 32, allowing more quality at the cost of a greater runtime)
%% Cell type:code id: tags:
```
``` python
!python /content/SAR2SAR-GRD-test/main.py --stride_size=32
```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment