• Tensoflow目标检测实战(4)训练模型转换至tflite并部署


    官方参考笔记

    ..../models/research/object_detection/colab_tutorials/convert_odt_model_to_TFLite.ipynb

    1.  下载预训练模型或自己数据训练得到的模型

    wget http://download.tensorflow.org/models/object_detection/tf2/20200711/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8.tar.gz

    以mobilenetV模型为例,解压后文件包括 :

    根目录

    checkpoint目录(模型主要文件)

     

     2. 输出pb模型文件,inference graph

    1. python object_detection/export_tflite_graph_tf2.py \
    2. --trained_checkpoint_dir ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/checkpoint \
    3. --output_directory ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/tflite \
    4. --pipeline_config_path ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/pipeline.config

    运行结果

    1. 2022-09-26 00:33:04.424700: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    2. 2022-09-26 00:33:04.468000: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    3. 2022-09-26 00:33:04.468301: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    4. 2022-09-26 00:33:04.479873: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA
    5. To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
    6. 2022-09-26 00:33:04.480393: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    7. 2022-09-26 00:33:04.480556: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    8. 2022-09-26 00:33:04.480691: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    9. 2022-09-26 00:33:05.261160: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    10. 2022-09-26 00:33:05.261287: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    11. 2022-09-26 00:33:05.261350: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    12. 2022-09-26 00:33:05.261616: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1510] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 9858 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3060, pci bus id: 0000:01:00.0, compute capability: 8.6
    13. 2022-09-26 00:33:08.810228: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    14. 2022-09-26 00:33:08.810660: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    15. 2022-09-26 00:33:08.810739: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    16. 2022-09-26 00:33:08.810834: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    17. 2022-09-26 00:33:08.810890: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    18. 2022-09-26 00:33:08.810943: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1510] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 9858 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3060, pci bus id: 0000:01:00.0, compute capability: 8.6
    19. 2022-09-26 00:33:09.697849: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    20. 2022-09-26 00:33:09.697982: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    21. 2022-09-26 00:33:09.698051: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    22. 2022-09-26 00:33:09.698146: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    23. 2022-09-26 00:33:09.698216: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    24. 2022-09-26 00:33:09.698272: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1510] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 9858 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3060, pci bus id: 0000:01:00.0, compute capability: 8.6
    25. WARNING:tensorflow:Skipping full serialization of Keras layer , because it is not built.
    26. W0926 00:33:09.972333 140118163120320 save_impl.py:72] Skipping full serialization of Keras layer , because it is not built.
    27. WARNING:tensorflow:Skipping full serialization of Keras layer , because it is not built.
    28. W0926 00:33:10.072510 140118163120320 save_impl.py:72] Skipping full serialization of Keras layer , because it is not built.
    29. WARNING:tensorflow:Skipping full serialization of Keras layer
  • 相关阅读:
    java实现对指定的敏感词汇进行过滤
    栈和队列的概念和实现
    Spring事务
    Docker 介绍
    Springboot毕设项目班级综合信息管理系统1ro30(java+VUE+Mybatis+Maven+Mysql)
    Linux 网络操作命令Telnet
    Rust常用特型之TryFrom和TryInto特型
    TechEmpower 21轮Web框架 性能评测 -- C# 的性能 和 Rust、C++并驾齐驱
    vue中数据代理和事件处理
    Vuetify3:固定快捷按钮在屏幕右边
  • 原文地址:https://blog.csdn.net/pocean2012/article/details/127044820