J-3TO's picture
Pix2Pix detector-gap inpainting: weights and model card
a0de01d verified
|
Raw History Blame Contribute Delete
2.61 kB
---
license: gpl-3.0
library_name: pytorch
pipeline_tag: image-to-image
tags:
- image-inpainting
- x-ray
- computed-tomography
- detector-gaps
- pix2pix
- gan
---
# detectorGapRemoval_Pix2Pix
A Pix2Pix generator that fills the gaps between the modules of tiled X-ray detectors, in
projections and in sinograms. The network refines a linear interpolation of the gaps and leaves
all valid pixels unchanged.
Code, an inference notebook and the training script: **https://github.com/J-3TO/detectorGapRemoval_Pix2Pix**
## Files
| file | content | use |
|---|---|---|
| `pix2pix_projections_sinograms_generator.pth` | generator weights (69 MB) | inference |
| `pix2pix_projections_sinograms_full.pth` | generator + discriminator weights (80 MB) | continuing training (starts with fresh optimizers) |
## Usage
```python
# pip install "git+https://github.com/J-3TO/detectorGapRemoval_Pix2Pix"
from gap_pix2pix import inpaint, load_generator, pilatus3_2m_gap_mask
generator = load_generator("hf", device="cuda") # downloads the generator weights
filled = inpaint(projections, pilatus3_2m_gap_mask(), generator) # (N, H, W) or (H, W)
```
A complete example on simulated data: `inference_example.ipynb` in the GitHub repository.
Continue training from these weights in a clone of the GitHub repository: set the data paths
(the data format is described in its README) and `init_weights: hf:pix2pix_projections_sinograms_full.pth`
in `config.yml`, then run `python3 train.py --config config.yml`.
**Input:** flat-field corrected images and a gap mask made of complete rows and columns. The
per-image normalization and the linear pre-interpolation are done by `inpaint`.
## Training
Trained on projections and sinograms of a lab nano-CT with a DECTRIS Pilatus3 2M detector, plus
ImageNet validation images, with synthetic gaps of 7–40 pixels in 256 × 128 patches. Loss:
adversarial (PatchGAN) + MSE + gap-mean loss + Earth Mover's Distance between soft histograms of
the gap intensities. The released checkpoint (epoch 1199 of the last training stage) was selected
by the total validation loss. Details: see the GitHub repository.
## Limitations
Trained on data of one detector type and one setup; the behaviour on other detectors, geometries
and photon statistics has not been tested.
## License
The model weights are licensed under the
[GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.html), the same licence as
the code on GitHub. If you use them, please cite the paper below.
## Citation
If you use this model, please cite:
TODO: add the reference of the paper.