{"id":20439436,"url":"https://github.com/atharvapathak/style_transfer_gan_project","last_synced_at":"2026-05-04T18:32:11.580Z","repository":{"id":196223123,"uuid":"695084792","full_name":"atharvapathak/Style_Transfer_GAN_Project","owner":"atharvapathak","description":"To ensure a better diagnosis of patients, doctors may need to look at multiple MRI scans. What if only one type of MRI needs to be done and others can be auto-generated? Generative Adversarial Networks (GANs) have been used for generating deepfakes, new fashion styles and high-resolution pictures from the low-resolution ones","archived":false,"fork":false,"pushed_at":"2023-09-23T01:14:45.000Z","size":11228,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-15T20:19:58.799Z","etag":null,"topics":["cyclegan","deep-learning","gans","generative-adversarial-network","keras","mri-images","photo","style-transfer","tensorflow","u-net"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atharvapathak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":["lengstrom"]}},"created_at":"2023-09-22T10:15:48.000Z","updated_at":"2023-09-22T10:59:54.000Z","dependencies_parsed_at":"2023-09-23T14:49:08.291Z","dependency_job_id":null,"html_url":"https://github.com/atharvapathak/Style_Transfer_GAN_Project","commit_stats":null,"previous_names":["atharvapathak/style_transfer_gan_project"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atharvapathak%2FStyle_Transfer_GAN_Project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atharvapathak%2FStyle_Transfer_GAN_Project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atharvapathak%2FStyle_Transfer_GAN_Project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atharvapathak%2FStyle_Transfer_GAN_Project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atharvapathak","download_url":"https://codeload.github.com/atharvapathak/Style_Transfer_GAN_Project/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241988360,"owners_count":20053653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cyclegan","deep-learning","gans","generative-adversarial-network","keras","mri-images","photo","style-transfer","tensorflow","u-net"],"created_at":"2024-11-15T09:17:22.326Z","updated_at":"2026-05-04T18:32:06.553Z","avatar_url":"https://github.com/atharvapathak.png","language":"Python","funding_links":["https://github.com/sponsors/lengstrom"],"categories":[],"sub_categories":[],"readme":"## Fast Style Transfer in [TensorFlow](https://github.com/tensorflow/tensorflow)\n\nAdd styles from famous paintings to any photo in a fraction of a second! [You can even style videos!](#video-stylization)\n\n\u003cp align = 'center'\u003e\n\u003cimg src = 'examples/style/udnie.jpg' height = '246px'\u003e\n\u003cimg src = 'examples/content/stata.jpg' height = '246px'\u003e\n\u003ca href = 'examples/results/stata_udnie.jpg'\u003e\u003cimg src = 'examples/results/stata_udnie_header.jpg' width = '627px'\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align = 'center'\u003e\nIt takes 100ms on a 2015 Titan X to style the MIT Stata Center (1024×680) like Udnie, by Francis Picabia.\n\u003c/p\u003e\n\nOur implementation is based off of a combination of Gatys' [A Neural Algorithm of Artistic Style](https://arxiv.org/abs/1508.06576), Johnson's [Perceptual Losses for Real-Time Style Transfer and Super-Resolution](http://cs.stanford.edu/people/jcjohns/eccv16/), and Ulyanov's [Instance Normalization](https://arxiv.org/abs/1607.08022). \n\n### Sponsorship\nPlease consider sponsoring my work on this project!\n\n## Video Stylization \nHere we transformed every frame in a video, then combined the results. [Click to go to the full demo on YouTube!](https://www.youtube.com/watch?v=xVJwwWQlQ1o) The style here is Udnie, as above.\n\u003cdiv align = 'center'\u003e\n     \u003ca href = 'https://www.youtube.com/watch?v=xVJwwWQlQ1o'\u003e\n        \u003cimg src = 'examples/results/fox_udnie.gif' alt = 'Stylized fox video. Click to go to YouTube!' width = '800px' height = '400px'\u003e\n     \u003c/a\u003e\n\u003c/div\u003e\n\nSee how to generate these videos [here](#stylizing-video)!\n\n## Image Stylization\nWe added styles from various paintings to a photo of Chicago. Click on thumbnails to see full applied style images.\n\u003cdiv align='center'\u003e\n\u003cimg src = 'examples/content/chicago.jpg' height=\"200px\"\u003e\n\u003c/div\u003e\n     \n\u003cdiv align = 'center'\u003e\n\u003ca href = 'examples/style/wave.jpg'\u003e\u003cimg src = 'examples/thumbs/wave.jpg' height = '200px'\u003e\u003c/a\u003e\n\u003cimg src = 'examples/results/chicago_wave.jpg' height = '200px'\u003e\n\u003cimg src = 'examples/results/chicago_udnie.jpg' height = '200px'\u003e\n\u003ca href = 'examples/style/udnie.jpg'\u003e\u003cimg src = 'examples/thumbs/udnie.jpg' height = '200px'\u003e\u003c/a\u003e\n\u003cbr\u003e\n\u003ca href = 'examples/style/rain_princess.jpg'\u003e\u003cimg src = 'examples/thumbs/rain_princess.jpg' height = '200px'\u003e\u003c/a\u003e\n\u003cimg src = 'examples/results/chicago_rain_princess.jpg' height = '200px'\u003e\n\u003cimg src = 'examples/results/chicago_la_muse.jpg' height = '200px'\u003e\n\u003ca href = 'examples/style/la_muse.jpg'\u003e\u003cimg src = 'examples/thumbs/la_muse.jpg' height = '200px'\u003e\u003c/a\u003e\n\n\u003cbr\u003e\n\u003ca href = 'examples/style/the_shipwreck_of_the_minotaur.jpg'\u003e\u003cimg src = 'examples/thumbs/the_shipwreck_of_the_minotaur.jpg' height = '200px'\u003e\u003c/a\u003e\n\u003cimg src = 'examples/results/chicago_wreck.jpg' height = '200px'\u003e\n\u003cimg src = 'examples/results/chicago_the_scream.jpg' height = '200px'\u003e\n\u003ca href = 'examples/style/the_scream.jpg'\u003e\u003cimg src = 'examples/thumbs/the_scream.jpg' height = '200px'\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n## Implementation Details\nOur implementation uses TensorFlow to train a fast style transfer network. We use roughly the same transformation network as described in Johnson, except that batch normalization is replaced with Ulyanov's instance normalization, and the scaling/offset of the output `tanh` layer is slightly different. We use a loss function close to the one described in Gatys, using VGG19 instead of VGG16 and typically using \"shallower\" layers than in Johnson's implementation (e.g. we use `relu1_1` rather than `relu1_2`). Empirically, this results in larger scale style features in transformations.\n## Virtual Environment Setup (Anaconda) - Windows/Linux\nTested on\n| Spec                        |                                                             |\n|-----------------------------|-------------------------------------------------------------|\n| Operating System            | Windows 10 Home                                             |\n| GPU                         | Nvidia GTX 2080 TI                                          |\n| CUDA Version                | 11.0                                                        |\n| Driver Version              | 445.75                                                      |\n### Step 1：Install Anaconda\nhttps://docs.anaconda.com/anaconda/install/\n### Step 2：Build a virtual environment\nRun the following commands in sequence in Anaconda Prompt:\n```\nconda create -n tf-gpu tensorflow-gpu=2.1.0\nconda activate tf-gpu\nconda install jupyterlab\njupyter lab\n```\nRun the following command in the notebook or just conda install the package:\n```\n!pip install moviepy==1.0.2\n```\nFollow the commands below to use fast-style-transfer\n## Documentation\n### Training Style Transfer Networks\nUse `style.py` to train a new style transfer network. Run `python style.py` to view all the possible parameters. Training takes 4-6 hours on a Maxwell Titan X. [More detailed documentation here](docs.md#stylepy). **Before you run this, you should run `setup.sh`**. Example usage:\n\n    python style.py --style path/to/style/img.jpg \\\n      --checkpoint-dir checkpoint/path \\\n      --test path/to/test/img.jpg \\\n      --test-dir path/to/test/dir \\\n      --content-weight 1.5e1 \\\n      --checkpoint-iterations 1000 \\\n      --batch-size 20\n\n### Evaluating Style Transfer Networks\nUse `evaluate.py` to evaluate a style transfer network. Run `python evaluate.py` to view all the possible parameters. Evaluation takes 100 ms per frame (when batch size is 1) on a Maxwell Titan X. [More detailed documentation here](docs.md#evaluatepy). Takes several seconds per frame on a CPU. **Models for evaluation are [located here](https://drive.google.com/drive/folders/0B9jhaT37ydSyRk9UX0wwX3BpMzQ?resourcekey=0-Z9LcNHC-BTB4feKwm4loXw\u0026usp=sharing)**. Example usage:\n\n    python evaluate.py --checkpoint path/to/style/model.ckpt \\\n      --in-path dir/of/test/imgs/ \\\n      --out-path dir/for/results/\n\n### Stylizing Video\nUse `transform_video.py` to transfer style into a video. Run `python transform_video.py` to view all the possible parameters. Requires `ffmpeg`. [More detailed documentation here](docs.md#transform_videopy). Example usage:\n\n    python transform_video.py --in-path path/to/input/vid.mp4 \\\n      --checkpoint path/to/style/model.ckpt \\\n      --out-path out/video.mp4 \\\n      --device /gpu:0 \\\n      --batch-size 4\n\n### Requirements\nYou will need the following to run the above:\n- TensorFlow 0.11.0\n- Python 2.7.9, Pillow 3.4.2, scipy 0.18.1, numpy 1.11.2\n- If you want to train (and don't want to wait for 4 months):\n  - A decent GPU\n  - All the required NVIDIA software to run TF on a GPU (cuda, etc)\n- ffmpeg 3.1.3 if you want to stylize video\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatharvapathak%2Fstyle_transfer_gan_project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatharvapathak%2Fstyle_transfer_gan_project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatharvapathak%2Fstyle_transfer_gan_project/lists"}