[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-9706":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":17,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":28,"readmeContent":29,"aiSummary":30,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":31,"discoverSource":32},9706,"fast-style-transfer","lengstrom\u002Ffast-style-transfer","lengstrom","TensorFlow CNN for fast style transfer ⚡🖥🎨🖼","",null,"Python",10963,2553,306,101,0,2,4,45,false,"master",true,[24,25,26,27],"deep-learning","neural-networks","neural-style","style-transfer","2026-06-12 02:02:11","## Fast Style Transfer in [TensorFlow](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow)\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'>\n\u003Cimg src = 'examples\u002Fstyle\u002Fudnie.jpg' height = '246px'>\n\u003Cimg src = 'examples\u002Fcontent\u002Fstata.jpg' height = '246px'>\n\u003Ca href = 'examples\u002Fresults\u002Fstata_udnie.jpg'>\u003Cimg src = 'examples\u002Fresults\u002Fstata_udnie_header.jpg' width = '627px'>\u003C\u002Fa>\n\u003C\u002Fp>\n\u003Cp align = 'center'>\nIt takes 100ms on a 2015 Titan X to style the MIT Stata Center (1024×680) like Udnie, by Francis Picabia.\n\u003C\u002Fp>\n\nOur implementation is based off of a combination of Gatys' [A Neural Algorithm of Artistic Style](https:\u002F\u002Farxiv.org\u002Fabs\u002F1508.06576), Johnson's [Perceptual Losses for Real-Time Style Transfer and Super-Resolution](http:\u002F\u002Fcs.stanford.edu\u002Fpeople\u002Fjcjohns\u002Feccv16\u002F), and Ulyanov's [Instance Normalization](https:\u002F\u002Farxiv.org\u002Fabs\u002F1607.08022). \n\n### Sponsorship\nPlease consider sponsoring my work on this project!\n\n### License\nCopyright (c) 2016 Logan Engstrom. Contact me for commercial use (or rather any use that is not academic research) (email: engstrom at my university's domain dot edu). Free for research use, as long as proper attribution is given and this copyright notice is retained.\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:\u002F\u002Fwww.youtube.com\u002Fwatch?v=xVJwwWQlQ1o) The style here is Udnie, as above.\n\u003Cdiv align = 'center'>\n     \u003Ca href = 'https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=xVJwwWQlQ1o'>\n        \u003Cimg src = 'examples\u002Fresults\u002Ffox_udnie.gif' alt = 'Stylized fox video. Click to go to YouTube!' width = '800px' height = '400px'>\n     \u003C\u002Fa>\n\u003C\u002Fdiv>\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'>\n\u003Cimg src = 'examples\u002Fcontent\u002Fchicago.jpg' height=\"200px\">\n\u003C\u002Fdiv>\n     \n\u003Cdiv align = 'center'>\n\u003Ca href = 'examples\u002Fstyle\u002Fwave.jpg'>\u003Cimg src = 'examples\u002Fthumbs\u002Fwave.jpg' height = '200px'>\u003C\u002Fa>\n\u003Cimg src = 'examples\u002Fresults\u002Fchicago_wave.jpg' height = '200px'>\n\u003Cimg src = 'examples\u002Fresults\u002Fchicago_udnie.jpg' height = '200px'>\n\u003Ca href = 'examples\u002Fstyle\u002Fudnie.jpg'>\u003Cimg src = 'examples\u002Fthumbs\u002Fudnie.jpg' height = '200px'>\u003C\u002Fa>\n\u003Cbr>\n\u003Ca href = 'examples\u002Fstyle\u002Frain_princess.jpg'>\u003Cimg src = 'examples\u002Fthumbs\u002Frain_princess.jpg' height = '200px'>\u003C\u002Fa>\n\u003Cimg src = 'examples\u002Fresults\u002Fchicago_rain_princess.jpg' height = '200px'>\n\u003Cimg src = 'examples\u002Fresults\u002Fchicago_la_muse.jpg' height = '200px'>\n\u003Ca href = 'examples\u002Fstyle\u002Fla_muse.jpg'>\u003Cimg src = 'examples\u002Fthumbs\u002Fla_muse.jpg' height = '200px'>\u003C\u002Fa>\n\n\u003Cbr>\n\u003Ca href = 'examples\u002Fstyle\u002Fthe_shipwreck_of_the_minotaur.jpg'>\u003Cimg src = 'examples\u002Fthumbs\u002Fthe_shipwreck_of_the_minotaur.jpg' height = '200px'>\u003C\u002Fa>\n\u003Cimg src = 'examples\u002Fresults\u002Fchicago_wreck.jpg' height = '200px'>\n\u003Cimg src = 'examples\u002Fresults\u002Fchicago_the_scream.jpg' height = '200px'>\n\u003Ca href = 'examples\u002Fstyle\u002Fthe_scream.jpg'>\u003Cimg src = 'examples\u002Fthumbs\u002Fthe_scream.jpg' height = '200px'>\u003C\u002Fa>\n\u003C\u002Fdiv>\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\u002Foffset 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\u002FLinux\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:\u002F\u002Fdocs.anaconda.com\u002Fanaconda\u002Finstall\u002F\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\u002Fto\u002Fstyle\u002Fimg.jpg \\\n      --checkpoint-dir checkpoint\u002Fpath \\\n      --test path\u002Fto\u002Ftest\u002Fimg.jpg \\\n      --test-dir path\u002Fto\u002Ftest\u002Fdir \\\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:\u002F\u002Fdrive.google.com\u002Fdrive\u002Ffolders\u002F0B9jhaT37ydSyRk9UX0wwX3BpMzQ?resourcekey=0-Z9LcNHC-BTB4feKwm4loXw&usp=sharing)**. Example usage:\n\n    python evaluate.py --checkpoint path\u002Fto\u002Fstyle\u002Fmodel.ckpt \\\n      --in-path dir\u002Fof\u002Ftest\u002Fimgs\u002F \\\n      --out-path dir\u002Ffor\u002Fresults\u002F\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\u002Fto\u002Finput\u002Fvid.mp4 \\\n      --checkpoint path\u002Fto\u002Fstyle\u002Fmodel.ckpt \\\n      --out-path out\u002Fvideo.mp4 \\\n      --device \u002Fgpu: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\n### Citation\n```\n  @misc{engstrom2016faststyletransfer,\n    author = {Logan Engstrom},\n    title = {Fast Style Transfer},\n    year = {2016},\n    howpublished = {\\url{https:\u002F\u002Fgithub.com\u002Flengstrom\u002Ffast-style-transfer\u002F}},\n    note = {commit xxxxxxx}\n  }\n```\n\n### Attributions\u002FThanks\n- This project could not have happened without the advice (and GPU access) given by [Anish Athalye](http:\u002F\u002Fwww.anishathalye.com\u002F). \n  - The project also borrowed some code from Anish's [Neural Style](https:\u002F\u002Fgithub.com\u002Fanishathalye\u002Fneural-style\u002F)\n- Some readme\u002Fdocs formatting was borrowed from Justin Johnson's [Fast Neural Style](https:\u002F\u002Fgithub.com\u002Fjcjohnson\u002Ffast-neural-style)\n- The image of the Stata Center at the very beginning of the README was taken by [Juan Paulo](https:\u002F\u002Fjuanpaulo.me\u002F)\n\n### Related Work\n- Michael Ramos ported this network [to use CoreML on iOS](https:\u002F\u002Fmedium.com\u002F@rambossa\u002Fdiy-prisma-fast-style-transfer-app-with-coreml-and-tensorflow-817c3b90dacd)\n","该项目基于TensorFlow实现快速风格迁移，能够将著名画作的风格在短时间内应用到任何照片甚至视频上。其核心功能是通过深度学习技术，特别是卷积神经网络（CNN），结合Gatys、Johnson以及Ulyanov等人的研究成果，实现实时的艺术风格转换。项目支持图像和视频两种形式的内容处理，能够在保持原图或原视频内容的同时赋予其新的艺术风格。适用于需要创意视觉效果生成的应用场景，如社交媒体、广告设计、电影特效制作等领域。","2026-06-11 03:24:18","top_topic"]