File size: 1,925 Bytes
2d13ae1
b6f81ed
2d13ae1
15e00ad
 
e186b89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
license: cc-by-4.0
---
Github: https://github.com/kqwang/Phase_unwrapping_by_U-Net

# Deep learning phase unwrapping with a U-Net
A demonstrate of ["Deep learning spatial phase unwrapping: a comparative review"](https://doi.org/10.1117/1.APN.1.1.014001) and ["One-step robust deep learning phase unwrapping"](https://doi.org/10.1364/OE.27.015100).


## Preparation
1. [Install CUDA](https://developer.nvidia.com/cuda-downloads)

2. [Install PyTorch](https://pytorch.org/get-started/locally/)

3. Install dependencies
```bash
pip install -r requirements.txt
```

## Datasets
Download dataset (without noise) from [here](https://figshare.com/s/685e972475221aa3b4c4) to the current path and unzip. The file structure is the following:
```
train_in
└── 000001.mat
...
└── 020000.mat
train_gt
└── 000001.mat
...
└── 020000.mat
test_in
└── 000001.mat
...
└── 002000.mat
test_gt
└── 000001.mat
...
└── 000421.mat
test_in_real
└── 000001.mat
...
└── 000421.mat
test_gt_real
└── 000001.mat
...
└── 000421.mat
```

Of course, datasets _train_in_, _train_gt_, _test_in_ and _test_gt_ can also be obtained by running _dataset_generation.m_ with MATLAB , whose parameters can be adjusted according to actual needs. (The size range of the noise can be controlled by adjusting the parameter _noise_max_.)

## Network traning
Run _main_train.py_ to start training the neural network.
```sh
python main_train.py
```
After training, two files (loss and others.csv and weights.pth) will be saved in the folder model_weights

## Network testing
Run _main_test.py_ to do some test.
```sh
python main_test.py
```

## Error statistics
Run _error_evaluation.m_ with MATLAB to calculate RMSEs for each test result.

## More informarion
Details about the code and dataset can be found in this [paper](https://doi.org/10.1117/1.APN.1.1.014001) and its Supplementary Materials.