日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無先后,達(dá)者為師

網(wǎng)站首頁(yè) 編程語(yǔ)言 正文

STDC分割網(wǎng)絡(luò):onnx推理

作者:一名CV界的小學(xué)生 更新時(shí)間: 2022-10-29 編程語(yǔ)言
def STDCProcess(img):
    mean = [0.485, 0.456, 0.406]
    std = [0.229, 0.224, 0.225]
    img = cv2.resize(img, (256, 256))
    img = img.astype(np.float32)
    img = img[:, :, ::-1]#  BGR2RGB
    img = (img / 255.0 - mean) / std
    img = np.transpose(img, [2, 0, 1])
    img = np.ascontiguousarray(img)
    img = img.astype(np.float32)
    img = img[np.newaxis, :, :, :]
    return img


def stdcOnnxInfer():
    session = onnxruntime.InferenceSession("D:\\onnx\\danzhizhen-model-2022-01-15.onnx")
    # for root, dirs, files in os.walk("/home/tetra/data/validation/1"):cp
    img = cv2.imread('D:\\images\\youweiji.png')
    cv2.imshow('raw',img)
    img = STDCProcess(img)
    output = session.run(None, {"input": img})[0][0]
    #cv2.imwrite("seg.jpg",output)
    cv2.imshow('sg0',output[0])
    cv2.imshow('sg1', output[1])
    # print(output)
    cv2.waitKey(0)

原文鏈接:https://blog.csdn.net/weixin_40132776/article/details/122543386

欄目分類
最近更新