简体   繁体   English

如何从图像的热图数据生成边界框数据?

[英]How to generate bounding box data from heatmap data of an image?

I have a group of images and some separate heatmap data which (imperfectly) explains where subject of the image is.我有一组图像和一些单独的热图数据,它们(不完美地)解释了图像的主题在哪里。 The heatmap data is in a numpy array with shape (224,224,3).热图数据位于形状为 (224,224,3) 的 numpy 数组中。 I would like to generate bounding box data from this heatmap data.我想从此热图数据生成边界框数据。

The heatmaps are not always perfect, So I guess I'm wondering if anyone can think of an intelligent way to do this.热图并不总是完美的,所以我想我想知道是否有人能想到一种聪明的方法来做到这一点。

Here are some examples of what happens when I apply the heatmap data to the image:以下是将热图数据应用于图像时发生的一些示例:

带有热图的猫图像照亮图像的主题

在此处输入图片说明

I found a solution to this in matlab, but I have no idea how to read this code!我在 matlab 中找到了解决方案,但我不知道如何阅读这段代码! I am a python programmer, unfortunately.不幸的是,我是一名 Python 程序员。https://github.com/metalbubble/CAM/tree/master/bboxgeneratorhttps://github.com/metalbubble/CAM/tree/master/bboxgenerator

Anyone have any ideas about how to approach something like this?任何人对如何处理这样的事情有任何想法吗?

I am not quite sure how the heatmap data of your project exactly looks like, but it seems to me that you can use something like Selective Search .我不太确定您项目的热图数据究竟是什么样子,但在我看来,您可以使用Selective Search 之类的东西。 You can also have a look on this interesting paper .你也可以看看这篇有趣的论文 Maybe you can use this approach on your dataset.也许您可以在数据集上使用这种方法。

I'm attempting a similar method for automating the creation of bounding boxes (since, lets face it: creating boxes manually takes along time)我正在尝试一种类似的方法来自动创建边界框(因为,让我们面对现实:手动创建框需要很长时间)

this other stackpost covers a similar idea: EDIT: (i originally had put a link to the current stack post 🤦 - but here is the stack post i was referring to) Generating bounding boxes from heatmap data另一个堆栈帖子涵盖了类似的想法:编辑:(我最初已将链接指向当前堆栈帖子🤦 - 但这是我指的堆栈帖子) 从热图数据生成边界框

the problem at hand that i recognize is that heatmaps can be fragmented and a bit arbitrary.我认识到的手头问题是热图可能是碎片化的,而且有点随意。 the solution that comes to mind initially is setting a threshold of the heat map.最初想到的解决方案是设置热图的阈值。 So in the case of the example heat map images - when applying a bounding box cover all regions that are yellow/orange/red than say green/blue.因此,在示例热图图像的情况下 - 当应用边界框时,覆盖黄色/橙色/红色而不是绿色/蓝色的所有区域。

It depends on how many bounding boxes you need.这取决于您需要多少个边界框。 You can set a threshold and have multiple bounding boxes for each of the highly activated regions, or try connecting the regions (by a morphological operation maybe) and calculate a single bounding box for connected activated pixels.您可以设置阈值并为每个高度激活的区域设置多个边界框,或者尝试连接这些区域(可能通过形态学操作)并为连接的激活像素计算单个边界框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM