MNN.Tensor exit code -1073740791 (0xC0000409) 解决

x33g5p2x  于2022-03-25 转载在 其他  
字(0.7k)|赞(0)|评价(0)|浏览(272)
出错代码:
# -*- coding: utf-8 -*-
from __future__ import print_function

import os

import numpy as np
import MNN
import cv2

if __name__ == "__main__":
    image=cv2.imread(r'D:\data\ocr\wanqu\Age-Gender-MXNET-main\aaa.jpg')
    image = cv2.resize(image, (64, 64))
    # resize to mobile_net tensor size
    # image = image.astype(np.float32)
    image = image.astype(float)
    # image = image - (103.94, 116.78, 123.68)
    # image = image * (0.017, 0.017, 0.017)
    image = image.transpose((2, 0, 1))

    tmp_input = MNN.Tensor((1, 3, 64, 64), MNN.Halide_Type_Float, image, MNN.Tensor_DimensionType_Caffe)

原因 mnn需要数据类型为float32,float类型就会报错。

正确代码:

# -*- coding: utf-8 -*-
from __future__ import print_function

import os

import numpy as np
import MNN
import cv2

if __name__ == "__main__&#

相关文章