Darkflow: 使用来自另一个 python 应用程序的暗流来保存带有预测和边界框的图像

创建于 2018-02-11  ·  5评论  ·  资料来源: thtrieu/darkflow

打印结果后是否有保存带有预测及其边界框的图像?

从 darkflow.net.build 导入 TFNet
导入简历2

选项= {“模型”:“cfg/yolo.cfg”,“负载”:“bin/yolo.weights”,“阈值”:0.1}

tfnet = TFNet(选项)

imgcv = cv2.imread("./sample_img/sample_dog.jpg")
结果 = tfnet.return_predict(imgcv)
打印(结果)

最有用的评论

您可以使用这样的代码

cv2.rectangle(imgcv,
              (result["topleft"]["x"], result["topleft"]["y"]),
              (result["bottomright"]["x"],
               result["bottomright"]["y"]),
              (0, 255, 0), 4)
text_x, text_y = result["topleft"][
    "x"] - 10, result["topleft"]["y"] - 10

cv2.putText(imgcv, result["label"], (text_x, text_y),
            cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 255, 0), 2, cv2.LINE_AA)

其中 result 是 return predict 方法返回的结果列表中的单个元素,而 imgcv 是原始图像。 希望这有帮助!

所有5条评论

您必须编写自己的函数来绘制框并在解析 json 输出后写入图像。

您可以使用这样的代码

cv2.rectangle(imgcv,
              (result["topleft"]["x"], result["topleft"]["y"]),
              (result["bottomright"]["x"],
               result["bottomright"]["y"]),
              (0, 255, 0), 4)
text_x, text_y = result["topleft"][
    "x"] - 10, result["topleft"]["y"] - 10

cv2.putText(imgcv, result["label"], (text_x, text_y),
            cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 255, 0), 2, cv2.LINE_AA)

其中 result 是 return predict 方法返回的结果列表中的单个元素,而 imgcv 是原始图像。 希望这有帮助!

谢谢 !

打印结果后是否有保存带有预测及其边界框的图像?

从 darkflow.net.build 导入 TFNet
导入简历2

选项= {“模型”:“cfg/yolo.cfg”,“负载”:“bin/yolo.weights”,“阈值”:0.1}

tfnet = TFNet(选项)

imgcv = cv2.imread("./sample_img/sample_dog.jpg")
结果 = tfnet.return_predict(imgcv)
打印(结果)

执行此代码时遇到问题。 您能告诉我有关“加载”参数的信息吗?

打印结果后是否有保存带有预测及其边界框的图像?
从 darkflow.net.build 导入 TFNet
导入简历2
选项= {“模型”:“cfg/yolo.cfg”,“负载”:“bin/yolo.weights”,“阈值”:0.1}
tfnet = TFNet(选项)
imgcv = cv2.imread("./sample_img/sample_dog.jpg")
结果 = tfnet.return_predict(imgcv)
打印(结果)

执行此代码时遇到问题。 您能告诉我有关“加载”参数的信息吗?

@abhishek795jha "load" 参数是您的权重文件.......最初我们在训练后将 yolo 权重文件创建为权重文件进行测试。 在训练时,您必须使用命令“--savepb”来保存 .pb 文件,使用 with flow 命令。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

xunkaixin picture xunkaixin  ·  4评论

jubjamie picture jubjamie  ·  4评论

hrshovon picture hrshovon  ·  5评论

wonny2001 picture wonny2001  ·  4评论

pribadihcr picture pribadihcr  ·  5评论