DeepLabV3,珊瑚分割和classification/detection

DeepLabV3, segmentation and classification/detection on coral

我正在尝试使用 DeepLabV3 在 Coral 上进行图像分割和对象 detection/classification。

我能够在珊瑚上使用 DeepLabV3 成功地 运行 semantic_segmentation.py 示例,但它只显示了一个对象被分割的图像。

我看到它为颜色分配了标签 - 我如何将我根据模型的标签信息制作的 labels.txt 文件关联到这些颜色? (我怎么知道哪个颜色对应哪个标签)

当我尝试 运行 引擎=检测引擎(args.model)

使用 deeplab 模型,出现错误

ValueError: Dectection model should have 4 output tensors!This model has 1.

我猜这是错误的做法?

谢谢!

我相信您已就同一问题联系过我们。我只是想把答案贴在这里供其他人参考:

"The detection model usually have 4 output tensors to specifies the locations, classes, scores, and number and detections. You can read more about it here. In contrary, the segmentation model only have a single output tensor, so if you treat it the same way, you'll most likely segfault trying to access the wrong memory region. If you want to do all three tasks on the same image, my suggestion is to create 3 different engines and feed the image into each. The only problem with this is that each time you switch the model, there will likely be data transfer bottleneck for the model to get loaded onto the TPU. We have here an example on how you can run 2 models on a single TPU, you should be able to modify it to take 3 models."

在最后一条评论中,我刚刚看到您添加了:

how do i associate the labels.txt file that I made based off of the label info of the model to these colors

我只是认为这不是您可以为细分模型做的事情,但也许我只是对您的查询感到困惑?

以对象检测模型为例,有 4 个输出张量,第二个张量给你一个 id 数组与某个 class 关联,你可以映射到一个标签文件。分割模型只给出对象周围的像素。

[编辑] 抱歉,看起来我是那个对细分模型感到困惑的人。 引用来自我的大学:) "你有兴趣知道标签的名称,你可以从Semantic_segmentation.py中的结果数组中找到该标签对应的整数。其中结果是class每个像素的化数据。

例如;

如果您在 bird.jpg 中打印结果数组作为输入,您会发现很少有像素值为 3,它对应 pascal_voc_segmentation_labels.txt 中的第 4 个标签(因为索引从 0 开始)。"