我们正在使用coral stick和我们创建的自定义网络(基于vgg作为主干)。 我们使用的edge tpu版本是2.11
网络返回2个输出:形状1*12*12*65和1*12*12*256。 我们用python这样称呼网络:
def _run_net(self, crop : np.ndarray):
orig_w = crop.shape[1]
orig_h = crop.shape[0]
if orig_w != WIDTH or orig_h != HEIGHT:
crop = cv2.resize(crop, (WIDTH, HEIGHT))
image = crop.reshape(1, HEIGHT, WIDTH, 1)
all_data = self.engine.RunInference(image.flatten())[1]
tensor_sizes = self.engine.get_all_output_tensors_sizes()
num_points = int(math.sqrt(tensor_sizes[0] / 65))
raw_points = all_data[:tensor_sizes[0]]
raw_points = raw_points.reshape((1, num_points, num_points, 65))
raw_descriptors = all_data[tensor_sizes[0]:]
raw_descriptors = raw_descriptors.reshape((1, num_points, num_points, 256))
#Imprtant Note! the copy of raw points and desc here is a must, because as long as memory is held the net always return
#the same results!!! this seems to be a bug in coral
return (raw_points, raw_descriptors, orig_w, orig_h) #does not work
#return (np.copy(raw_points), np.copy(raw_descriptors), orig_w, orig_h) #works ok!
在python调用原始的\u点和原始的\u描述符之前 对同一个网络(甚至引擎的新实例)的每次调用 将产生相同的输出。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐