|
| 1 | +# Noise2Noise |
| 2 | + |
| 3 | +#### Title |
| 4 | +[Noise2Noise: Learning Image Restoration without Clean Data](https://arxiv.org/abs/1803.04189) |
| 5 | + |
| 6 | +#### Abstract |
| 7 | +We apply basic statistical reasoning to signal reconstruction by machine learning -- learning to map corrupted observations to clean signals -- with a simple and powerful conclusion: it is possible to learn to restore images by only looking at corrupted examples, at performance at and sometimes exceeding training using clean data, without explicit image priors or likelihood models of the corruption. In practice, we show that a single model learns photographic noise removal, denoising synthetic Monte Carlo images, and reconstruction of undersampled MRI scans -- all corrupted by different processes -- based on noisy data only. |
| 8 | + |
| 9 | + |
| 10 | +## Data Generation |
| 11 | +* Before running Train phase, execute **run_make_database.py** to generate dataset. |
| 12 | + |
| 13 | +## Train |
| 14 | + $ python main.py --mode train \ |
| 15 | + --scope [scope name] \ |
| 16 | + --name_data [data name] \ |
| 17 | + --dir_data [data directory] \ |
| 18 | + --dir_log [log directory] \ |
| 19 | + --dir_checkpoint [checkpoint directory] |
| 20 | + --gpu_ids [gpu id; '-1': no gpu, '0, 1, ..., N-1': gpus] |
| 21 | +--- |
| 22 | + $ python main.py --mode train \ |
| 23 | + --scope unet \ |
| 24 | + --name_data em \ |
| 25 | + --dir_data ./datasets \ |
| 26 | + --dir_log ./log \ |
| 27 | + --dir_checkpoint ./checkpoint |
| 28 | + --gpu_ids 0 |
| 29 | + |
| 30 | +* Set **[scope name]** uniquely. |
| 31 | +* To understand hierarchy of directories based on their arguments, see **directories structure** below. |
| 32 | +* Hyperparameters were written to **arg.txt** under the **[log directory]**. |
| 33 | + |
| 34 | + |
| 35 | +## Test |
| 36 | + $ python main.py --mode test \ |
| 37 | + --scope [scope name] \ |
| 38 | + --name_data [data name] \ |
| 39 | + --dir_data [data directory] \ |
| 40 | + --dir_log [log directory] \ |
| 41 | + --dir_checkpoint [checkpoint directory] \ |
| 42 | + --dir_result [result directory] |
| 43 | + --gpu_ids [gpu id; '-1': no gpu, '0, 1, ..., N-1': gpus] |
| 44 | +--- |
| 45 | + $ python main.py --mode test \ |
| 46 | + --scope unet \ |
| 47 | + --name_data em \ |
| 48 | + --dir_data ./datasets \ |
| 49 | + --dir_log ./log \ |
| 50 | + --dir_checkpoint ./checkpoints \ |
| 51 | + --dir_result ./results |
| 52 | + --gpu_ids 0 |
| 53 | + |
| 54 | +* To test using trained network, set **[scope name]** defined in the **train** phase. |
| 55 | +* Generated images are saved in the **images** subfolder along with **[result directory]** folder. |
| 56 | +* **index.html** is also generated to display the generated images. |
| 57 | + |
| 58 | + |
| 59 | +## Tensorboard |
| 60 | + $ tensorboard --logdir [log directory]/[scope name]/[data name] \ |
| 61 | + --port [(optional) 4 digit port number] |
| 62 | +--- |
| 63 | + $ tensorboard --logdir ./log/unet/em \ |
| 64 | + --port 6006 |
| 65 | + |
| 66 | +After the above comment executes, go **http://localhost:6006** |
| 67 | + |
| 68 | +* You can change **[(optional) 4 digit port number]**. |
| 69 | +* Default 4 digit port number is **6006**. |
| 70 | + |
| 71 | + |
| 72 | +## Results |
| 73 | + |
| 74 | + |
| 75 | + 1st row: input; serial section Transmission Electron Microscopy (ssTEM) |
| 76 | + 2nd row: label; sementation map |
| 77 | + 3rd row: output; predection map by unet |
| 78 | + |
| 79 | +* The results were generated by a network trained with **em** dataset during **300 epochs**. |
| 80 | +* After running the Test phase, execute **display_result.py** to display the figure. |
| 81 | + |
| 82 | +## Directories structure |
| 83 | + pytorch-UNET |
| 84 | + +---[dir_checkpoint] |
| 85 | + | \---[scope] |
| 86 | + | \---[name_data] |
| 87 | + | +---model_epoch00000.pth |
| 88 | + | | ... |
| 89 | + | \---model_epoch12345.pth |
| 90 | + +---[dir_data] |
| 91 | + | \---[name_data] |
| 92 | + | +---test |
| 93 | + | | +---00000.npy |
| 94 | + | | | ... |
| 95 | + | | \---12345.npy |
| 96 | + | +---train |
| 97 | + | | +---00000.npy |
| 98 | + | | | ... |
| 99 | + | | \---12345.npy |
| 100 | + | \---val |
| 101 | + | +---00000.npy |
| 102 | + | | ... |
| 103 | + | \---12345.npy |
| 104 | + +---[dir_log] |
| 105 | + | \---[scope] |
| 106 | + | \---[name_data] |
| 107 | + | +---arg.txt |
| 108 | + | \---events.out.tfevents |
| 109 | + \---[dir_result] |
| 110 | + \---[scope] |
| 111 | + \---[name_data] |
| 112 | + +---images |
| 113 | + | +---00000-input.png |
| 114 | + | +---00000-label.png |
| 115 | + | +---00000-output.png |
| 116 | + | | ... |
| 117 | + | +---12345-input.png |
| 118 | + | +---12345-label.png |
| 119 | + | +---12345-output.png |
| 120 | + \---index.html |
| 121 | + |
| 122 | +--- |
| 123 | + |
| 124 | + pytorch-UNET |
| 125 | + +---checkpoints |
| 126 | + | \---unet |
| 127 | + | \---em |
| 128 | + | +---model_epoch0000.pth |
| 129 | + | | ... |
| 130 | + | \---model_epoch0300.pth |
| 131 | + +---datasets |
| 132 | + | \---em |
| 133 | + | +---test |
| 134 | + | | +---0.npy |
| 135 | + | | | ... |
| 136 | + | | \---4.npy |
| 137 | + | +---train |
| 138 | + | | +---0.npy |
| 139 | + | | | ... |
| 140 | + | | \---29.npy |
| 141 | + | \---val |
| 142 | + | +---0.npy |
| 143 | + | | ... |
| 144 | + | \---4.npy |
| 145 | + +---log |
| 146 | + | \---unet |
| 147 | + | \---em |
| 148 | + | +---arg.txt |
| 149 | + | \---events.out.tfevents |
| 150 | + \---results |
| 151 | + \---unet |
| 152 | + \---em |
| 153 | + +---images |
| 154 | + | +---0000-input.png |
| 155 | + | +---0000-label.png |
| 156 | + | +---0000-output.png |
| 157 | + | | ... |
| 158 | + | +---0004-input.png |
| 159 | + | +---0004-label.png |
| 160 | + | +---0004-output.png |
| 161 | + \---index.html |
| 162 | + |
| 163 | +* Above directory is created by setting arguments when **main.py** is executed. |
0 commit comments