def get_output_threshold(self): output_info = ffi.new('bmnet_output_info_t *') lib.bmnet_get_output_info(self.net[0], output_info) output_threshold = [] for i in range(output_info.output_num): output_threshold.append(output_info.threshold_array[i]) return output_threshold
def get_output_fmt(self): output_info = ffi.new('bmnet_output_info_t *') lib.bmnet_get_output_info(self.net[0], output_info) output_fmt = [] for i in range(output_info.output_num): output_fmt.append(output_info.fmt_array[i]) return output_fmt
def get_output_shape(self): output_info = ffi.new('bmnet_output_info_t *') lib.bmnet_get_output_info(self.net[0], output_info) output_shape = [] for i in range(output_info.output_num): shape = output_info.shape_array[i] if shape.dim == 1: output_shape.append([shape.n]) elif shape.dim == 2: output_shape.append([shape.n, shape.c]) elif shape.dim == 3: output_shape.append([shape.n, shape.c, shape.h]) elif shape.dim == 4: output_shape.append([shape.n, shape.c, shape.h, shape.w]) return output_shape
def get_output_size(self): output_info = ffi.new('bmnet_output_info_t *') lib.bmnet_get_output_info(self.net[0], output_info) return output_info.output_size
def inference(self, input, output): output_info = ffi.new('bmnet_output_info_t *') lib.bmnet_get_output_info(self.net[0], output_info) lib.bmnet_inference(self.net[0], ffi.from_buffer(input), ffi.from_buffer(output))