离线模型预测与Custom Vision Portal快速测试不同 项目信息原始图片快速测试简历门户离线预测

问题描述

我使用Azure自定义视觉训练了对象检测模型,并且在门户中使用“快速测试”完成的预测与脱机获得的预测(提供了示例代码)不同。

项目信息

域:“常规(紧凑型)”

导出功能'基本平台(Tensorflow,CoreML,ONNX等)'

当我导出所选文件时:“ Tensorflow”>“ Tensorflow”

原始图片

enter image description here

快速测试(简历门户)

我只使用了50张猫的图像数据集。 在门户中,我得到以下结果:

enter image description here

离线预测

enter image description here

(为实现框可视化,我将以下代码添加到了导出.zip文件中提供的'prediction.py'示例代码中的main方法中)

print("Predictions[0]",predictions[0]['boundingBox']['left'])
    image_cv = cv2.imread(image_filename)
    HEIGHT,WIDTH,channels = image_cv.shape
    for i in range(len(predictions)):
        print(predictions[i],"\n")
        # TESTING#
        x1,y1 = predictions[i]['boundingBox']['left'],predictions[i]['boundingBox']['top']
        x2,y2 = x1 + predictions[i]['boundingBox']['width'],y1 + predictions[i]['boundingBox']['height']
        x1,y1,x2,y2 = round(x1 * WIDTH),round(y1 * HEIGHT),round(x2 * WIDTH),round(y2 * HEIGHT)

        image_cv = cv2.rectangle(image_cv,(x1,y1),(x2,y2),color=(0,0),thickness=1)

        # show_names and show_percentage:
        label = "%s : %.3f" % (predictions[i]['tagName'],predictions[i]['probability'])

        b = np.array([x1,y2]).astype(int)
        cv2.putText(image_cv,label,(b[0],b[1] - 10),cv2.FONT_HERShey_PLAIN,1,(100,3)
        cv2.putText(image_cv,(255,255,255),1)

    cv2.imwrite("Predicted-img.jpg",image_cv)

有人可以帮助我找出问题所在吗?我可以提供'model.pb'文件和所需的示例代码。我不确定是否弄乱了导出设置或其他小细节。

Here是指向我的项目的仓库的链接,可能有帮助

还有一个Link是我打开的Microsoft常见问题解答

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)