{"id":280,"date":"2022-06-22T14:33:57","date_gmt":"2022-06-22T14:33:57","guid":{"rendered":"https:\/\/yakazoo.net\/wordpress\/?p=280"},"modified":"2022-06-22T14:33:59","modified_gmt":"2022-06-22T14:33:59","slug":"coreml%e3%83%a2%e3%83%87%e3%83%ab%e3%81%ae%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%b5%e3%82%a4%e3%82%ba%e3%82%92%e7%b8%ae%e5%b0%8f%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/yakazoo.net\/wordpress\/index.php\/2022\/06\/22\/280\/","title":{"rendered":"CoreML\u30e2\u30c7\u30eb\u306e\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u3092\u7e2e\u5c0f\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"\n<p>CoreML\u30e2\u30c7\u30eb\u3092\u4f7f\u7528\u3059\u308b\u3068\u6a5f\u68b0\u5b66\u7fd2\u304c\u7c21\u5358\u306b\u51fa\u6765\u308b\u30a2\u30d7\u30ea\u304c\u4f5c\u308c\u3066\u4fbf\u5229\u3067\u3059\u3088\u306d\u3002\u3057\u304b\u3057\u6c17\u306b\u306a\u308b\u306e\u306fCoreML\u30e2\u30c7\u30eb\u306e\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u3067\u3059\u3002100MB\u3084200MB\u306a\u3069\u304c\u5f53\u305f\u308a\u524d\u306e\u30b5\u30a4\u30ba\u306b\u306a\u3063\u3066\u304d\u307e\u3059\u3002\u305d\u306e\u307e\u307e\u4f7f\u7528\u3059\u308b\u3068\u30a2\u30d7\u30ea\u306e\u30b5\u30a4\u30ba\u3082\u304b\u306a\u308a\u5927\u304d\u306a\u3082\u306e\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u3001\u30a2\u30d7\u30ea\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u3082\u3089\u3046\u969c\u58c1\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u53ef\u80fd\u6027\u304c\u9ad8\u3044\u3067\u3059\u3002\u4eca\u56de\u306f\u3053\u306e\u5927\u304d\u306aCoreML\u30e2\u30c7\u30eb\u306e\u30b5\u30a4\u30ba\u3092\u5c0f\u3055\u304f\u3059\u308b\u65b9\u6cd5\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Core ML App\u306e\u30b5\u30a4\u30ba\u306e\u7e2e\u5c0f<\/h2>\n\n\n\n<p>Apple\u306e\u516c\u5f0f\u3067\u7d39\u4ecb\u3055\u308c\u3066\u3044\u308bCoreMLTools\u306b\u3088\u308b\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u91cf\u5b50\u5316\u3092\u884c\u3046\u3053\u3068\u3067\u5b9f\u73fe\u51fa\u6765\u307e\u3059\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.apple.com\/jp\/documentation\/coreml\/reducing_the_size_of_your_core_ml_app\/\">https:\/\/developer.apple.com\/jp\/documentation\/coreml\/reducing_the_size_of_your_core_ml_app\/<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Google Colab<\/strong>\u3092\u4f7f\u7528\u3059\u308b<\/h2>\n\n\n\n<p>Google\u306eColab\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3057\u3066\u3001CoreML\u30e2\u30c7\u30eb\u306e\u30b5\u30a4\u30ba\u7e2e\u5c0f\u3092\u884c\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002Colab\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u306f\u5272\u611b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">GoogleDrive\u306b\u5bfe\u8c61\u306eCoreML\u30e2\u30c7\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b<\/h3>\n\n\n\n<p>\u307e\u305a\u306f\u3058\u3081\u306b\u3001GoogleDrive\u306b\u5bfe\u8c61\u306eCoreML\u30e2\u30c7\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u304a\u304d\u307e\u3059\u3002Colab\u304b\u3089\u3053\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u305fCoreML\u30e2\u30c7\u30eb\u3092\u53c2\u7167\u3057\u3001\u30b5\u30a4\u30ba\u3092\u7e2e\u5c0f\u3057\u305f\u65b0\u305f\u306aCoreML\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Colab\u306bPython\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u5b9f\u884c\u3059\u308b<\/h3>\n\n\n\n<p>Colab\u4e0a\u3067\u4ee5\u4e0b\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u3066\u3001\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067GoogleDrive\u306b\u30b5\u30a4\u30ba\u3092\u7e2e\u5c0f\u3057\u305f\u65b0\u305f\u306aCoreML\u30e2\u30c7\u30eb\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002\u3042\u3068\u306f\u4f5c\u6210\u3055\u308c\u305fCoreML\u30e2\u30c7\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u306f\u3001MyDrive\u306bsample.mlmodel\u3068\u3044\u3046CodeML\u30e2\u30c7\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u3042\u308a\u3001new.mlmodel\u3068\u3044\u3046\u7e2e\u5c0f\u3057\u305f\u65b0\u305f\u306aCoreML\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code python\"><code>import coremltools as ct\nfrom coremltools.models.neural_network import quantization_utils\nfrom google.colab import drive\ndrive.mount('\/content\/drive')\n\nmodel_fp32 = ct.models.MLModel('\/content\/drive\/MyDrive\/sample.mlmodel')\nmodel_fp16 = quantization_utils.quantize_weights(model_fp32, nbits=16)\nct.utils.save_spec(model_fp16, '\/content\/drive\/MyDrive\/new.mlmodel')<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>CoreML\u30e2\u30c7\u30eb\u3092\u4f7f\u7528\u3059\u308b\u3068\u6a5f\u68b0\u5b66\u7fd2\u304c\u7c21\u5358\u306b\u51fa\u6765&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/yakazoo.net\/wordpress\/index.php\/2022\/06\/22\/280\/\">Continue reading<span class=\"screen-reader-text\">CoreML\u30e2\u30c7\u30eb\u306e\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u3092\u7e2e\u5c0f\u3059\u308b\u65b9\u6cd5<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":85,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,23,9,10],"tags":[],"class_list":["post-280","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apple","category-coreml","category-swift","category-10","entry"],"_links":{"self":[{"href":"https:\/\/yakazoo.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/280","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yakazoo.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yakazoo.net\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yakazoo.net\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yakazoo.net\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=280"}],"version-history":[{"count":2,"href":"https:\/\/yakazoo.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/280\/revisions"}],"predecessor-version":[{"id":282,"href":"https:\/\/yakazoo.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/280\/revisions\/282"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/yakazoo.net\/wordpress\/index.php\/wp-json\/wp\/v2\/media\/85"}],"wp:attachment":[{"href":"https:\/\/yakazoo.net\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yakazoo.net\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yakazoo.net\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}