Fleeting Day(VOL.9)

每日总结190430

OpenVINO

运行转换好的IR模型:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from openvino.inference_engine import IENetwork, IEPlugin
from caffe_classes import class_names
import numpy as np
import matplotlib.pyplot as plt
import cv2
import os

imagenet_mean = np.array([104., 117., 124.], dtype=np.float32)

image = cv2.imread('llama.jpeg')
img = cv2.resize(image.astype(np.float32), (227, 227))
img -= imagenet_mean
img = img.reshape((1, 227, 227, 3))
img = img.transpose((0, 3, 1, 2))

model_xml_CPU = 'lrmodels/FP32/frozen_alexnet_model.xml'
model_bin_CPU = os.path.splitext(model_xml_CPU)[0] + ".bin"

model_xml_MYRIAD = 'lrmodels/FP16/frozen_alexnet_model.xml'
model_bin_MYRIAD = os.path.splitext(model_xml_MYRIAD)[0] + ".bin"

plugin = IEPlugin(device='MYRIAD')
net = IENetwork(model=model_xml_MYRIAD, weights=model_bin_MYRIAD)
net.batch_size = 1
input_blob = next(iter(net.inputs))
exec_net = plugin.load(network=net)
outputs = exec_net.infer(inputs={input_blob: img})

class_name = class_names[np.argmax(outputs['prob'])]
probs = outputs['prob'][0, np.argmax(outputs['prob'])]

print(class_name)
print(probs)

Summary

一整天,一开始就没按规矩来,后面随即全部都乱了,花了些时间研究了一番昨天转换好的IR模型的使用方法后,想着大家都放假了,也无心继续折腾,干脆想看一直没看的电影,从网盘里翻出来,花了半个下午给看完。晚饭后陷入又无聊的死循环,几天以来都没动过的念想今天干脆都放开了,深陷无聊中方式只有那一刻能感到自己是活着的。之后把昨天的Economist研读了一番,Fleeting Day即如此。

《Merry Chrismas, Mr.Lawrence》

五月,May Day

文章作者: Hugsy
文章链接: http://binweber.top/2019/04/30/daily_190430/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Sky Inside the Eyewall
支付宝打赏~
微信打赏~