{"id":17225665,"url":"https://github.com/chaofengc/face-sketch-scg","last_synced_at":"2025-04-14T01:08:32.429Z","repository":{"id":181387934,"uuid":"264144248","full_name":"chaofengc/Face-Sketch-SCG","owner":"chaofengc","description":"Semi-supervised Cycle-GAN for face photo-sketch translation in the wild, CVIU2023","archived":false,"fork":false,"pushed_at":"2024-07-10T01:41:19.000Z","size":786,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T01:08:13.156Z","etag":null,"topics":["face-sketch-synthesis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chaofengc.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-15T08:51:07.000Z","updated_at":"2024-09-14T04:26:36.000Z","dependencies_parsed_at":"2024-07-08T16:58:41.598Z","dependency_job_id":null,"html_url":"https://github.com/chaofengc/Face-Sketch-SCG","commit_stats":null,"previous_names":["chaofengc/face-sketch-scg"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaofengc%2FFace-Sketch-SCG","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaofengc%2FFace-Sketch-SCG/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaofengc%2FFace-Sketch-SCG/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaofengc%2FFace-Sketch-SCG/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chaofengc","download_url":"https://codeload.github.com/chaofengc/Face-Sketch-SCG/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804803,"owners_count":21164134,"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":["face-sketch-synthesis"],"created_at":"2024-10-15T04:14:10.875Z","updated_at":"2025-04-14T01:08:32.400Z","avatar_url":"https://github.com/chaofengc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Face-Sketch-SCG\n\nThis is the official PyTorch codes for the journal extension of our [previous work](https://github.com/chaofengc/Face-Sketch-Wild): \n\n[**Semi-supervised Cycle-GAN for face photo-sketch translation in the wild.**](https://arxiv.org/abs/2307.10281)  \n[Chaofeng Chen](https://chaofengc.github.io), [Wei Liu](https://scholar.google.com/citations?user=3to3lqMAAAAJ\u0026hl=en), [Xiao Tan](https://scholar.google.com/citations?user=R1rVRUkAAAAJ\u0026hl=en), [Kwan-Yee K. Wong](http://i.cs.hku.hk/~kykwong/)  \n\n[![arXiv](https://img.shields.io/badge/arXiv-Paper-\u003cCOLOR\u003e.svg)](https://arxiv.org/abs/2307.10281)\n![visitors](https://visitor-badge.laobi.icu/badge?page_id=chaofengc/Face-Sketch-SCG)\n[![Citation](https://img.shields.io/badge/Citation-bibtex-green)](https://github.com/chaofengc/Face-Sketch-SCG/blob/master/README.md#-citation)\n[![LICENSE](https://img.shields.io/badge/LICENSE-CC%20BY--NC--SA%204.0-lightgrey)](https://github.com/chaofengc/Face-Sketch-SCG/blob/master/LICENSE)\n\n| Framework | Noise-injection |\n| :-----: | :------: |\n| ![](assets/fig_arch.png) | ![](assets/fig_noise.png) |\n\n# ⚙️ Dependencies Configuration \n- PyTorch \u003e= 1.8.0\n- CUDA \u003e= 10.1\n- Install other dependencies with\n  ```\n  # git clone this repository\n  git clone https://github.com/chaofengc/Face-Sketch-SCG.git\n  cd Face-Sketch-SCG \n\n  # create new anaconda env\n  conda create -n sketch python=3.8\n  source activate sketch \n\n  # install python dependencies\n  pip3 install -r requirements.txt\n  ```\n\n# ⚡ Quick Test\n\nYou may test with **aligned** face images using the following command:\n```\npython test.py -i ./test_images -o results/ --direction AtoB\n```\nThe available options are\nname | default | description \n--- | --- | --- \n-i, --input | | input image path or folder path\n-o, --output | `results` | output folder path\n-s, --style | `cufs` | sketch styles: `cufs, cufsf, wildsketch` \n-d, --direction | `AtoB` | `AtoB`: RGB to gray sketch; `BtoA`: gray sketch to RGB \n-w, --weight| `None` | custom weight path\n-g, --ground_truth | `None` | ground truth images for calculating metrics: fsim, lpips, dists\n\n## 🖼️ Example Results\n\n![](./assets/example1.png)\n![](./assets/example2.png)\n\n## 📊 Performance on Public Benchmarks\n\nBecause we improve the training details after cleaning the codes, results of the released models are slightly different from numbers in the paper:\n\nDatasets | CUFS (FSIM↑/LPIPS↓/DISTS↓) | CUFSF (FSIM↑/LPIPS↓/DISTS↓) | WildSketch (FSIM↑/LPIPS↓/DISTS↓) |\n--- | --- | --- | ---\nPaper Results (AtoB) | 0.7343/0.3232/0.1967 | 0.7261/0.3489/0.184 | 0.7010/-/-\nReleased | 0.7349/0.3140/0.1875 | 0.7258/0.3473/0.1777 | 0.7010/0.3165/0.2528\nPaper Results (BtoA) | 0.7652/0.3374/0.1710 | 0.7777/0.3527/0.2082 | N/A \nReleased | 0.7789/0.2874/0.1633 | 0.7816/0.3592/0.2229 | N/A\n\nHere is the example benchmark test script for photo-to-sketch (AtoB) with CUFS dataset:\n```\npython test.py -i ./dataset/CUFS/test_photos/ -o tmp_test_results -s cufs -d AtoB -g ./dataset/CUFS/test_sketches/\n```\n\n# 🛠️ Train the Model\n\nYou may first download the datasets and use the provided example script to train the model.\n## ⏬ Download Datasets\nFor convenient, we put all the training dataset [here](https://github.com/chaofengc/Face-Sketch-SCG/releases/tag/v0.1). Please download and extract them under the `dataset/` folder. You may also download the dataset with the following commands:\n```\nwget https://github.com/chaofengc/Face-Sketch-SCG/releases/download/v0.1/dataset.tgz\n``` \n\n## 👩🏻‍💻 Train Commands \n\nHere is an example training command with `cufs` as reference dataset: \n```\npython train.py --gpus 1 --name FaceSCG_v001 --model semicycle_gan --total_epochs 100 \\\n    --lr 0.002 --beta1 0.9 \\\n    --lr_policy 'cosine' --n_epochs 20 \\\n    --Gnorm \"gn\" --Dnorm \"gn\" --act_type silu --n_layers_D 3 --D_num 3 \\\n    --lambda_mrf 1 --lambda_sty 1 --lambda_g 1 --lambda_A 1 --lambda_pcp 1 --sigma 20 --patch_k 3 \\\n    --train_style cufs --vggface ./dataset/vggface \\\n    --dataset_name fsvgg --batch_size 4 --Gin_size 256 --topk 3 \\\n    --visual_freq 50 --print_freq 10 --save_iter_freq 200 --save_latest_freq 100 \n```\nPlease refer to the codes for details of these options.\n\n# 📑 Citation\n\nIf you find this code or the provided data useful in your research, please consider cite:\n```\n@inproceedings{chen2023face-sketch-scg,\n    title={Semi-supervised Cycle-GAN for face photo-sketch translation in the wild},\n    author={Chen, Chaofeng and Liu, Wei and Tan, Xiao and Wong, Kwan-Yee~K.},\n    booktitle={Computer Vision and Image Understanding (CVIU)},\n    year={2023},\n    doi={https://doi.org/10.1016/j.cviu.2023.103775},\n}\n```\n\n# 📜 License\n\nThis work is licensed under a \u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-sa/4.0/\"\u003eCreative Commons Attribution-NonCommercial-ShareAlike 4.0 International License\u003c/a\u003e.  \n\u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-sa/4.0/\"\u003e\u003cimg alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png\" /\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchaofengc%2Fface-sketch-scg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchaofengc%2Fface-sketch-scg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchaofengc%2Fface-sketch-scg/lists"}