{"id":6466,"date":"2021-06-15T21:56:05","date_gmt":"2021-06-15T13:56:05","guid":{"rendered":"https:\/\/vip.fxxkpython.com\/?p=6466"},"modified":"2021-06-15T21:56:08","modified_gmt":"2021-06-15T13:56:08","slug":"%e8%82%8c%e8%82%89%e9%87%91%e8%bd%ae-python-%e6%8d%a2%e8%84%b8%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/vip.fxxkpython.com\/?p=6466","title":{"rendered":"\u808c\u8089\u91d1\u8f6e Python \u6362\u8138\u6559\u7a0b"},"content":{"rendered":"\n<p>\u200b\u6700\u8fd1\u6709 b \u53cb\u7ed9\u6211\u63a8\u4e86\u4e2a b \u7ad9\u7684\u89c6\u9891\uff1a\u808c\u8089\u91d1\u8f6e\uff0c\u95ee\u6211\u5982\u4f55\u5b9e\u73b0\u8fd9\u79cd\u89c6\u9891\u91cc\u9762\u6362\u8138\u7684\uff1f<\/p>\n\n\n\n<p><br>\u6211\u8bf4\u7f51\u4e0a\u6709\u76f8\u5173\u6559\u7a0b\uff0c\u4f60\u53bb\u641c\u4e00\u4e0b\uff0c\u4ed6\u8bf4\u770b\u7684\u4e91\u91cc\u96fe\u91cc\uff0c\u80fd\u4e0d\u80fd\u8ba9\u6211\u7528\u5c0f\u5e05b\u7684\u98ce\u683c\uff0c\u51fa\u4e00\u671f\u901a\u719f\u6613\u61c2\u7684\uff0c\u8ba9\u4eba\u770b\u5b8c\u5c31\u4f1a\u64cd\u4f5c\u7684\u90a3\u79cd\u3002<\/p>\n\n\n\n<p><br>\u6211\u56de\u4e86\u53e5\uff1a\u8fd9&#8230;\u662f\u8981\u5e72\u561b\uff1f\u5f97\u4e0d\u5230\u5973\u795e\u5c31\u8981\u81ea\u5df1\u521b\u9020\u4e48\uff1f<br>\u4ed6\u8bf4\uff1a\u7edd\u65e0\u53ef\u80fd\uff01<\/p>\n\n\n\n<p><br>\u55ef\uff0c\u6211\u4fe1\u4e86\uff01<br><\/p>\n\n\n\n<p>\u90a3\u4e48\uff0c\u5982\u4f55\u5b9e\u73b0\u5c06\u89c6\u9891\u4e2d\u7684\u8138\u86cb\u6362\u6210\u81ea\u5df1\u5e0c\u671b\u7684\u6837\u5b50\u5462\uff1f<br>\u63a5\u4e0b\u6765\u5c31\u662f\uff0c\u5b66\u4e60 Python \u7684\u6b63\u786e\u59ff\u52bf\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic4.zhimg.com\/80\/v2-b78af880ed9d71ba3a6d46d15e7500ae_1440w.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5047\u8bbe\u73b0\u5728\u4f60\u60f3\u628a\u8001\u7f57\u7684\u8138\uff0c\u6362\u5230\u89c6\u9891\u4e2d\u808c\u8089\u7537\u7684\u8eab\u4e0a\uff0c\u6d41\u7a0b\u5e94\u8be5\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n\n\n\n<p><strong>1\u3001<\/strong>\u62ff\u5230\u5f88\u591a\u8001\u7f57\u7684\u8138\u90e8\u7167\u7247\uff0c\u62ff\u5230\u5f88\u591a\u808c\u8089\u7537\u8138\u90e8\u7684\u7167\u7247<br><strong>2\u3001<\/strong>\u8ba9\u673a\u5668\u5b66\u4e60\u5b83\u4eec\u5404\u81ea\u7684\u7279\u5f81\u5c06\u5b83\u4eec\u8bad\u7ec3\u6210\u4e00\u4e2a\u6a21\u578b<br><strong>3\u3001<\/strong>\u5c06\u8bad\u7ec3\u540e\u7684\u6a21\u578b\u5408\u6210\u5230\u808c\u8089\u7537\u89c6\u9891\u4e2d<br>\u5b8c\u4e8b\uff5e<\/p>\n\n\n\n<p>\u95ee\u9898\u6765\u4e86\uff0c\u600e\u4e48\u62ff\u5230\u4ed6\u4eec\u5f88\u591a\u7684\u8138\u90e8\u7167\u7247\u5462\uff1f<br>\u4e00\u79cd\u6bd4\u8f83\u597d\u7684\u65b9\u5f0f\u662f\uff0c\u901a\u8fc7\u89c6\u9891\u6765\u63d0\u53d6\u7167\u7247\u3002<\/p>\n\n\n\n<p><br>\u53ef\u4ee5\u641c\u4e00\u4e0b\u8001\u7f57\u7684\u91c7\u8bbf\u89c6\u9891\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic4.zhimg.com\/80\/v2-e43ff694ffb1c385d9973ad5b34accb6_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u627e\u4e00\u4e2a\u5408\u9002\u7684\u89c6\u9891\uff0c\u7136\u540e\u4f7f\u7528 <a href=\"https:\/\/github.com\/soimort\/you-get\">you-get <\/a>\u5c06\u89c6\u9891\u4e0b\u8f7d\u5230\u672c\u5730\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic4.zhimg.com\/80\/v2-2ebea292ae7d165243a41f74b1ed7c4a_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5b89\u88c5\u4e00\u4e0b <a href=\"https:\/\/github.com\/deepfakes\/faceswap\">faceswap<\/a> \u5e93\uff0c\u7528\u6765\u63d0\u53d6\u7167\u7247\uff0c\u8bad\u7ec3\uff0c\u89c6\u9891\u5408\u6210\u3002<\/p>\n\n\n\n<p><br>\u4f7f\u7528 git \u628a\u5b83 clone \u4e0b\u6765\uff1a<br>git clone &#8211;depth 1 https:\/\/github.com\/deepfakes\/faceswap.git<br><\/p>\n\n\n\n<p>\u63a5\u7740\u8fdb\u5165 faceswap \u4e2d\uff0c\u4f7f\u7528 pip \u5b89\u88c5\u5fc5\u8981\u7684\u5e93\uff0c\u8fd9\u91cc\u53ef\u4ee5\u4f7f\u7528 CPU \u548c GPU \u7684\u6a21\u5f0f\u5b89\u88c5\uff1a<\/p>\n\n\n\n<p><br>\u6709 amd \u7684 GPU \u8fd9\u6837\u5b89\u88c5\uff1a<br>pip install -r requirements_amd.txt <\/p>\n\n\n\n<p>\u6709 N \u5361\u8fd9\u6837\u5b89\u88c5\uff1a<br>pip install -r requirements_nvidia.txt<\/p>\n\n\n\n<p><br>\u53ea\u6709 CPU \u8fd9\u6837\u5b89\u88c5\uff1a<br>pip install -r requirements_cpu.txt<br><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u5b8c\u4e8b\u4e4b\u540e\uff0c\u5148\u6765\u5c06\u89c6\u9891\u4e2d\u7684\u8138\u90e8\u63d0\u53d6\u6210\u7167\u7247\uff1a\n\npython faceswap.py extract -i ~\/video\/lyh\/lyh.mp4 -o ~\/faces\/lyh\/\n\n\u8fd9\u91cc\u5c06\u8001\u7f57\u7684\u89c6\u9891\u63d0\u53d6\u8138\u90e8\u7167\u7247\u5230 faces\/lyh \u76ee\u5f55\u4e0b\u3002<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/80\/v2-14ca550b97428396e47c67b04fbc358e_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u63d0\u53d6\u5b8c\u6210\uff0c\u6253\u5f00\u76ee\u5f55\u53ef\u4ee5\u770b\u5230\u597d\u591a\u7684\u8001\u7f57\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic4.zhimg.com\/80\/v2-2bc4849f2cfffe3ddcaa8fe6b6e13c99_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u63a5\u7740\u4f7f\u7528\u540c\u6837\u7684\u65b9\u5f0f\uff0c\u628a\u808c\u8089\u7537\u7684\u8138\u90e8\u7167\u7247\u4e5f\u63d0\u53d6\u51fa\u6765:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/80\/v2-12b549b04a70c686bde12a6e29b32e21_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u597d\u4e86\uff0c\u7b2c\u4e00\u6b65\u641e\u5b9a\uff01<\/p>\n\n\n\n<p><br>\u8138\u90e8\u7167\u7247\u90fd\u6709\u4e86\uff0c\u63a5\u4e0b\u6765\u8bad\u7ec3\u4e00\u6ce2\uff1a<br>python faceswap.py train -A ~\/faces\/muscle -B ~\/faces\/lyh -m ~\/models\/muscle_lyh_model\/ -p<br><\/p>\n\n\n\n<p>-A \u6307\u5b9a\u521a\u521a\u63d0\u53d6\u7684\u808c\u8089\u7537\u8138\u90e8\u7167\u7247\u76ee\u5f55\uff0c -B \u6307\u5b9a\u521a\u521a\u63d0\u53d6\u7684\u8001\u7f57\u8138\u90e8\u7167\u7247\u76ee\u5f55\uff0c\u8bad\u7ec3\u7684\u6a21\u578b\u8f93\u51fa\u5230 models \u4e0b\u3002<\/p>\n\n\n\n<p><br>\u8fd9\u6837\u5c31\u8ba9\u5b83\u4e00\u76f4\u8dd1\u7740\u5c31\u884c\u4e86\u3002<br><\/p>\n\n\n\n<p>\u673a\u5668\u5b66\u4e60\u8bad\u7ec3\u9700\u8981\u4e00\u6bb5\u65f6\u95f4\uff0c\u6839\u636e\u4f60\u7684\u4e0d\u540c\u56e0\u7d20\u8bad\u7ec3\u65f6\u957f\u4e0d\u540c\uff0c\u6bd4\u5982\u4f7f\u7528 CPU \u7684\u8bdd\u4f1a\u8d3c\u6162\uff0cGPU \u4f1a\u5feb\u4e00\u4e9b\uff0c\u6211\u8fd9\u91cc\u6f14\u793a\u4f7f\u7528\u7684\u662f AMD\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/80\/v2-5e81ae2a4f5bb7357bcb5291faa8ccc9_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u66f4\u597d\u7684\u65b9\u5f0f\u662f\u53bb\u8d2d\u4e70\u4e91 GPU \u670d\u52a1\u5668\uff0c\u5728\u4e0a\u9762\u4f7f\u7528 GPU \u642d\u5efa\u8bad\u7ec3\uff0c\u6bd4\u5982<a target=\"_blank\" href=\"https:\/\/www.aliyun.com\/product\/ecs?userCode=aqcwjw7c\" rel=\"noreferrer noopener\">\u963f\u91cc\u4e91<\/a>\u5c31\u4e0d\u9519\u3002<\/p>\n\n\n\n<p>\u5728\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u4ee5\u770b\u5230\u9884\u89c8\u6548\u679c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-8df64a46a223b15d80f6e90bdb5ff614_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u8bad\u7ec3\u7684\u5dee\u4e0d\u591a\uff0c\u5f97\u5230\u6a21\u578b\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u5408\u6210\u89c6\u9891\u4e86\uff0c\u4f7f\u7528 conver \u547d\u4ee4\uff0c\u50cf\u8fd9\u6837\uff1a<\/p>\n\n\n\n<p>python faceswap.py convert -i ~\/videos\/muscle.mp4 -al ~\/videos\/muscle_alignments.fsa -o ~\/Desktop\/hahha -m ~\/models\/muscle_lyh_model -w ffmpeg<\/p>\n\n\n\n<p>\u8fd9\u91cc -i \u6307\u7684\u662f\u6211\u4eec\u60f3\u8981\u5408\u6210\u7684\u89c6\u9891\uff0c fsa \u6587\u4ef6\u662f\u5728\u5c06\u89c6\u9891\u63d0\u53d6\u8fc7\u7a0b\u83b7\u53d6\u7684\uff0c -o \u6307\u7684\u662f\u5c06\u6362\u8138\u540e\u7684\u89c6\u9891\u653e\u5230\u6307\u5b9a\u7684\u76ee\u5f55\uff0c -m \u5c31\u662f\u4f60\u8bad\u7ec3\u597d\u7684\u6a21\u578b\uff0c -w \u4f7f\u7528 ffmpeg\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic4.zhimg.com\/80\/v2-844a7fa6f26a1deba5600e3f21c86111_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>ok\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u5f97\u5230\u6362\u8138\u540e\u7684\u89c6\u9891\u4e86\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-f8d91ee445be01ee415246491ea110e9_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u6d41\u7a0b\u5c31\u662f\u8fd9\u4e48\u4e2a\u6d41\u7a0b\uff0c\u5e0c\u671b\u5bf9\u4f60\u6709\u5e2e\u52a9\u3002<\/p>\n\n\n\n<p><br>\u6700\u540e\uff0c\u4e0b\u9762\u8fd9\u4e2a\u662f\u6211\u7684\u5c0f\u53f7\uff0c\u8fdb\u6765\u542c\u6211\u5439\u725b\u76ae\uff0c\u522b\u5fd8\u4e86\u5173\u6ce8\u4e00\u6ce2\uff0c\u4ee5\u9632\u5931\u8054\u3002<br>\u516c\u4f17\u53f7\uff1a<strong>\u5c0f\u5e05b\u548c\u4ed6\u7684\u670b\u53cb\u4eec<\/strong>\uff0c\u522b\u8f7b\u6613\u5173\u6ce8\uff0c\u5bb9\u6613\u7231\u4e0a\u6211\uff01<br>\u90a3\u4e48\u6211\u4eec\u4e0b\u56de\u89c1\uff0c<strong>peace\uff01<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u200b\u6700\u8fd1\u6709 b \u53cb\u7ed9\u6211\u63a8\u4e86\u4e2a b \u7ad9\u7684\u89c6\u9891\uff1a\u808c\u8089\u91d1\u8f6e\uff0c\u95ee\u6211\u5982\u4f55\u5b9e\u73b0\u8fd9\u79cd\u89c6\u9891\u91cc\u9762\u6362\u8138\u7684\uff1f \u6211\u8bf4\u7f51\u4e0a\u6709\u76f8\u5173\u6559\u7a0b\uff0c\u4f60\u53bb\u641c\u4e00\u4e0b\uff0c\u4ed6\u8bf4\u770b\u7684\u4e91\u91cc\u96fe\u91cc\uff0c\u80fd\u4e0d\u80fd\u8ba9\u6211\u7528\u5c0f\u5e05b\u7684\u98ce\u683c\uff0c\u51fa\u4e00\u671f\u901a\u719f\u6613\u61c2\u7684\uff0c\u8ba9\u4eba\u770b\u5b8c\u5c31\u4f1a\u64cd\u4f5c\u7684\u90a3\u79cd\u3002 \u6211\u56de\u4e86\u53e5\uff1a\u8fd9&#8230;\u662f\u8981\u5e72\u561b\uff1f\u5f97\u4e0d\u5230\u5973&hellip;<\/p>\n","protected":false},"author":1,"featured_media":6467,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[303],"tags":[600,601],"_links":{"self":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6466"}],"collection":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6466"}],"version-history":[{"count":1,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6466\/revisions"}],"predecessor-version":[{"id":6468,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6466\/revisions\/6468"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/media\/6467"}],"wp:attachment":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}