{"id":21445679,"url":"https://github.com/einstellung/gender_conversion","last_synced_at":"2026-04-17T01:03:22.485Z","repository":{"id":166443978,"uuid":"224197289","full_name":"Einstellung/gender_conversion","owner":"Einstellung","description":"This repository can realize the feminization of male characters in pictures and the masculinization of female characters in picture.","archived":false,"fork":false,"pushed_at":"2019-12-03T13:22:50.000Z","size":37,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T01:23:04.604Z","etag":null,"topics":["cyclegan","keras","opencv","pyqt5","pytorch"],"latest_commit_sha":null,"homepage":null,"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/Einstellung.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":"2019-11-26T13:20:54.000Z","updated_at":"2024-01-09T05:19:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"8cec8f67-b2e2-4213-85cd-817bcb20d65e","html_url":"https://github.com/Einstellung/gender_conversion","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Einstellung/gender_conversion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Einstellung%2Fgender_conversion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Einstellung%2Fgender_conversion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Einstellung%2Fgender_conversion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Einstellung%2Fgender_conversion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Einstellung","download_url":"https://codeload.github.com/Einstellung/gender_conversion/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Einstellung%2Fgender_conversion/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31910584,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"ssl_error","status_checked_at":"2026-04-16T18:21:47.142Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["cyclegan","keras","opencv","pyqt5","pytorch"],"created_at":"2024-11-23T02:37:18.015Z","updated_at":"2026-04-17T01:03:22.447Z","avatar_url":"https://github.com/Einstellung.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### 男女性别互换程序\n\n**功能描述**：实现照片级别男性性别互换。也就是照片中的男性头像全部女性化，女性头像全部男性化。\n\n**技术原理**：  \n\n使用OpenCV处理图像，dlib来进行人脸头像识别（级联分类器，dlib已经提前训练好模型，并且内置了，直接调用就可以）。  \n\n使用Keras的预训练模型进行男女性别识别。\n\n男性性别转换使用的是CycleGAN网络。比较经典的不平衡数据生成对抗网络。models文件夹中`wide_resnet.py`是男女性别识别的网络。`CycleGAN_models.py`是我写的CycleGAN网络，Pytorch版本为0.4.1。  \n\n最后再使用PyQt5来生成交互程序。PyQt5第一次用，界面设计的有点糙，哈哈。以后争取做其他程序的时候做的漂亮一点。    \n\n为了解决生成的图像贴回到原始图像之后边界看起来格格不入的现象，代码中也使用了泊松融合的技术，如果对这个技术比较感兴趣的话，可以[点击](https://blog.csdn.net/Einstellung/article/details/102924828)这里详细了解一下。\n\n最后那个`cat.ico`是图标文件。  \n\n**使用**：  \n\n如果你相关环境配置正确，那么使用\n\n```python\npython UI.py\n```\n\n应该可以正常运行程序。我使用的OpenCV版本是3.4，Keras版本为2.2  \n\n另外，GitHub没有办法上传超过100M的文件。所以models文件夹中的训练好的模型没有上传，可以点击[这个链接](https://pan.baidu.com/s/1-ZshbKYC0A_2URX4GcLXtg)从百度网盘中下载。\n\n程序界面为：\n\n\u003cdiv align=center\u003e\u003cimg src=\"1.jpg\" width=\"200\" /\u003e\u003c/div\u003e\n\n此外，我还上线了与之配套的CycleGAN实现男女性别转换的教程，感兴趣可以点击这个[链接](https://study.163.com/course/introduction.htm?share=2\u0026shareId=400000000632007\u0026courseId=1209534840\u0026_trace_c_p_k2_=70a05c6b9b7440c39c9ea6b2d8e85a71)\n\n-----------------------------------------------\n\n\n\n### 致谢\n\nCycleGAN代码参考了[Pytorch-CycleGAN](https://github.com/aitorzip/PyTorch-CycleGAN)部分内容，同时感谢CycleGAN论文的作者，生成对抗网络的确很有趣。Keras男女识别的代码和预训练模型来自[这里](https://github.com/yu4u/age-gender-estimation)，不过这个模型本来是可以年龄和性别一起预测的，我这里只用到了性别，年龄部分舍弃了，以后可能会考虑用MobileNet自己训练一个速度更快更小的性别预测模型。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feinstellung%2Fgender_conversion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feinstellung%2Fgender_conversion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feinstellung%2Fgender_conversion/lists"}