Commit 39a29b31 authored by emanueledalsasso's avatar emanueledalsasso
Browse files

added testing code

parent 8cf0935d
%% 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:
# As if by magic: self-supervised training of despeckling networks with MERLIN
## Emanuele Dalsasso, Loïc Denis, Florence Tupin
Please note that the training set is only composed of **TerraSAR-X** SAR images **acquired in starring SPOTLIGHT mode**, thus this testing code is specific to this data.
%% 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:
``` python
from google_drive_downloader import GoogleDriveDownloader as gdd
gdd.download_file_from_google_drive(file_id='1vX5prgHxeBTfoiBewpdxBDXCKF4qfcFt',
dest_path='./MERLIN-TSX-spotlight-test.zip',
unzip=True)
```
%% 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 **TerraSAR-X Spotlight** images in **Single-Look Complex (SLC)** format can be found in the folder _/content/MERLIN-TSX-spotlight-test/test_data/_
To test on custom data, upload your SLC images in a numpy array with shape [ydim, xdim, 2] (where [:,:,0] contains the **real part** and [:,:,1] contains the **imaginary part**) in the folder _/content/MERLIN-TSX-spotlight-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/MERLIN-TSX-spotlight-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/MERLIN-TSX-spotlight-test/main.py --stride_size=32
```
%% 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:
# As if by magic: self-supervised training of despeckling networks with MERLIN
## Emanuele Dalsasso, Loïc Denis, Florence Tupin
Please note that the training set is only composed of **TerraSAR-X** SAR images **acquired in STRIPMAP mode**, thus this testing code is specific to this data.
%% 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:
``` python
from google_drive_downloader import GoogleDriveDownloader as gdd
gdd.download_file_from_google_drive(file_id='18rqSlsIWIYsxawUL1Df7p0GbLEbUyN0l',
dest_path='./MERLIN-TSX-stripmap-test.zip',
unzip=True)
```
%% 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 **TerraSAR-X Stripmap** images in **Single-Look Complex (SLC)** format can be found in the folder _/content/MERLIN-TSX-stripmap-test/test_data/_
To test on custom data, upload your SLC images in a numpy array with shape [ydim, xdim, 2] (where [:,:,0] contains the **real part** and [:,:,1] contains the **imaginary part**) in the folder _/content/MERLIN-TSX-stripmap-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/MERLIN-TSX-stripmap-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/MERLIN-TSX-stripmap-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