{"id":27923308,"url":"https://github.com/sccanright/varifocal_pix2pix","last_synced_at":"2026-04-29T15:39:13.160Z","repository":{"id":291208771,"uuid":"976921295","full_name":"sccanright/varifocal_pix2pix","owner":"sccanright","description":"Binocular imaging system using EDoF and varifocal lenses with a modified Pix2Pix model to generate synthetic focal stacks.","archived":false,"fork":false,"pushed_at":"2025-05-04T23:56:56.000Z","size":7930,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-06T22:37:51.590Z","etag":null,"topics":["computer-vision","deep-learning","edof","focal-stack","generative-adversarial-network","image-generation","image-processing","pix2pix","python3","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sccanright.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-03T02:43:56.000Z","updated_at":"2025-05-04T23:56:59.000Z","dependencies_parsed_at":"2025-05-05T00:25:55.263Z","dependency_job_id":null,"html_url":"https://github.com/sccanright/varifocal_pix2pix","commit_stats":null,"previous_names":["sccanright/binocular-pix2pix-study","sccanright/varifocal_pix2pix"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sccanright/varifocal_pix2pix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sccanright%2Fvarifocal_pix2pix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sccanright%2Fvarifocal_pix2pix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sccanright%2Fvarifocal_pix2pix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sccanright%2Fvarifocal_pix2pix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sccanright","download_url":"https://codeload.github.com/sccanright/varifocal_pix2pix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sccanright%2Fvarifocal_pix2pix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32432649,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","deep-learning","edof","focal-stack","generative-adversarial-network","image-generation","image-processing","pix2pix","python3","pytorch"],"created_at":"2025-05-06T22:30:58.651Z","updated_at":"2026-04-29T15:39:13.144Z","avatar_url":"https://github.com/sccanright.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EdoF and Varifocal Camera Pix2Pix Model\n\n## Overview\n\nThis repository contains the code, models, and supporting materials for a research project using a modified Pix2Pix model to synthesize depth-aware focal stacks from a single image input. The system uses a binocular (dual-camera) setup: with an EDoF (Extended Depth of Field) lens and a varifocal camera to generate depth-variant imagery. This project builds on the original [pytorch-CycleGAN-and-pix2pix](https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix) model, extending it for generating varifocal image stacks from a single EDoF input.\n\n## Example Results:\nPresented and discussed in greater detail in the research paper:  \n**ADD PAPER AND SUPPLEMENT HERE**  \n\nData is presented as: EDoF image | Generated images | Ground truth images  \n\n \n- 512x512 Model Results\n  ![512slice_supplement](https://github.com/user-attachments/assets/c9c0e727-c447-4e9e-89a0-e993dec5239d)\n\n- 1024x1024 Model Results\n  ![1024slice_supplement](https://github.com/user-attachments/assets/8f408938-c8fc-4466-a78d-0acd02b005c9)\n\n- No Slice Model Results\n  ![noslice_supplement](https://github.com/user-attachments/assets/4099cac7-156a-4b19-bbd0-424b89ecc72a)\n\n\n---\n\n## Getting Started\n### Installation\n\n- Create and activate virtual environment:\n\n```bash\nconda create --name pix2pix python=3.9\nconda activate pix2pix\n```\n\n- Install dependencies via:\n  - requirements.txt\n\nOr:\n\n```bash\nconda install torch\nconda install torchvision\npip install dominate\npip install visdom\npip install wandb\n```\n\n- Clone this repo:\n\n```bash\ngit clone https://github.com/sccanright/varifocal_pix2pix\ncd varifocal_pix2pix\n```\n\n### Download a pretrained model\n- Pre-trained models are available for download and unzipping\n  - release: [models](https://github.com/sccanright/varifocal_pix2pix/releases/tag/models)\n    - Make sure it is saved within the varifocal_pix2pix folder\n\n```bash\n# Download the checkpoints model release:\nwget https://github.com/sccanright/varifocal_pix2pix/releases/download/models/checkpoints.zip -O checkpoints.zip\n\n# Unzip the checkpoints.zip file\nunzip checkpoints.zip\n\n# Remove the checkpoints.zip file after extraction\nrm checkpoints.zip\n``` \n\n### Test any of the trained models\n- Test datasets are available for download and unzipping\n  - release: [data](https://github.com/sccanright/varifocal_pix2pix/releases/tag/data)\n    - Make sure they are saved within the varifocal_pix2pix/datasets folder\n\n- Download and unzip the test sets to ./datasets:\n\n```bash\n# Download zipped folders\nwget https://github.com/sccanright/varifocal_pix2pix/releases/download/data/512_SLICED_FIELDSET.zip -O datasets/512_SLICED_FIELDSET.zip\nwget https://github.com/sccanright/varifocal_pix2pix/releases/download/data/1024_SLICED_FIELDSET.zip -O datasets/1024_SLICED_FIELDSET.zip\nwget https://github.com/sccanright/varifocal_pix2pix/releases/download/data/NO_SLICE_FIELDSET.zip -O datasets/NO_SLICE_FIELDSET.zip\n\n# Unzip to the correct folder\nunzip datasets/512_SLICED_FIELDSET.zip -d datasets/\nunzip datasets/1024_SLICED_FIELDSET.zip -d datasets/\nunzip datasets/NO_SLICE_FIELDSET.zip -d datasets/\n\n# Remove the .zip files after extraction\nrm datasets/512_SLICED_FIELDSET.zip\nrm datasets/1024_SLICED_FIELDSET.zip\nrm datasets/NO_SLICE_FIELDSET.zip\n```\n\n- Run the tests:\n  - !! Only run one model at a time !!\n \n```bash\n# Testing trained models\npython test.py --dataroot ./datasets/512_SLICED_FIELDSET --name 512slicedata01 --model pix2pix --gpu_ids 0 --netG unet_512 --input_nc 3 --output_nc 30\n\npython test.py --dataroot ./datasets/1024_SLICED_FIELDSET --name 1024slicedata01 --model pix2pix --gpu_ids 0 --netG unet_1024 --input_nc 3 --output_nc 30\n\npython test.py --dataroot ./datasets/NO_SLICE_FIELDSET --name noslicedata01 --model pix2pix --gpu_ids 0 --netG unet_1024 --input_nc 3 --output_nc 30\n```\n\n- Locate results:\n  - ./results/NAME/test_latest\n\n### Training your models\n\n- Train a new model:\n(Update netG and input/output channels as needed)\n```bash\npython train.py --dataroot ./datasets/FIELDSET --name NAMEofMODEL --model pix2pix --gpu_ids 0 --netG unet_1024 --input_nc 3 --output_nc 30\n```\n\n## Prerequisites\n- Linux, macOS, or Windows with WSL\n- Python 3.8+\n- CPU or NVIDIA GPU + CUDA CuDNN\n\n## Citation\nIf you use this code in your research, please cite both this repository and the original Pix2Pix project:\n\n```bash\n@misc{canright2025varifocalpix2pix,\n  author = {Slater Canright},\n  title = {varifocal Camera Pix2Pix Model},\n  year = {2025},\n  url = {https://github.com/sccanright/varifocal_pix2pix}\n}\n\n@inproceedings{isola2017image,\n  title={Image-to-image translation with conditional adversarial networks},\n  author={Isola, Phillip and Zhu, Jun-Yan and Zhou, Tinghui and Efros, Alexei A},\n  booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},\n  pages={1125--1134},\n  year={2017}\n}\n```\n\n## New Code\n- ButtonCapture.py\n- crop.py\n- slice.py\n- reorganize_data.py\n- analyze.py\n\n## Optional Files\n### Qualitative optimization code\n- exposure_test.py\n- GPIOTest.py\n- GPIOZeroTest.py\n\n### SolidWorks CAD files\n- Camera Box\n- Box Lid\n- EDoF Holder\n- EDoF Lid\n- Lens Mount - Left\n- Lens Mount - Right\n\n### Download Optionals\n- SolidWorks and extra code\n  - [extras](https://github.com/sccanright/varifocal_pix2pix/tree/extras)\n\n```bash\n# Clone just the extras branch directly:\ngit clone --branch extras --single-branch https://github.com/sccanright/varifocal_pix2pix\n```\n  \n\n## Related Projects\n\n- [pytorch-CycleGAN-and-pix2pix](https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix) | [px2pix](https://github.com/phillipi/pix2pix)\n\n## Acknowledgments\n\nOur code comes directly from [pytorch-CycleGAN-and-pix2pix](https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix), with slight script modifications to function with our expanded data requirements.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsccanright%2Fvarifocal_pix2pix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsccanright%2Fvarifocal_pix2pix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsccanright%2Fvarifocal_pix2pix/lists"}