{"id":757,"date":"2024-04-03T17:13:37","date_gmt":"2024-04-03T08:13:37","guid":{"rendered":"https:\/\/elosove.com\/?p=757"},"modified":"2024-04-03T20:27:17","modified_gmt":"2024-04-03T11:27:17","slug":"cartoonsegmentation%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab-windows11","status":"publish","type":"post","link":"https:\/\/elosove.com\/?p=757","title":{"rendered":"CartoonSegmentation\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb @Windows11"},"content":{"rendered":"\n<p><a href=\"https:\/\/elosove.com\/?p=722\">\u524d\u56de<\/a>\u306fAnime Segmentation\u3092\u4f7f\u3063\u3066\uff12\u6b21\u5143\u7d75\u306e\u80cc\u666f\u5207\u308a\u629c\u304d\u3092\u3057\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u4eca\u56de\u306f<a href=\"https:\/\/github.com\/CartoonSegmentation\/CartoonSegmentation\">Cartoon Segmentation<\/a>\u3092\u8a66\u305d\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3068\u308a\u3042\u3048\u305a\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u30b5\u30f3\u30d7\u30eb\u3092\u52d5\u304b\u3059\u307e\u3067\u3061\u3087\u3063\u3068\u8e93\u3044\u305f\u70b9\u306a\u3069\u304c\u3042\u3063\u305f\u306e\u3067\u30e1\u30e2\u3092\u6b8b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u5b9f\u884c\u74b0\u5883<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>OS: Windows11<\/p>\n\n\n\n<p>CUDA: 11.8<\/p>\n\n\n\n<p>anaconda\u74b0\u5883\u4e0b\u3067\u306e\u4e3b\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u30d0\u30fc\u30b8\u30e7\u30f3<\/p>\n\n\n\n<p>python | 3.10.14<\/p>\n\n\n\n<p><strong>&#8212;<\/strong><\/p>\n\n\n\n<p>mmcv | 2.1.0<\/p>\n\n\n\n<p>mmdet | 3.3.0<\/p>\n\n\n\n<p>mmengine | 0.10.3<\/p>\n\n\n\n<p>openmim | 0.3.9<\/p>\n\n\n\n<p><strong>&#8212;<\/strong><\/p>\n\n\n\n<p>torch | 2.2.2<\/p>\n\n\n\n<p>torchaudio | 2.2.2<\/p>\n\n\n\n<p>torchmetrics | 1.3.2<\/p>\n\n\n\n<p>torchvision | 0.17.2<\/p>\n\n\n\n<p><strong>&#8212;<\/strong><\/p>\n\n\n\n<p>opencv-python | 4.9.0.80<\/p>\n<\/blockquote>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_71 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/elosove.com\/?p=757\/#%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB\" title=\"\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\">\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/elosove.com\/?p=757\/#%E4%BB%AE%E6%83%B3%E7%92%B0%E5%A2%83%E3%81%A8pytroch%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB\" title=\"\u4eee\u60f3\u74b0\u5883\u3068pytroch\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\">\u4eee\u60f3\u74b0\u5883\u3068pytroch\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/elosove.com\/?p=757\/#openmim%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB\" title=\"openmim\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\">openmim\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/elosove.com\/?p=757\/#%E3%81%9D%E3%81%AE%E4%BB%96%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB\" title=\"\u305d\u306e\u4ed6\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\">\u305d\u306e\u4ed6\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/elosove.com\/?p=757\/#%E3%83%A2%E3%83%87%E3%83%AB%E3%81%AE%E3%83%80%E3%82%A6%E3%83%B3%E3%83%AD%E3%83%BC%E3%83%89\" title=\"\u30e2\u30c7\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\">\u30e2\u30c7\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/elosove.com\/?p=757\/#OpenCV%E3%81%AE%E7%A2%BA%E8%AA%8D\" title=\"OpenCV\u306e\u78ba\u8a8d\">OpenCV\u306e\u78ba\u8a8d<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/elosove.com\/?p=757\/#%E5%8B%95%E4%BD%9C%E7%A2%BA%E8%AA%8D\" title=\"\u52d5\u4f5c\u78ba\u8a8d\">\u52d5\u4f5c\u78ba\u8a8d<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/elosove.com\/?p=757\/#UserWarning%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6\" title=\"UserWarning\u306b\u3064\u3044\u3066\">UserWarning\u306b\u3064\u3044\u3066<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/elosove.com\/?p=757\/#%E8%83%8C%E6%99%AF%E9%99%A4%E5%8E%BB%E3%82%B3%E3%83%BC%E3%83%89\" title=\"\u80cc\u666f\u9664\u53bb\u30b3\u30fc\u30c9\">\u80cc\u666f\u9664\u53bb\u30b3\u30fc\u30c9<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB\"><\/span>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u6b86\u3069<a href=\"https:\/\/github.com\/CartoonSegmentation\/CartoonSegmentation\">\u516c\u5f0f\u306eInstall Dependencies<\/a>\u901a\u308a\u3067\u3059\u304c\u30d1\u30c3\u30b1\u30fc\u30b8\u7ba1\u7406\u304cconda,pip,mim\u306e\uff13\u3064\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u3061\u3087\u3063\u3068\u4e0d\u5b89\u2026<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E4%BB%AE%E6%83%B3%E7%92%B0%E5%A2%83%E3%81%A8pytroch%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB\"><\/span>\u4eee\u60f3\u74b0\u5883\u3068pytroch\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"#\u30d7\u30ed\u30b8\u30a7\u30af\u30c8DL\ngit clone https:\/\/github.com\/CartoonSegmentation\/CartoonSegmentation.git\ncd CartoonSegmentation\n# \u4eee\u60f3\u74b0\u5883\u4f5c\u6210\nconda create -n \u74b0\u5883\u540d python=3.10\nconda activate \u74b0\u5883\u540d\nconda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\">#\u30d7\u30ed\u30b8\u30a7\u30af\u30c8DL<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">git<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">clone<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">https:\/\/github.com\/CartoonSegmentation\/CartoonSegmentation.git<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">cd<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">CartoonSegmentation<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># \u4eee\u60f3\u74b0\u5883\u4f5c\u6210<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">conda<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">create<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-n<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">\u74b0\u5883\u540d<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">python=<\/span><span style=\"color: #B5CEA8\">3.10<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">conda<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">activate<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">\u74b0\u5883\u540d<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">conda<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">install<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">pytorch<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">torchvision<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">torchaudio<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">pytorch-cuda=<\/span><span style=\"color: #B5CEA8\">11.8<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-c<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">pytorch<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-c<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">nvidia<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"openmim%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB\"><\/span>openmim\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u300cmim install &#8220;mmcv&gt;=2.0.0&#8243;\u300d\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u304d\u306b\u7ba1\u7406\u8005\u6a29\u9650\u3067\u5b9f\u884c\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p class=\"has-medium-font-size\">\u6ce81.mmcv\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f&#8217;Building wheel&#8230;&#8217;\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u6b62\u307e\u308a30~50\u5206\u3050\u3089\u3044\u304b\u304b\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u6ce82.\u30d3\u30eb\u30c9\u304c\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u306f\u30bf\u30b9\u30af\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3067C++\u3084cuda\u306e\u30b3\u30f3\u30d1\u30a4\u30e9\u304c\u52d5\u3044\u3066\u3044\u308b\u306e\u3092\u898b\u5b88\u3063\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"pip install -U openmim\nmim install mmengine\nmim install &quot;mmcv&gt;=2.0.0&quot;\nmim install mmdet\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCDCAA\">pip<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">install<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-U<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">openmim<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">mim<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">install<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">mmengine<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">mim<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">install<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;mmcv&gt;=2.0.0&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">mim<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">install<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">mmdet<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E3%81%9D%E3%81%AE%E4%BB%96%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB\"><\/span>\u305d\u306e\u4ed6\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"pip install -r requirements.txt\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCDCAA\">pip<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">install<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-r<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">requirements.txt<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E3%83%A2%E3%83%87%E3%83%AB%E3%81%AE%E3%83%80%E3%82%A6%E3%83%B3%E3%83%AD%E3%83%BC%E3%83%89\"><\/span>\u30e2\u30c7\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u516c\u5f0f\u3067\u306fhuggingface-cli\u3092\u4f7f\u3063\u3066\u3059\u3079\u3066\u306e\u30e2\u30c7\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u30bb\u30b0\u30e1\u30f3\u30c6\u30fc\u30b7\u30e7\u30f3\u3060\u3051\u306a\u3089<a href=\"https:\/\/huggingface.co\/dreMaz\/AnimeInstanceSegmentation\/tree\/main\">rtmodel_e60.ckpt<\/a>\u3060\u3051\u3092\u624b\u52d5\u3067models\/AnimeInstanceSegmentation\u306b\u4fdd\u5b58\u3059\u308c\u3070\u52d5\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"mkdir models\\AnimeInstanceSegmentation\n#ckpt\u30d5\u30a1\u30a4\u30eb\u3092\u4e0a\u8a18\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u4fdd\u5b58\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCDCAA\">mkdir<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">models<\/span><span style=\"color: #D7BA7D\">\\A<\/span><span style=\"color: #CE9178\">nimeInstanceSegmentation<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">#ckpt\u30d5\u30a1\u30a4\u30eb\u3092\u4e0a\u8a18\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u4fdd\u5b58<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"OpenCV%E3%81%AE%E7%A2%BA%E8%AA%8D\"><\/span>OpenCV\u306e\u78ba\u8a8d<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u79c1\u306e\u5834\u5408\u306fopencv\u306eGUI\u7cfb\u304c\u5207\u3089\u308c\u305f\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3057\u307e\u3063\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3082\u3057\u7d50\u679c\u3092\u898b\u308b\u3068\u304d\u306b\u300ccv2.imshow()\u300d\u7b49\u3092\u4f7f\u3044\u305f\u3044\u5834\u5408\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u306a\u304a\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"pip uninstall opencv-python-headless opencv-python\npip install opencv-python\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCDCAA\">pip<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">uninstall<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">opencv-python-headless<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">opencv-python<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">pip<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">install<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">opencv-python<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8B%95%E4%BD%9C%E7%A2%BA%E8%AA%8D\"><\/span>\u52d5\u4f5c\u78ba\u8a8d<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u30a2\u30cb\u30e1\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u306e\u30bb\u30b0\u30e1\u30f3\u30c6\u30fc\u30b7\u30e7\u30f3\u30b5\u30f3\u30d7\u30eb\u306f\u300crun_segmentation.ipynb\u300d\u306a\u306e\u3067\u5b9f\u884c\u3057\u3066\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>jupyter\u3092\u4f7f\u308f\u306a\u3044\u5834\u5408\u306fpy\u30d5\u30a1\u30a4\u30eb\u30b3\u30f3\u30d0\u30fc\u30bf\u3092\u4f7f\u3046\u304b\u30b3\u30d4\u30da\u3057\u3066\u6700\u5f8c\u306e\u884c\u306bdrawed.show()\u3092\u4ed8\u3051\u52a0\u3048\u308b\u3068\u7d50\u679c\u3092\u898b\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"UserWarning%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6\"><\/span>UserWarning\u306b\u3064\u3044\u3066<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u4e0a\u8a18\u306e\u65b9\u6cd5\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3001\u63a8\u8ad6\u3092\u5b9f\u884c\u3059\u308b\u3068pytorch\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u9055\u3044\u306b\u3088\u308a\u4e0b\u8a18\u306e\u8b66\u544a\u6587\u304c\u51fa\u307e\u3059\u3002(<a href=\"https:\/\/pytorch.org\/docs\/stable\/generated\/torch.meshgrid.html?highlight=meshgrid#torch.meshgrid\">\u516c\u5f0f\u8a73\u7d30<\/a>)<\/p>\n\n\n\n<p>\u4eca\u56de\u306f\u5b9f\u884c\u306b\u652f\u969c\u304c\u7121\u3044\u306e\u3067\u7121\u8996\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ..\/aten\/src\/ATen\/native\/TensorShape.cpp:2895.)<br>return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]<\/p>\n<\/blockquote>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%83%8C%E6%99%AF%E9%99%A4%E5%8E%BB%E3%82%B3%E3%83%BC%E3%83%89\"><\/span>\u80cc\u666f\u9664\u53bb\u30b3\u30fc\u30c9<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u516c\u5f0f\u306erun_segmentation.ipnb\u3067\u306f\u3042\u304f\u307e\u3067\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u306b\u30de\u30b9\u30af\u3092\u63cf\u753b\u3059\u308b\u3060\u3051\u306a\u306e\u3067\u3001\u30de\u30b9\u30af\u7bc4\u56f2\u4ee5\u5916\u3092\u5207\u308a\u629c\u304dbbox\u306f\u63cf\u753b\u3057\u306a\u3044\u4fee\u6b63\u3092\u52a0\u3048\u305f\u30b3\u30fc\u30c9\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"import cv2\nimport numpy as np\n\nfrom animeinsseg import AnimeInsSeg, AnimeInstances\nfrom animeinsseg.anime_instances import get_color\n\nckpt = r'models\/AnimeInstanceSegmentation\/rtmdetl_e60.ckpt'\n\nmask_thres = 0.3\ninstance_thres = 0.3\nrefine_kwargs = {'refine_method': 'refinenet_isnet'} # set to None if not using refinenet\n# refine_kwargs = None\n\nimgp = 'examples\/my-test.png'\nimg = cv2.imread(imgp)\n\n\nnet = AnimeInsSeg(ckpt, mask_thr=mask_thres, refine_kwargs=refine_kwargs)\ninstances: AnimeInstances = net.infer(\n    img,\n    output_type='numpy',\n    pred_score_thr=instance_thres\n)\n\n\nim_h, im_w = img.shape[:2]\n\n# \u4ee5\u4e0b\u304b\u3089\u4fee\u6b63\u30b3\u30fc\u30c9\n\ndrawed = np.zeros([im_h, im_w], dtype=np.uint8)\n\nfor mask in instances.masks:\n    # add binary mask\n    p = 255 * mask.astype(np.uint8)\n    drawed = drawed + p\n\n\nmasked_image = cv2.bitwise_and(img, img, mask=drawed)\n\ncv2.imwrite('result.jpg',masked_image)\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #C586C0\">import<\/span><span style=\"color: #D4D4D4\"> cv2<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">import<\/span><span style=\"color: #D4D4D4\"> numpy <\/span><span style=\"color: #C586C0\">as<\/span><span style=\"color: #D4D4D4\"> np<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">from<\/span><span style=\"color: #D4D4D4\"> animeinsseg <\/span><span style=\"color: #C586C0\">import<\/span><span style=\"color: #D4D4D4\"> AnimeInsSeg, AnimeInstances<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">from<\/span><span style=\"color: #D4D4D4\"> animeinsseg.anime_instances <\/span><span style=\"color: #C586C0\">import<\/span><span style=\"color: #D4D4D4\"> get_color<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">ckpt = <\/span><span style=\"color: #569CD6\">r<\/span><span style=\"color: #D16969\">&#39;models\/AnimeInstanceSegmentation\/rtmdetl_e60.ckpt&#39;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">mask_thres = <\/span><span style=\"color: #B5CEA8\">0.3<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">instance_thres = <\/span><span style=\"color: #B5CEA8\">0.3<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">refine_kwargs = {<\/span><span style=\"color: #CE9178\">&#39;refine_method&#39;<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #CE9178\">&#39;refinenet_isnet&#39;<\/span><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #6A9955\"># set to None if not using refinenet<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># refine_kwargs = None<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">imgp = <\/span><span style=\"color: #CE9178\">&#39;examples\/my-test.png&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">img = cv2.imread(imgp)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">net = AnimeInsSeg(ckpt, <\/span><span style=\"color: #9CDCFE\">mask_thr<\/span><span style=\"color: #D4D4D4\">=mask_thres, <\/span><span style=\"color: #9CDCFE\">refine_kwargs<\/span><span style=\"color: #D4D4D4\">=refine_kwargs)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">instances: AnimeInstances = net.infer(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    img,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #9CDCFE\">output_type<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #CE9178\">&#39;numpy&#39;<\/span><span style=\"color: #D4D4D4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #9CDCFE\">pred_score_thr<\/span><span style=\"color: #D4D4D4\">=instance_thres<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">im_h, im_w = img.shape[:<\/span><span style=\"color: #B5CEA8\">2<\/span><span style=\"color: #D4D4D4\">]<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># \u4ee5\u4e0b\u304b\u3089\u4fee\u6b63\u30b3\u30fc\u30c9<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">drawed = np.zeros([im_h, im_w], <\/span><span style=\"color: #9CDCFE\">dtype<\/span><span style=\"color: #D4D4D4\">=np.uint8)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> mask <\/span><span style=\"color: #C586C0\">in<\/span><span style=\"color: #D4D4D4\"> instances.masks:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #6A9955\"># add binary mask<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    p = <\/span><span style=\"color: #B5CEA8\">255<\/span><span style=\"color: #D4D4D4\"> * mask.astype(np.uint8)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    drawed = drawed + p<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">masked_image = cv2.bitwise_and(img, img, <\/span><span style=\"color: #9CDCFE\">mask<\/span><span style=\"color: #D4D4D4\">=drawed)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">cv2.imwrite(<\/span><span style=\"color: #CE9178\">&#39;result.jpg&#39;<\/span><span style=\"color: #D4D4D4\">,masked_image)<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306fAnime Segmentation\u3092\u4f7f\u3063\u3066\uff12\u6b21\u5143\u7d75\u306e\u80cc\u666f\u5207\u308a\u629c\u304d\u3092\u3057\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u4eca\u56de\u306fCartoon Segmentation\u3092\u8a66\u305d\u3046\u3068\u601d\u3044\u307e\u3059\u3002 \u3068\u308a\u3042\u3048\u305a\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u30b5\u30f3\u30d7\u30eb\u3092\u52d5\u304b\u3059\u307e\u3067\u3061\u3087\u3063\u3068\u8e93\u3044\u305f\u70b9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":767,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[31],"class_list":["post-757","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-segmentation"],"_links":{"self":[{"href":"https:\/\/elosove.com\/index.php?rest_route=\/wp\/v2\/posts\/757","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elosove.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elosove.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elosove.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elosove.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=757"}],"version-history":[{"count":10,"href":"https:\/\/elosove.com\/index.php?rest_route=\/wp\/v2\/posts\/757\/revisions"}],"predecessor-version":[{"id":778,"href":"https:\/\/elosove.com\/index.php?rest_route=\/wp\/v2\/posts\/757\/revisions\/778"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/elosove.com\/index.php?rest_route=\/wp\/v2\/media\/767"}],"wp:attachment":[{"href":"https:\/\/elosove.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elosove.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elosove.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}