{"id":5625,"date":"2019-09-24T15:25:00","date_gmt":"2019-09-24T06:25:00","guid":{"rendered":"https:\/\/www.lancard.com\/blog\/?p=5625"},"modified":"2025-03-12T11:25:43","modified_gmt":"2025-03-12T02:25:43","slug":"m5stickv%e3%81%a7%e7%8b%ac%e8%87%aa%e3%81%ae%e3%83%a2%e3%83%87%e3%83%ab%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e7%94%bb%e5%83%8f%e8%aa%8d%e8%ad%98","status":"publish","type":"post","link":"https:\/\/www.lancard.com\/blog\/2019\/09\/24\/m5stickv%e3%81%a7%e7%8b%ac%e8%87%aa%e3%81%ae%e3%83%a2%e3%83%87%e3%83%ab%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e7%94%bb%e5%83%8f%e8%aa%8d%e8%ad%98\/","title":{"rendered":"M5StickV\u3067\u72ec\u81ea\u306e\u30e2\u30c7\u30eb\u3092\u4f7f\u3063\u3066\u753b\u50cf\u8a8d\u8b58"},"content":{"rendered":"<p>M5StickV\u3092\u5165\u624b\u3057\u305f\u306e\u3067\u3001\u72ec\u81ea\u306e\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3057\u753b\u50cf\u8a8d\u8b58\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n<a href=\"https:\/\/docs.m5stack.com\/#\/en\/related_documents\/v-training\">V-Training <\/a> \u3092\u5229\u7528\u3059\u308b\u306e\u304c\u4e00\u756a\u304a\u624b\u8efd\u3067\u3059\u304c\u3001\u5225\u306e\u65b9\u6cd5\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>M5StickV\u3067\u306fkmodel\u3068\u3044\u3046\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e\u30e2\u30c7\u30eb\u3092\u4f7f\u3044\u307e\u3059\u3002<br \/>\nTensorFlow Lite\u306e\u30e2\u30c7\u30eb\uff08tflite\uff09\u304b\u3089<a href=\"https:\/\/github.com\/sipeed\/Maix_Toolbox\" rel=\"noopener noreferrer\" target=\"_blank\">Maix Toolbox<\/a>\u3092\u4f7f\u3063\u3066kmodel\u306b\u5909\u63db\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u6700\u521d\u306bGCP\u306eAutoML Vision\u3092\u4f7f\u3063\u3066Edge model\u3092\u4f5c\u6210\u3057\u3001tflite\u30e2\u30c7\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066kmodel\u306b\u5909\u63db\u3057\u3088\u3046\u3068\u3057\u307e\u3057\u305f\u304c\u3001\u4ee5\u4e0b\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre><code class=\"bash\">Fatal: expect FLOAT32 tensor but got UINT8, use '--inference_type=FLOAT' when converting via toco.\n<\/code><\/pre>\n<p>AutoML Vision Edge\u3067\u306f\u3001\u300cQUANTIZED_UINT8\u300d\u306e8bit\u91cf\u5b50\u5316\u30e2\u30c7\u30eb\u306b\u306a\u308a\u307e\u3059\u304c\u3001\u305d\u308c\u3060\u3068\u99c4\u76ee\u3089\u3057\u3044\u3067\u3059\u3002<\/p>\n<p>\u6b21\u306b\u3001Keras\u7d44\u307f\u8fbc\u307f\u306eMobileNet v1\u3092\u4f7f\u3063\u3066\u8ee2\u79fb\u5b66\u7fd2\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u304c\u3001kmodel\u5909\u63db\u6642\u306b\u4ee5\u4e0b\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u307e\u3057\u305f\u3002<\/p>\n<pre><code class=\"bash\">Layer Pad is not supported: Only paddings of [[0,0],[1,1],[1,1],[0,0]] is supported\n<\/code><\/pre>\n<p>\u30d1\u30c7\u30a3\u30f3\u30b0\u306b\u95a2\u3057\u3066\u3001\u306a\u306b\u304b\u9055\u3046\u307f\u305f\u3044\u3067\u3059\u3002<\/p>\n<p>\u7d50\u5c40\u30cd\u30c3\u30c8\u3067\u8abf\u3079\u3066\u3001K210\u3067\u5229\u7528\u53ef\u80fd\u306a\u5b66\u7fd2\u6e08\u307f\u306eMobileNet v1\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3057\u305f\u3002<br \/>\nkmodel\u4f5c\u6210\u306b\u95a2\u3057\u3066\u8272\u3005\u5236\u9650\u304c\u3042\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u65b9\u91dd\u3067\u30e2\u30c7\u30eb\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n<ul>\n<li>\u958b\u767a\u306fGoogle Colaboratory\u3092\u5229\u7528<\/li>\n<li>MobileNet v1\u306e\u8ee2\u79fb\u5b66\u7fd2<\/li>\n<li>\u5b66\u7fd2\u30c7\u30fc\u30bf\u306fgoogle\u306e\u753b\u50cf\u691c\u7d22\u304b\u3089\u53d6\u5f97<\/li>\n<li>\u5206\u985e\u306f\u4ee5\u4e0b\u306e\uff13\u3064\u3000\u72db\u72ac\u3001\u30a2\u30a4\u30dc\u3001\u67f4\u72ac<\/li>\n<\/ul>\n<p>kmodel\u3092\u4f5c\u6210\u3057\u305fGoogle Colab\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u304c\u4ee5\u4e0b\u3067\u3059\u3002<br \/>\n<a href=\"https:\/\/colab.research.google.com\/drive\/1aEM8gkJJPnrtLGYR3yDdsWydU01lq9Y9\" rel=\"noopener noreferrer\" target=\"_blank\">https:\/\/colab.research.google.com\/drive\/1aEM8gkJJPnrtLGYR3yDdsWydU01lq9Y9<\/a><\/p>\n<p>\u4e0a\u8a18\u30da\u30fc\u30b8\u306f\u7de8\u96c6\u30fb\u5b9f\u884c\u4e0d\u53ef\u3067\u3059\u304c\u3001\u300c\u30d5\u30a1\u30a4\u30eb\u300d\uff1e\u300c\u30c9\u30e9\u30a4\u30d6\u306b\u30b3\u30d4\u30fc\u3092\u4fdd\u5b58&#8230;\u300d\u3000\u3059\u308b\u3068\u5404\u81ea\u306eGoogle\u30a2\u30ab\u30a6\u30f3\u30c8\u306eGoogle\u30c9\u30e9\u30a4\u30d6\u306bipynb\u30d5\u30a1\u30a4\u30eb\u304c\u4fdd\u5b58\u3055\u308c\u3001\u7de8\u96c6\u30fb\u5b9f\u884c\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f5c\u6210\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u300cmodel.kmodel\u300d\u3068\u4ee5\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u300cboot.py\u300d\u3092SD\u30ab\u30fc\u30c9\u306b\u30b3\u30d4\u30fc\u3057\u3001M5StickV\u306b\u633f\u3057\u3066\u8d77\u52d5\u3057\u307e\u3059\u3002<br \/>\n\u753b\u50cf\u8a8d\u8b58\u3057accuracy\u304c0.9\u4ee5\u4e0a\u306e\u5834\u5408\u306b\u3001\u7570\u306a\u308b\u8272\u306e\u30e9\u30a4\u30c8\u3092\u70b9\u706f\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u30a2\u30a4\u30dc\u3092\u8a8d\u8b58\u3059\u308b\u3068\u3001\u8d64\u304f\u70b9\u706f<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/uploads\/2019\/09\/aibo-400x300.png\" alt=\"\" width=\"400\" height=\"300\" class=\"aligncenter size-medium wp-image-5646\" srcset=\"https:\/\/www.lancard.com\/blog\/wp-content\/uploads\/2019\/09\/aibo-400x300.png 400w, https:\/\/www.lancard.com\/blog\/wp-content\/uploads\/2019\/09\/aibo.png 500w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/p>\n<p>boot.py<\/p>\n<pre><code class=\"python\">import lcd\nimport image\nimport time\nimport uos\nimport sys\nimport sensor\nimport KPU as kpu\nimport os\n\nfm.register(board_info.BUTTON_B, fm.fpioa.GPIO2)\nbut_b = GPIO(GPIO.GPIO2, GPIO.IN, GPIO.PULL_UP) #PULL_UP is required here!\n\n#fm.register(board_info.LED_W, fm.fpioa.GPIO3)\n#led_w = GPIO(GPIO.GPIO3, GPIO.OUT)\n#led_w.value(1) #RGBW LEDs are Active Low\n\nfm.register(board_info.LED_R, fm.fpioa.GPIO4)\nled_r = GPIO(GPIO.GPIO4, GPIO.OUT)\nled_r.value(1) #RGBW LEDs are Active Low\n\nfm.register(board_info.LED_G, fm.fpioa.GPIO5)\nled_g = GPIO(GPIO.GPIO5, GPIO.OUT)\nled_g.value(1) #RGBW LEDs are Active Low\n\nfm.register(board_info.LED_B, fm.fpioa.GPIO6)\nled_b = GPIO(GPIO.GPIO6, GPIO.OUT)\nled_b.value(1) #RGBW LEDs are Active Low\n\n\nlcd.init(freq=15000000)\nlcd.rotation(2) #Rotate the lcd 180deg\n\nsensor.reset()                      # Reset and initialize the sensor. It will\n                                    # run automatically, call sensor.run(0) to stop\nsensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)\nsensor.set_framesize(sensor.QVGA)   # Set frame size to QVGA (320x240)\nsensor.skip_frames(time = 2000)     # Wait for settings take effect.\nsensor.set_windowing((224, 224))    #  zoom in on the center of the lens\nclock = time.clock()                # Create a clock object to track the FPS.\n\n\nlcd.clear()\nlcd.draw_string(70, 20, \"aibo:Red\")\nlcd.draw_string(70, 40, \"siba:Green\")\nlcd.draw_string(70, 60, \"koma:Blue\")\nlabels = [\"aibo\", \"siba\", \"koma\"]\nleds = [led_r, led_g, led_b]\ntask = kpu.load(\"\/sd\/model.kmodel\")\n\nwhile(True):\n    clock.tick()\n    img = sensor.snapshot()\n    fmap = kpu.forward(task, img)\n    plist = fmap[:]\n    pmax = max(plist)\n    max_index = plist.index(pmax)\n    fps =clock.fps()\n    lcd.display(img)\n    print(\"%s (%.2f), fps:%2.1f\" % (labels[max_index], pmax, fps))\n    for i, led in enumerate(leds):\n        if i == max_index and pmax &gt; 0.9:\n            led.value(0)\n        else:\n            led.value(1)\n<\/code><\/pre>\n<a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-facebook nolightbox\" data-provider=\"facebook\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Facebook\" href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F5625&#038;t=M5StickV%E3%81%A7%E7%8B%AC%E8%87%AA%E3%81%AE%E3%83%A2%E3%83%87%E3%83%AB%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E7%94%BB%E5%83%8F%E8%AA%8D%E8%AD%98&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F5625&#038;p&#091;images&#093;&#091;0&#093;=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F09%2Faibo-400x300.png&#038;p&#091;title&#093;=M5StickV%E3%81%A7%E7%8B%AC%E8%87%AA%E3%81%AE%E3%83%A2%E3%83%87%E3%83%AB%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E7%94%BB%E5%83%8F%E8%AA%8D%E8%AD%98\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"Facebook\" title=\"Share on Facebook\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/facebook.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-twitter nolightbox\" data-provider=\"twitter\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Twitter\" href=\"http:\/\/twitter.com\/share?url=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F5625&#038;text=M5StickV%E3%81%A7%E7%8B%AC%E8%87%AA%E3%81%AE%E3%83%A2%E3%83%87%E3%83%AB%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E7%94%BB%E5%83%8F%E8%AA%8D%E8%AD%98\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"twitter\" title=\"Share on Twitter\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/twitter.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-linkedin nolightbox\" data-provider=\"linkedin\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Linkedin\" href=\"https:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F5625&#038;title=M5StickV%E3%81%A7%E7%8B%AC%E8%87%AA%E3%81%AE%E3%83%A2%E3%83%87%E3%83%AB%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E7%94%BB%E5%83%8F%E8%AA%8D%E8%AD%98\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"linkedin\" title=\"Share on Linkedin\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/linkedin.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-tumblr nolightbox\" data-provider=\"tumblr\" target=\"_blank\" rel=\"nofollow\" title=\"Share on tumblr\" href=\"https:\/\/tumblr.com\/share?s=&#038;v=3&#038;t=M5StickV%E3%81%A7%E7%8B%AC%E8%87%AA%E3%81%AE%E3%83%A2%E3%83%87%E3%83%AB%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E7%94%BB%E5%83%8F%E8%AA%8D%E8%AD%98&#038;u=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F5625\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"tumblr\" title=\"Share on tumblr\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/tumblr.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-mail nolightbox\" data-provider=\"mail\" rel=\"nofollow\" title=\"Share by email\" href=\"mailto:?subject=M5StickV%E3%81%A7%E7%8B%AC%E8%87%AA%E3%81%AE%E3%83%A2%E3%83%87%E3%83%AB%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E7%94%BB%E5%83%8F%E8%AA%8D%E8%AD%98&#038;body=%E3%82%B7%E3%82%A7%E3%82%A2%E3%81%99%E3%82%8B%EF%BC%9A:%20https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F5625\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"mail\" title=\"Share by email\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/mail.png\" \/><\/a>","protected":false},"excerpt":{"rendered":"<p>M5StickV\u3092\u5165\u624b\u3057\u305f\u306e\u3067\u3001\u72ec\u81ea\u306e\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3057\u753b\u50cf\u8a8d\u8b58\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002 V-Training \u3092\u5229\u7528\u3059\u308b\u306e\u304c\u4e00\u756a\u304a\u624b\u8efd\u3067\u3059\u304c\u3001\u5225\u306e\u65b9\u6cd5\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002 M5StickV\u3067\u306fkmodel\u3068\u3044\u3046\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e\u30e2\u30c7\u30eb [&hellip;]<\/p>\n","protected":false},"author":25,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[172,31],"tags":[194,195],"class_list":["post-5625","post","type-post","status-publish","format-standard","hentry","category-iot","category-python","tag-m5stickv","tag-mobilenet"],"_links":{"self":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/5625","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/comments?post=5625"}],"version-history":[{"count":26,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/5625\/revisions"}],"predecessor-version":[{"id":5652,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/5625\/revisions\/5652"}],"wp:attachment":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/media?parent=5625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/categories?post=5625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/tags?post=5625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}