{"id":12517,"date":"2026-06-10T04:10:21","date_gmt":"2026-06-09T20:10:21","guid":{"rendered":"https:\/\/ab123.xyz\/?p=12517"},"modified":"2026-06-10T04:10:21","modified_gmt":"2026-06-09T20:10:21","slug":"tensorflow-lite-%e6%a8%a1%e5%9e%8b%e9%87%8f%e5%8c%96%ef%bc%9a%e4%b8%ba%e7%a7%bb%e5%8a%a8%e7%ab%af%e9%83%a8%e7%bd%b2%e4%bc%98%e5%8c%96%e7%9a%84%e6%9d%83%e5%a8%81%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/ab123.xyz\/?p=12517","title":{"rendered":"TensorFlow Lite \u6a21\u578b\u91cf\u5316\uff1a\u4e3a\u79fb\u52a8\u7aef\u90e8\u7f72\u4f18\u5316\u7684\u6743\u5a01\u6307\u5357"},"content":{"rendered":"<p>\u5728\u79fb\u52a8\u7aef\u90e8\u7f72\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u65f6\uff0c\u6a21\u578b\u4f53\u79ef\u4e0e\u63a8\u7406\u901f\u5ea6\u662f\u51b3\u5b9a\u7528\u6237\u4f53\u9a8c\u7684\u6838\u5fc3\u74f6\u9888\u3002<a href=\"https:\/\/www.tensorflow.org\/lite\/performance\/model_optimization\" target=\"_blank\">TensorFlow Lite \u5b98\u65b9\u91cf\u5316\u5de5\u5177<\/a> \u63d0\u4f9b\u4e86\u4e00\u5957\u5b8c\u6574\u7684\u6a21\u578b\u4f18\u5316\u65b9\u6848\uff0c\u80fd\u591f\u5728\u4e0d\u663e\u8457\u635f\u5931\u7cbe\u5ea6\u7684\u60c5\u51b5\u4e0b\uff0c\u5c06\u6a21\u578b\u5927\u5c0f\u538b\u7f29\u81f3\u539f\u6765\u7684\u56db\u5206\u4e4b\u4e00\uff0c\u5e76\u5927\u5e45\u63d0\u5347\u5728\u624b\u673a\u3001IoT \u8bbe\u5907\u4e0a\u7684\u8fd0\u884c\u6548\u7387\u3002\u672c\u6587\u5c06\u6df1\u5165\u4ecb\u7ecd\u8be5\u5de5\u5177\u7684\u6838\u5fc3\u529f\u80fd\u3001\u72ec\u7279\u4f18\u52bf\u53ca\u5b9e\u9645\u5e94\u7528\u573a\u666f\u3002<\/p>\n<h2>\u6838\u5fc3\u529f\u80fd\uff1a\u4e09\u79cd\u91cf\u5316\u6a21\u5f0f\u6ee1\u8db3\u4e0d\u540c\u9700\u6c42<\/h2>\n<p>TensorFlow Lite \u91cf\u5316\u652f\u6301\u4e09\u79cd\u4e3b\u6d41\u6280\u672f\u3002\u7b2c\u4e00\u662f <strong>\u8bad\u7ec3\u540e\u52a8\u6001\u8303\u56f4\u91cf\u5316<\/strong>\uff0c\u5b83\u4ec5\u6fc0\u6d3b\u6743\u91cd\u4e3a 8 \u4f4d\u6574\u6570\uff0c\u63a8\u7406\u65f6\u5c06\u6fc0\u6d3b\u503c\u52a8\u6001\u91cf\u5316\uff0c\u9002\u5408\u5feb\u901f\u90e8\u7f72\u3002\u7b2c\u4e8c\u662f <strong>\u8bad\u7ec3\u540e\u5168\u6574\u6570\u91cf\u5316<\/strong>\uff0c\u5c06\u6743\u91cd\u548c\u6fc0\u6d3b\u503c\u5747\u6620\u5c04\u5230 8 \u4f4d\u6574\u6570\uff0c\u9700\u63d0\u4f9b\u4ee3\u8868\u6027\u6570\u636e\u96c6\u6821\u51c6\uff0c\u80fd\u83b7\u5f97\u6700\u5927\u6027\u80fd\u63d0\u5347\u3002\u7b2c\u4e09\u662f <strong>\u91cf\u5316\u611f\u77e5\u8bad\u7ec3<\/strong>\uff0c\u5728\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u6a21\u62df\u91cf\u5316\u8bef\u5dee\uff0c\u4f7f\u6a21\u578b\u66f4\u9002\u5e94\u4f4e\u7cbe\u5ea6\u63a8\u7406\uff0c\u9002\u5408\u5bf9\u7cbe\u5ea6\u8981\u6c42\u6781\u9ad8\u7684\u573a\u666f\u3002\u7528\u6237\u53ef\u901a\u8fc7 TensorFlow Lite Converter \u7684 optimize \u53c2\u6570\u4e00\u952e\u542f\u7528\u3002<\/p>\n<h2>\u663e\u8457\u4f18\u52bf\uff1a\u4f53\u79ef\u3001\u901f\u5ea6\u4e0e\u517c\u5bb9\u6027<\/h2>\n<p>\u8be5\u5de5\u5177\u7684\u4f18\u52bf\u4f53\u73b0\u5728\u4e09\u4e2a\u7ef4\u5ea6\u3002\u4f53\u79ef\u65b9\u9762\uff0cFP32 \u6a21\u578b\u7ecf\u5168\u6574\u6570\u91cf\u5316\u540e\u4f53\u79ef\u53ef\u7f29\u51cf 75%\uff0c\u6781\u5927\u8282\u7701\u79fb\u52a8\u8bbe\u5907\u5b58\u50a8\u7a7a\u95f4\u3002\u901f\u5ea6\u65b9\u9762\uff0c\u901a\u8fc7\u5229\u7528 ARM NEON \u6307\u4ee4\u96c6\u548c\u786c\u4ef6\u52a0\u901f\u5668\uff08\u5982\u9ad8\u901a Hexagon\uff09\uff0c\u91cf\u5316\u6a21\u578b\u63a8\u7406\u901f\u5ea6\u53ef\u8fbe\u6d6e\u70b9\u6a21\u578b\u7684 2 \u81f3 4 \u500d\u3002\u517c\u5bb9\u6027\u65b9\u9762\uff0c\u5de5\u5177\u539f\u751f\u652f\u6301 TensorFlow 2.x \u6a21\u578b\uff0c\u5e76\u63d0\u4f9b\u5bf9 TFLite Runtime\u3001Android Neural Networks API \u53ca iOS Core ML \u7684\u5e95\u5c42\u9002\u914d\uff0c\u5f00\u53d1\u8005\u65e0\u9700\u989d\u5916\u7f16\u5199\u5f02\u6784\u4ee3\u7801\u3002<\/p>\n<h2>\u5e94\u7528\u573a\u666f\u4e0e\u5b9e\u6218\u6307\u5357<\/h2>\n<h3>\u667a\u80fd\u624b\u673a\u4e0a\u7684\u5b9e\u65f6\u56fe\u50cf\u5206\u7c7b<\/h3>\n<p>\u5728\u5b89\u9632\u76d1\u63a7\u6216\u793e\u4ea4\u6ee4\u955c\u5e94\u7528\u4e2d\uff0c\u91cf\u5316\u540e\u7684 MobileNetV2 \u6a21\u578b\u53ef\u5728\u4e2d\u7aef\u624b\u673a\u4e0a\u5b9e\u73b0 30 FPS \u4ee5\u4e0a\u7684\u5b9e\u65f6\u63a8\u7406\uff0c\u800c\u6a21\u578b\u5927\u5c0f\u4e0d\u8db3 5 MB\u3002\u5f00\u53d1\u8005\u53ea\u9700\u5728\u8f6c\u6362\u65f6\u8bbe\u7f6e converter.optimizations = [tf.lite.Optimize.DEFAULT] \u5e76\u6307\u5b9a representative_dataset\uff0c\u5373\u53ef\u5b8c\u6210\u90e8\u7f72\u3002<\/p>\n<h3>\u667a\u80fd\u8bed\u97f3\u5524\u9192\u4e0e\u5d4c\u5165\u5f0f\u8bbe\u5907<\/h3>\n<p>\u5bf9\u4e8e\u8d44\u6e90\u53d7\u9650\u7684\u5fae\u63a7\u5236\u5668\uff08\u5982 Arduino Nano 33 BLE\uff09\uff0cTensorFlow Lite Micro \u914d\u5408\u5168\u6574\u6570\u91cf\u5316\uff0c\u53ef\u5c06\u8bed\u97f3\u547d\u4ee4\u8bc6\u522b\u6a21\u578b\u538b\u7f29\u5230\u51e0\u5341 KB\uff0c\u5e76\u4fdd\u6301 95% \u4ee5\u4e0a\u7684\u5524\u9192\u51c6\u786e\u7387\u3002\u4f7f\u7528 tf.lite.TFLiteConverter.from_saved_model \u914d\u5408 int8 \u91cf\u5316\u5373\u53ef\u3002<\/p>\n<h2>\u5982\u4f55\u4f7f\u7528\uff1a\u4e09\u6b65\u8f7b\u677e\u90e8\u7f72<\/h2>\n<p>\u7b2c\u4e00\u6b65\uff0c\u5b89\u88c5 TensorFlow 2.x \u5e76\u51c6\u5907\u597d\u6d6e\u70b9\u6a21\u578b\uff08Keras \u6216 SavedModel \u683c\u5f0f\uff09\u3002\u7b2c\u4e8c\u6b65\uff0c\u7f16\u5199\u91cf\u5316\u811a\u672c\uff1a\u5bfc\u5165 tf.lite\uff0c\u52a0\u8f7d\u6a21\u578b\uff0c\u8bbe\u7f6e optimizations \u548c representative_dataset\u3002\u7b2c\u4e09\u6b65\uff0c\u8fd0\u884c\u8f6c\u6362\u5e76\u4fdd\u5b58 .tflite \u6587\u4ef6\uff0c\u6700\u7ec8\u5728\u79fb\u52a8\u7aef\u5e94\u7528\u4e2d\u4f7f\u7528 TFLite Interpreter \u52a0\u8f7d\u63a8\u7406\u3002\u6240\u6709\u64cd\u4f5c\u5747\u53ef\u5728 Colab \u4e0a\u514d\u8d39\u5b8c\u6210\u3002<\/p>\n<p>\u4f5c\u4e3a\u8c37\u6b4c\u5b98\u65b9\u7ef4\u62a4\u7684\u79fb\u52a8\u7aef\u63a8\u7406\u6846\u67b6\uff0cTensorFlow Lite \u91cf\u5316\u5de5\u5177\u5728 GitHub \u4e0a\u62e5\u6709\u8d85\u8fc7 1.8 \u4e07\u661f\u6807\uff0c\u793e\u533a\u6d3b\u8dc3\u4e14\u6587\u6863\u8be6\u5c3d\u3002\u65e0\u8bba\u662f\u521d\u521b\u56e2\u961f\u8fd8\u662f\u5927\u578b\u4f01\u4e1a\uff0c\u90fd\u80fd\u901a\u8fc7\u5b83\u5b9e\u73b0\u6a21\u578b\u5728\u79fb\u52a8\u8bbe\u5907\u4e0a\u7684\u9ad8\u6548\u843d\u5730\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u79fb\u52a8\u7aef\u90e8\u7f72\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u65f6\uff0c\u6a21\u578b\u4f53\u79ef\u4e0e\u63a8\u7406\u901f\u5ea6\u662f\u51b3\u5b9a\u7528\u6237\u4f53\u9a8c\u7684\u6838\u5fc3\u74f6\u9888\u3002TensorFlow Lite \u5b98\u65b9\u91cf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[15243,15246,15244,15245,6328],"class_list":["post-12517","post","type-post","status-publish","format-standard","hentry","category-4","tag-tensorflow-lite","tag-tflite","tag-15244","tag-15245","tag-ai"],"_links":{"self":[{"href":"https:\/\/ab123.xyz\/index.php?rest_route=\/wp\/v2\/posts\/12517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ab123.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ab123.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ab123.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ab123.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12517"}],"version-history":[{"count":1,"href":"https:\/\/ab123.xyz\/index.php?rest_route=\/wp\/v2\/posts\/12517\/revisions"}],"predecessor-version":[{"id":12519,"href":"https:\/\/ab123.xyz\/index.php?rest_route=\/wp\/v2\/posts\/12517\/revisions\/12519"}],"wp:attachment":[{"href":"https:\/\/ab123.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ab123.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ab123.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}