{"id":22439558,"url":"https://github.com/igreat/artistic-style-net","last_synced_at":"2026-04-28T20:34:05.109Z","repository":{"id":42200638,"uuid":"510637959","full_name":"igreat/artistic-style-net","owner":"igreat","description":"Pytorch implementation of original neural transfer paper 🖌️🎨🧠","archived":false,"fork":false,"pushed_at":"2023-05-18T02:36:21.000Z","size":26757,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-27T09:28:20.900Z","etag":null,"topics":["art","computer-vision","deep-learning","machine-learning","neural-style-transfer","python","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/igreat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-05T07:49:38.000Z","updated_at":"2024-09-23T18:31:37.000Z","dependencies_parsed_at":"2023-02-01T03:45:58.798Z","dependency_job_id":null,"html_url":"https://github.com/igreat/artistic-style-net","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/igreat/artistic-style-net","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igreat%2Fartistic-style-net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igreat%2Fartistic-style-net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igreat%2Fartistic-style-net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igreat%2Fartistic-style-net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igreat","download_url":"https://codeload.github.com/igreat/artistic-style-net/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igreat%2Fartistic-style-net/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32398779,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"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":["art","computer-vision","deep-learning","machine-learning","neural-style-transfer","python","pytorch"],"created_at":"2024-12-06T01:15:13.631Z","updated_at":"2026-04-28T20:34:05.086Z","avatar_url":"https://github.com/igreat.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Artistic Nueral Transfer 🖌️🎨🧠\n\n## Background\n\nIn this repository I will do a PyTorch implementation of the paper [A Neural Algorithm of Artistic Style](https://arxiv.org/abs/1508.06576) by Leon A. Gatys, Alexander S. Ecker, and Matthias Bethge.\n\nBy using a deep CNN trained on a large dataset, we can extract **content** features and **style** features in order to produce the desired combination of the two in one image. Here is an example of the Sultan Qaboos Grand Mosque mixed with the style of the Starry Night by Vincent van Gogh.\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"images/test-images/starry-night.jpg\" alt=\"Starry Night\" width=\"256\"/\u003e\n    \u003cimg src=\"images/test-images/sultan-qaboos-grand-mosque.jpg\" alt=\"Sultan Qaboos Grand Mosque\" width=256/\u003e\n    \u003cimg src=\"images/generated-images/night-grand-mosque.png\" alt=\"Starry Grand Mosque\" width=\"512\"/\u003e\n\u003c/div\u003e\n\n## Results\n\nHere is a portrait of an apple put with different style images.\n\n\u003cdiv align=\"center\"\u003e\n    \u003cdiv\u003e\n        \u003cimg src=\"images/apples/apple.jpg\" width=\"140px\"/\u003e\n    \u003c/div\u003e\n    \u003cspan\u003e\n        \u003cimg src=\"images/test-images/starry-night.jpg\" alt=\"Starry Night\" height=\"150\"/\u003e\n        \u003cimg src=\"images/apples/starry-apple.png\" height=\"150px\"/\u003e\n    \u003c/span\u003e\n    \u003cspan\u003e\n        \u003cimg src=\"images/test-images/candy.jpg\" height=\"150\"/\u003e\n        \u003cimg src=\"images/apples/candy-apple.png\" height=\"150px\"/\u003e\n    \u003c/span\u003e\n    \u003cspan\u003e\n        \u003cimg src=\"images/test-images/picasso.jpg\" height=\"150\"/\u003e\n        \u003cimg src=\"images/apples/picasso-apple.png\" height=\"150px\"/\u003e\n    \u003c/span\u003e\n    \u003cspan\u003e\n        \u003cimg src=\"images/test-images/the-scream.jpg\" alt=\"Starry Night\" height=\"150\"/\u003e\n        \u003cimg src=\"images/apples/scream-apple.png\" height=\"150px\"/\u003e\n    \u003c/span\u003e\n\u003c/div\u003e\n\n## Control and tradeoffs\nThere are multiple ways we can manipulate the output given a style and content image, which include:\n- Style weight\n- Content weight\n- TV regularization to improve smoothness\n\nIdeally, I would recommend leaving the content weight at 1 and only changing the style weight, since what matters is their ratio.\n\nBy using different weights on the style and content images, we can get different results as shown below where the ratios between the weights of the style image and the content image are 1e4, 1e5, 1e6, 1e7 respectively from left to right.\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"images/weight-comparisons/compare1to1e4.png\" width=\"200px\"/\u003e\n    \u003cimg src=\"images/weight-comparisons/compare1to1e5.png\" width=\"200px\"/\u003e\n    \u003cimg src=\"images/weight-comparisons/compare1to1e6.png\" width=\"200px\"/\u003e\n    \u003cimg src=\"images/weight-comparisons/compare1to1e7.png\" width=\"200px\"/\u003e\n\u003c/div\u003e\n\nThe effects of TV regularization for when starting from the content image (which is what I recommend) are fairly small from what I've seen, so I won't showcase the differences. A tv weight of 1e-6 to 1e-4 works just fine.\n## Installation\n\nYou need to first install miniconda. Once you have miniconda installed, all you need to do is download the project file, then navigate the the project file in the terminal, then put the following command.\n\n```\nconda env create\n```\nNow every time you want to use this tool, just type \n```\nconda activate artistic-net\n```\nNow you are ready to use the tool as shown in the following section.\n## Usage\n\nHere is an example the simplest way to use this program\n\n```\npython artistic_neural_net.py --content-image \u003cPATH TO CONTENT IMAGE\u003e --style-image \u003cPATH TO STYLE IMAGE\u003e\n```\n\nThe previous command will generate an image and place it in the same directory as the project file, with all the default hyperparamers.\n\nFor more customizability, here is a list of all the arguments that can be used.\n```\noptional arguments:\n  -h, --help            show this help message and exit\n  --content-image CONTENT_IMAGE\n                        path of the content image\n  --style-image STYLE_IMAGE\n                        path of the style image\n  --save-path SAVE_PATH\n                        name and path where generated image will be saved\n  --image-size IMAGE_SIZE\n                        the size of the generated image\n  --content-weight CONTENT_WEIGHT\n                        style loss weight\n  --style-weight STYLE_WEIGHT\n                        style loss weight\n  --smoothness SMOOTHNESS\n                        total variation loss weight to make image smoother\n  --init {content,noise}\n                        initial image to be used\n  --maintain-color      include to maintain the original color of the content image\n  --pooling {max,avg}   the pooling used in the network\n  --iter ITER           number of optimization steps\n  --disp-iter DISP_ITER\n                        number of optimization steps before error is displayed\n  --content-layers CONTENT_LAYERS [CONTENT_LAYERS ...]\n                        specify the content layers, space separated\n  --style-layers STYLE_LAYERS [STYLE_LAYERS ...]\n                        specify the style layers, space separated\n```\n\n## Monitoring stylization\n\nYou can also monitor how your image is changing over many iterations, as well as the style, content and total variation losses.\n\nTo do this, simply run the following in a different terminal:\n```\ntensorboard --logdir=runs --samples_per_plugin images={MAX IMAGES}\n```\nYou'll be able to see what your image looks like after each 50 iterations.\n\nHere's how it will look like:\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"images/tensorboard.gif\"/\u003e\n\u003c/div\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figreat%2Fartistic-style-net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figreat%2Fartistic-style-net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figreat%2Fartistic-style-net/lists"}