Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
AI_人工智能
TFLite
tflite 模型推理浅见
发布于 2021-07-01 11:41:31 浏览:940
订阅该版
[tocm] 将神经网络模型转换好之后怎么验证模型是否转换成功呢? 1. 看模型大小 2. 用代码验证(模型推理一次) # 前后模型大小对比  # 代码验证 ## 运行模型 运行 TensorFlow Lite 模型涉及几个简单的步骤: 1. 将模型加载到内存中。 2. `Interpreter` 基于现有模型构建一个。 3. 设置输入张量值。 4. 运行推理推理。 5. 读取输出 ## Python 示例代码 请参阅 [label_image.py](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/examples/python/label_image.py) ```python import numpy as np import tensorflow as tf # Load the TFLite model and allocate tensors. interpreter = tf.lite.Interpreter(model_path="converted_model.tflite") interpreter.allocate_tensors() # Get input and output tensors. input_details = interpreter.get_input_details() output_details = interpreter.get_output_details() # Test the model on random input data. input_shape = input_details[0]['shape'] input_data = np.array(np.random.random_sample(input_shape), dtype=np.float32) interpreter.set_tensor(input_details[0]['index'], input_data) interpreter.invoke() # The function `get_tensor()` returns a copy of the tensor data. # Use `tensor()` in order to get a pointer to the tensor. output_data = interpreter.get_tensor(output_details[0]['index']) print(output_data) ```
0
条评论
默认排序
按发布时间排序
登录
注册新账号
关于作者
lebhoryi
这家伙很懒,什么也没写!
文章
30
回答
6
被采纳
1
关注TA
发私信
相关文章
1
RT-Thread AI Kit 相关资料和教程在哪里?
2
20号的开发者大会上,人脸识别AI
3
2020 开发者大会演示的 AI 套件什么时候开源?
4
请问RT-AK有没有部署MobileNet的例子呢
5
请问RT-AK会支持paddlepaddle的模型吗
6
嵌入式比赛中要求的 RT-Thread ai toolkit 能介绍一下吗?
7
使用rt_ai_tools转换模型时报错
8
求一个识别人有没有带口罩的模型?
9
RT-AK的人物检测例子下载后编译失败
10
cube ai部署后报错
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
DMA
USB
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
rt-smart
FAL
I2C_IIC
UART
ESP8266
cubemx
WIZnet_W5500
ota在线升级
PWM
BSP
flash
freemodbus
packages_软件包
潘多拉开发板_Pandora
定时器
ADC
GD32
flashDB
socket
编译报错
中断
Debug
rt_mq_消息队列_msg_queue
keil_MDK
ulog
SFUD
msh
C++_cpp
MicroPython
本月问答贡献
RTT_逍遥
10
个答案
3
次被采纳
xiaorui
3
个答案
2
次被采纳
winfeng
2
个答案
2
次被采纳
三世执戟
8
个答案
1
次被采纳
KunYi
8
个答案
1
次被采纳
本月文章贡献
catcatbing
3
篇文章
5
次点赞
lizimu
2
篇文章
9
次点赞
swet123
1
篇文章
4
次点赞
Days
1
篇文章
4
次点赞
YZRD
1
篇文章
2
次点赞
回到
顶部
发布
问题
投诉
建议
回到
底部