当前位置: 首页 > news >正文

网页游戏排行榜2011站长工具seo综合查询工具

网页游戏排行榜2011,站长工具seo综合查询工具,企业做网站一般多少钱,做pc端网站适配8月AI实战:工业视觉缺陷检测 –基于tflite的yolov8模型优化和推理 操作视频见B站连接:aidlux模型优化工业缺陷检测~~完美用我的华为手机实现缺陷检测的推理bilibiliaidlux模型优化工业缺陷检测~~完美用我…

8月AI实战:工业视觉缺陷检测

–基于tflite的yolov8模型优化和推理

操作视频见B站连接:aidlux模型优化+工业缺陷检测~~完美用我的华为手机实现缺陷检测的推理bilibiliaidlux模型优化+工业缺陷检测~~完美用我的华为手机实现缺陷检测的推理

1 模型优化

将onnx模型转化为tflite模型

打开网站:http://aimo.aidlux.com/
输入试用账号和密码:账号:AIMOTC001 ,密码:AIMOTC001

通过页面中的提示AI Model Optimizer,依次执行步骤①上传模型②选择目标平台③参数设置④转换结果。

通过上述①-④可将onnx模型转为tflite模型

模型转换过程包含如下日志信息

2023-09-07 19:47:05,969 - INFO : Optimization started.
2023-09-07 19:47:05,970 - INFO : [ONNX-SIM] Clean ONNX Model input node.
2023-09-07 19:47:06,733 - INFO : [ONNX2TFLITE] Start converting to TFLITE.
2023-09-07 19:47:28,511 - INFO : Model optimization done.

2 推理的py文件

模型采用课程中提供的yolov8_slimneck_SIOU.ONNX,转化完模型路径及名称,如下

# 模型
model_path = "/home/lesson3/yolov8_slimneck_SIOU_tflite/yolov8_slimneck_SIOU_fp32.tflite"
# 测试图片路径
image_path = "/home/lesson3/test"

模型推理过程包含如下步骤:

  1. 初始化aidlite类并创建aidlite对象
aidlite = aidlite_gpu.aidlite()
print("ok")
  1. 加载模型
value = aidlite.ANNModel(model_path, [640 * 640 * 3 * 4], [8400 * 11 * 4], 4, 0)
print("gpu:", value)

包含遍历每一张图片

for root, dirs, files in os.walk(image_path):num = 0for file in files:file = os.path.join(root, file)frame = cv2.imread(file)x_scale = frame.shape[1] / 640y_scale = frame.shape[0] / 640

将图片转换为模型输入的640*640尺寸

img = cv2.resize(frame, (640, 640))
# img_copy=img.co
img = img / 255.0
img = np.expand_dims(img, axis=0)
img = img.astype(dtype=np.float32)
print(img.shape)
  1. 传入模型输入数据
aidlite.setInput_Float32(img)
  1. 执行推理
start = time.time()
aidlite.invoke()
end = time.time()
timerValue = 1000 * (end - start)
print("infer time(ms):{0}", timerValue)
  1. 获取输出
pred = aidlite.getOutput_Float32(0)
# print(pred.shape)
pred = np.array(pred)
print(pred.shape)
pred = np.reshape(pred, (8400, 11))
print(pred.shape)  # shape=(8400,11)
  1. 后处理,解析输出
boxes, scores, classes = postProcess(pred, confThresh, NmsThresh)
  1. 绘制保存图像
ret_img = draw(frame, x_scale, y_scale, boxes, scores, classes)
ret_img = ret_img[:, :, ::-1]
num += 1
image_file_name = "/home/result/res" + str(num) + ".jpg"

​ 8. 保存图片

cv2.imwrite(image_file_name, ret_img)
http://www.yidumall.com/news/38259.html

相关文章:

  • 让人做网站需要注意什么广州网站排名优化报价
  • java在线编程网站最新营销模式有哪些
  • wordpress产品页名称seo运营经理
  • 网页设计自我介绍模板代码福州seo推广服务
  • 沈阳开发网站公司seo提升排名
  • 荣茂网站建设济南网站推广优化
  • 柳州城市的城乡建设管理局网站seo团队管理系统
  • php网站免费模板seo自动发布外链工具
  • 如何把网站做的和别人一样永久域名查询
  • 网站专题制作流程英语培训
  • 一级a做爰小说免费网站google官方下载app
  • python做网站有优势网络销售怎么聊客户
  • 做的新网站到首页又下去了成都百度搜索排名优化
  • 济南建公司网站简短的软文范例
  • 抖音seo排名源码无锡seo网站管理
  • 网站如何做公安部备案seo怎么做教程
  • html制作旅游景点网页合肥seo网站管理
  • 哪家高端网站建设好国产免费crm系统有哪些在线
  • 商用营销型网站建设优化建站软文代发布
  • 企业网站模板 css网址收录网站
  • 网站建设收益分析做seo需要投入的成本
  • 临港注册公司优惠政策seo双标题软件
  • 列举一个网络营销的案例刷移动关键词优化
  • 北京网站建设好吗河南网站优化
  • 做游戏课程网站seo排名优化教学
  • 车牌照丢失能在网站做吗自媒体发布平台有哪些
  • 网站备案号代码网店推广运营策略
  • 德保网站建设深圳网络营销信息推荐
  • 九江做网站的公司大数据营销案例分析
  • 垂直网站做排名企业网站优化技巧