{"id":33191208,"url":"https://github.com/DmitryUlyanov/fast-neural-doodle","last_synced_at":"2025-11-21T00:02:29.908Z","repository":{"id":37561638,"uuid":"53734148","full_name":"DmitryUlyanov/fast-neural-doodle","owner":"DmitryUlyanov","description":"Faster neural doodle","archived":false,"fork":false,"pushed_at":"2018-05-28T10:06:35.000Z","size":9252,"stargazers_count":345,"open_issues_count":5,"forks_count":51,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-07-24T16:14:37.759Z","etag":null,"topics":["neural-doodle","neural-style","torch"],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/DmitryUlyanov.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}},"created_at":"2016-03-12T13:54:00.000Z","updated_at":"2025-02-23T04:50:34.000Z","dependencies_parsed_at":"2022-07-15T21:47:57.958Z","dependency_job_id":null,"html_url":"https://github.com/DmitryUlyanov/fast-neural-doodle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DmitryUlyanov/fast-neural-doodle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DmitryUlyanov%2Ffast-neural-doodle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DmitryUlyanov%2Ffast-neural-doodle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DmitryUlyanov%2Ffast-neural-doodle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DmitryUlyanov%2Ffast-neural-doodle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DmitryUlyanov","download_url":"https://codeload.github.com/DmitryUlyanov/fast-neural-doodle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DmitryUlyanov%2Ffast-neural-doodle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285532343,"owners_count":27187706,"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","status":"online","status_checked_at":"2025-11-20T02:00:05.334Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["neural-doodle","neural-style","torch"],"created_at":"2025-11-16T06:00:41.198Z","updated_at":"2025-11-21T00:02:29.895Z","avatar_url":"https://github.com/DmitryUlyanov.png","language":"Lua","funding_links":[],"categories":["Model Zoo"],"sub_categories":["Convolutional Networks"],"readme":"## Faster neural doodle\n\nThis is my try on drawing with neural networks, which is faster than [Alex J. Champandard's version](https://github.com/alexjc/neural-doodle), and similar in quality. This approach is based on [neural artistic style method](http://arxiv.org/abs/1508.06576) (L. Gatys), whereas Alex's version uses [CNN+MRF approach](http://arxiv.org/abs/1601.04589) of Chuan Li.\n\nIt takes several minutes to redraw `Renoir` example using GPU and it will easily fit in 4GB GPUs. If you were able to work with [Justin Johnson's code for artistic style](https://github.com/jcjohnson/neural-style) then this code should work for you too. \n\nYou can find even faster version [here](https://github.com/DmitryUlyanov/online-neural-doodle).\n\n## Requirements\n- torch\n- torch.cudnn (optional)\n- [torch-hdf5](https://github.com/deepmind/torch-hdf5)\n- python + numpy + scipy + h5py + sklearn\n\nTested with python2.7 and latest `conda` packages.\n## Do it yourself\n\nFirst download VGG-19.\n```\ncd data/pretrained \u0026\u0026 bash download_models.sh \u0026\u0026 cd ../..\n```\n\nUse this script to get intermediate representations for masks. \n```\npython get_mask_hdf5.py --n_colors=4 --style_image=data/Renoir/style.png --style_mask=data/Renoir/style_mask.png --target_mask=data/Renoir/target_mask.png\n```\n\nNow run doodle.\n```\nth fast_neural_doodle.lua -masks_hdf5 masks.hdf5\n```\n\nAnd here is the result.\n![Renoir](data/Renoir/grid.png)\nFirst row: original, second -- result.\n\nAnd Monet.\n![Monet](data/Monet/grid.png)\n\n## Multiscale\n\nProcessing the image at low resolution first can provide a significant speed-up. You can pass a list of resolutions to use when processing. Passing `256` means that the images and masks should be resized to `256x256` resolution. With `0` passed no resizing is done. Here is an example for cmd parameters: \n- `-num_iterations 450,100 -resolutions 256,0`\nWhich means: work for 450 iterations at `256x256` resolution and 100 iterations at original. \n\n`Monet` and `Renoir` examples take ~1.5 min to process with these options. \n\n## Style transfer\n\nYou can also provide target image to use in content loss (in the same way as in neural artisctic style algorithm) via `--target_image` option of `get\\_mask\\_hdf5.py` script.\n\nExample:\n```\npython get_mask_hdf5.py --n_colors=4 --style_image=data/Renoir/style.png --style_mask=data/Renoir/style_mask.png --target_mask=data/Renoir/creek_mask.jpg --target_image=data/Renoir/creek.jpg\nth fast_neural_doodle.lua -masks_hdf5 masks.hdf5\n```\n\n![Renoir](data/Renoir/comparison.jpg)\nUpper left: target image. Upper right: neural doodle with target image, i.e. both the masks and content loss were used. Lower left: regular neural doodle without content loss. Lower right: stylization without masks, with high style weight, obtained via [neural style code](https://github.com/jcjohnson/neural-style). With high style weight, stylization tends to mix unrelated parts of image, such as patches of grass floating in the sky on last picture. Neural doodle with content loss allows to generate highly stylized images without this problem.\n\n## Misc\n- Supported backends: \n\t- nn (CPU/GPU mode)\n\t- cudnn\n\t- clnn (not tested yet..)\n \n- When using `-backend cudnn` do not forget to switch `-cudnn_autotune`.\n\n## Acknowledgement\n\nThe code is heavily based on [Justin Johnson's great code](https://github.com/jcjohnson/neural-style) for artistic style.\n\n## Citation\n\nIf you use this code for your research please cite [neural-style](https://github.com/jcjohnson/neural-style) and this repository.\n\n```\n@misc{Ulyanov2016fastdoodle,\n  author = {Ulyanov, Dmitry},\n  title = {Fast Neural Doodle},\n  year = {2016},\n  publisher = {GitHub},\n  journal = {GitHub repository},\n  howpublished = {\\url{https://github.com/DmitryUlyanov/fast-neural-doodle}},\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDmitryUlyanov%2Ffast-neural-doodle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDmitryUlyanov%2Ffast-neural-doodle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDmitryUlyanov%2Ffast-neural-doodle/lists"}