运行预转换的神经网络

要使用评估套件对随机图像运行图像分类神经网络,请执行以下操作:

  1. 安装一个预构建的镜像并连接到主板,如 这里 所述。

  2. 在目标环境中,首先进入model目录:

    $ cd /usr/share/synap/models/image_classification/imagenet/model/mobilenet_v2_1.0_224_quant/
    
  3. 然后使用随机输入,测试模型推理时间:

    $ synap_cli random
    Flush/invalidate: yes
    Loop period (ms): 0
    Network inputs: 1
    Network outputs: 1
    Input buffer: input size: 150528 : random
    Output buffer: output size: 1001
    
    Predict #0: 12.61 ms
    
    Inference timings (ms):  load: 28.37  init: 66.99  min: 12.60  median: 12.60  max: 12.60  stddev: 0.00  mean: 12.60
    
  4. 然后使用样本图像,测试模型精度:

    $ synap_cli_ic ../../sample/goldfish_224x224.jpg
    
    Loading network: model.nb
    Input image: ../../sample/goldfish_224x224.jpg
    Classification time: 3.15 ms (pre:0.56, inf:2.53, post:0.05)
    Class  Confidence  Description
        1     18.9874  goldfish, Carassius auratus
      112      9.2959  conch
      927      8.7025  trifle
       29      8.2081  axolotl, mud puppy, Ambystoma mexicanum
      122      7.7136  American lobster, Northern lobster, Maine lobster, Homarus americanus
    

要了解其他AI演示, 请参阅 使用SyNAP进行机器学习