{"id":17038143,"url":"https://github.com/bchao1/anime-generation","last_synced_at":"2025-04-12T13:52:10.612Z","repository":{"id":113819232,"uuid":"150204772","full_name":"bchao1/Anime-Generation","owner":"bchao1","description":"🎨 Anime generation with GANs.","archived":false,"fork":false,"pushed_at":"2022-05-12T06:03:35.000Z","size":15885,"stargazers_count":69,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T08:37:06.905Z","etag":null,"topics":["acgan","anime","anime-generation","computer-vision","conditional-gan","dataset","dcgan","gan","generative-adversarial-network"],"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/bchao1.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-25T03:51:39.000Z","updated_at":"2025-01-19T14:11:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"ad19d180-ef99-4cde-a110-ef1b4f303afe","html_url":"https://github.com/bchao1/Anime-Generation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchao1%2FAnime-Generation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchao1%2FAnime-Generation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchao1%2FAnime-Generation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchao1%2FAnime-Generation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bchao1","download_url":"https://codeload.github.com/bchao1/Anime-Generation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248576045,"owners_count":21127310,"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":["acgan","anime","anime-generation","computer-vision","conditional-gan","dataset","dcgan","gan","generative-adversarial-network"],"created_at":"2024-10-14T08:56:05.656Z","updated_at":"2025-04-12T13:52:10.584Z","avatar_url":"https://github.com/bchao1.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ACGAN Conditional Anime Generation\n\u003e Note: I have restructured the whole folder, cleaned up training code, pruned my dataset, and updated most of the results. You can see the old version of this repo in `old`.\n\nGenerate colorful anime characters using GAN.\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"results/change_hair.png\" /\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"results/change_eye.png\" /\u003e\n\u003c/p\u003e\n\n## Generating characters with different hair and eye colors\nBy interpolating generator input, we can see some interesting results.\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"results/interpolate.png\" /\u003e\n\u003c/p\u003e\n\nBy fixing color classes and varying noise, we can generate anime characters with same colors but different identity.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"results/blue_eye_red_hair.png\" /\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"results/green_eye_purple_hair.png\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"results/orange_eye_blue_hair.png\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"results/purple_eye_pink_hair.png\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"results/red_eye_black_hair.png\" /\u003e\n\u003c/p\u003e\n\n## Generate characters with different artistic styles\n\nI noticed that anime produced in different years have distinctive artistic styles. To name a few:\n- Characters in older anime tend to have larger, angular eyes, while newer anime have characters with round eyes. \n- Colors are brighter and more saturated in older anime, while newer anime have mild colors.\n   \nBy conditioning the ACGAN on **year labels**, we can generate characters with different artistic styles.\n   \n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"results/year_selected.png\" /\u003e\n\u003c/p\u003e\n   \nInterpolating along the year latent code:\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"results/year_morph.png\" /\u003e\n\u003c/p\u003e\n\n\n\n\n## Start training\nModify `config.yaml` as you wish.\n```\n\u003e python3 run.py\n```\n## The dataset\nThe current [dataset](https://drive.google.com/file/d/18FG-KSeAUBp0O0np63ynqdA7_tgIOCa8/view?usp=sharing) is a composition of 2 datasets:\n\n1. One dataset with eye and hair color labels (30k+ images)\n2. One dataset with year label, which is the year in which the anime is produced (60k+ images).\n\nThe dataset format is as follows:\n```\n- images/\n    - XXXXX.jpg\n    - ...\n- labels.pkl\n- eye_label.json\n- year_label.json\n- hair_label.json\n```\nAfter loading in `labels.pkl` with pickle, you will get a dictionary of `{ filname : labels }`. The labels are formatted as `(eye, hair, year)` tuples.\n```\n{\n    \"32455\": (8, 10, 5),\n    ...\n}\n```\n\u003e This means `32455.jpg` has eye class 8, hair class 10, year class 5.\n\nMissing labels will be a `None`. All images from dataset 1 will have year labels `None`, while all images from dataset 2 will have eye and hair label `None`.\n***\nSource code in the current repo is used to train on the first dataset. This requires some manual preprocessing (see `dataset/anime_dataset.py`) to extract the first dataset from the whole dataset. \n***\nThe `.json` files map discrete labels to semantics. \n```js\n// eye_label.json\n{\n    \"aqua\": 0, \n    \"black\": 1, \n    ...\n}\n```\n## Some notes\n- When training on the first dataset, adding some color transformations to images as a preprocessing step traning might help. You can achieve this through various `torchvisions.transforms.functional` methods.\n- Train with N(0, 1) but sample from Gaussian of smaller variance when evaluating. Just an engineering hack to get better results.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbchao1%2Fanime-generation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbchao1%2Fanime-generation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbchao1%2Fanime-generation/lists"}