pytorch Pix2Pix image-to-image arxiv:1611.07004 license:mit region:us
---
library_name: pytorch
license: mit
pipeline_tag: image-to-image
tags:
- Pix2Pix
---

# Pix2Pix SAR To RGB

`yuulind/pix2pix-sar2rgb`

- This is a Pix2Pix CGAN implementation for translating Synthetic Aperture Radar (SAR) images to Optical (RGB) images. 
- For more information on code, please check [GitHub Repo](https://github.com/yuuIind/SAR2Optical)
- The demo: [yuulind/sar2rgb](https://huggingface.co/spaces/yuulind/sar2rgb)
- Includes checkpoints from epoch: 180, 265, 295
- Example outputs
  ![Example outputs](imgs/model_results.png)

## Model Details

### Model Description

<!-- Provide a longer summary of what this model is. -->

This is custom implementation of pix2pix architecture in PyTorch. The code can found in [GitHub Repo](https://github.com/yuuIind/SAR2Optical)

The official lua implementaion: [GitHub Repo](https://github.com/phillipi/pix2pix)
The official PyTorch implementation [GitHub Repo](https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix)

- **Model type:** Image to Image Translation
- **BASELINE FID SCORE** is between **30 and 40**
- Baseline score is calculated by randomly sampling two sets from real images and comparing the them.

| Number | Name                    | Model Type    | Description                                                                       | Link to Model File                                                                                       |
|--------|-------------------------|---------------|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| 1      | pix2pix_gen_180.pth     | Generator     | Pix2Pix generator with transpose convolution, 180 epochs. **FID score is 185.04** | [pix2pix_gen_180.pth](https://huggingface.co/yuulind/pix2pix-sar2rgb/resolve/main/pix2pix_gen_180.pth)   |
| 2      | pix2pix_gen_265.pth     | Generator     | Pix2Pix generator with transpose convolution, 265 epochs. **FID score is 189.81** | [pix2pix_gen_265.pth](https://huggingface.co/yuulind/pix2pix-sar2rgb/resolve/main/pix2pix_gen_265.pth)   |
| 3      | pix2pix_gen_295.pth     | Generator     | Pix2Pix generator with transpose convolution, 295 epochs. **FID score is 187.73** | [pix2pix_gen_295.pth](https://huggingface.co/yuulind/pix2pix-sar2rgb/resolve/main/pix2pix_gen_295.pth)   |
| 4      | pix2pix_disc_180.pth    | Discriminator | Pix2Pix discriminator from epoch 180, with transpose convolution generator.       | [pix2pix_disc_180.pth](https://huggingface.co/yuulind/pix2pix-sar2rgb/resolve/main/pix2pix_disc_180.pth) |
| 5      | pix2pix_disc_265.pth    | Discriminator | Pix2Pix discriminator from epoch 265, with transpose convolution generator.       | [pix2pix_disc_265.pth](https://huggingface.co/yuulind/pix2pix-sar2rgb/resolve/main/pix2pix_disc_265.pth) |
| 6      | pix2pix_disc_295.pth    | Discriminator | Pix2Pix discriminator from epoch 295, with transpose convolution generator.       | [pix2pix_disc_295.pth](https://huggingface.co/yuulind/pix2pix-sar2rgb/resolve/main/pix2pix_disc_295.pth) |


**Loss Graphs**
- Discriminator vs Epoch
  ![Discriminator](imgs/lossD.jpeg)
- Generator Overall Loss vs Epoch
  ![Generator Overall Loss](imgs/lossG.jpeg)
- Generator GAN Loss vs Epoch
  ![Generator GAN Loss](imgs/lossG_GAN.jpeg)
- Generator L1 Loss vs Epoch
  ![Generator L1 Loss](imgs/lossG_L1.jpeg)
<!-- 
| 4      | pix2pix_gen_nn_150.pth  | Generator     | Pix2Pix generator with upsampling, followed by normal convolutions, 150 epochs. | [pix2pix_gen_nn_150.pth](https://huggingface.co/yuulind/pix2pix-sar2rgb/resolve/main/pix2pix_gen_nn_150.pth)     |
| 5      | pix2pix_gen_nn_300.pth  | Generator     | Pix2Pix generator with upsampling, followed by normal convolutions, 300 epochs. | [pix2pix_gen_nn_300.pth](https://huggingface.co/yuulind/pix2pix-sar2rgb/resolve/main/pix2pix_gen_nn_300.pth)     |
| 8      | pix2pix_disc_nn_150.pth | Discriminator | Pix2Pix discriminator from epoch 150, with upsampling generator.                | [pix2pix_disc_nn_150.pth](https://huggingface.co/yuulind/pix2pix-sar2rgb/resolve/main/pix2pix_disc_nn_150.pth)   |
| 9      | pix2pix_disc_nn_300.pth | Discriminator | Pix2Pix discriminator from epoch 300, with upsampling generator.                | [pix2pix_disc_nn_300.pth](https://huggingface.co/yuulind/pix2pix-sar2rgb/resolve/main/pix2pix_disc_nn_300.pth)   |
-->
### Model Sources

<!-- Provide the basic links for the model. -->

- **Repository:** [GitHub Repo](https://github.com/yuuIind/SAR2Optical)
- **Paper:** [arxiv:1611.07004](https://arxiv.org/abs/1611.07004)
- **Official implementation:** [GitHub Repo](https://github.com/phillipi/pix2pix)

## Uses

<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->

Converts SAR images to Optical (RGB) images