简体   繁体   English

如何使超像素的标签在灰度图中局部一致?

[英]How to make the labels of superpixels to be locally consistent in a gray-level map?

I have a bunch of gray-scale images decomposed into superpixels. 我有一堆分解成超像素的灰度图像。 Each superpixel in these images have a label in the rage of [0-1]. 这些图像中的每个超像素的标签范围均为[0-1]。 You can see one sample of images below. 您可以在下面看到一张图片样本。

Here is the challenge: I want the spatially (locally) neighboring superpixels to have consistent labels (close in value). 这是挑战:我希望在空间上(局部)相邻的超像素具有一致的标签 (值接近)。

I'm kind of interested in smoothing local labels but do not want to apply Gaussian smoothing functions or whatever, as some colleagues suggested. 我对平滑局部标签很感兴趣,但不想像某些同事建议的那样应用高斯平滑函数或其他方法。 I have also heard about Conditional Random Field (CRF). 我也听说过条件随机场(CRF)。 Is it helpful? 有帮助吗?

Any suggestion would be welcome. 任何建议都将受到欢迎。 在此处输入图片说明

I'm kind of interested in smoothing local labels but do not want to apply Gaussian smoothing functions or whatever, as some colleagues suggested. 我对平滑局部标签很感兴趣,但不想像某些同事建议的那样应用高斯平滑函数或其他方法。

And why is that? 为什么是这样? Why do you not consider helpful advice of your colleagues, which are actually right . 为什么您不考虑同事的有用建议,这实际上是对的 Applying smoothing function is the most reasonable way to go. 应用平滑功能是最合理的方法。

I have also heard about Conditional Random Field (CRF). 我也听说过条件随机场(CRF)。 Is it helpful? 有帮助吗?

This also suggests, that you should rather go with collegues advice, as CRF has nothing to do with your problem. 这也表明,您应该选择同事的建议,因为CRF与您的问题无关。 CRF is a classifier, sequence classifier to be exact, requiring labeled examples to learn from and has nothing to do with the setting presented. CRF是精确的分类器,是序列分类器,它需要标记的示例进行学习,并且与给出的设置无关。

What are typical approaches? 有哪些典型方法?

  • The exact thing proposed by your collegues, you should define a smoothing function and apply it to your function values (I will not use a term "labels" as it is missleading, you do have values in [0,1], continuous values, "label" denotes categorical variable in machine learning) and its neighbourhood. 同事们提出的确切建议是,您应该定义一个平滑函数并将其应用于函数值(我不会使用术语“标签”,因为这会误导您,您的确有[0,1]中的值,连续值, “标签”表示机器学习中的类别变量)及其附近。
  • Another approach would be to define some optimization problem, where your current assignment of values is one goal, and the second one is "closeness", for example: 另一种方法是定义一些优化问题,其中当前的值分配是一个目标,而第二个是“紧密度”,例如:

Let us assume that you have points with values {(x_i, y_i)}_{i=1}^N and that n(x) returns indices of neighbouring points of x . 让我们假设你有百分点值{(x_i, y_i)}_{i=1}^Nn(x)返回的相邻点的指数x

Consequently you are trying to find {a_i}_{i=1}^N such that they minimize 因此,您试图找到{a_i}_{i=1}^N ,以使它们最小化

SUM_{i=1}^N (y_i - a_i)^2 + C * SUM_{i=1}^N SUM_{j \in n(x_i)} (a_i - a_j)^2
-------------------------   -   --------------------------------------------
closeness to current   constant to      closeness to neighbouring values
       values         weight each part

You can solve the above optimization problem using many techniques, for example through scipy.optimize.minimize module. 您可以使用多种技术来解决上述优化问题,例如通过scipy.optimize.minimize模块。

I am not sure that your request makes any sense. 我不确定您的要求是否有意义。

Having close label values for nearby superpixels is trivial: take some smooth function of (X, Y), such as constant or affine, taking values in the range [0,1], and assign the function value to the superpixel centered at (X, Y). 对于附近的超像素具有接近的标签值是不重要的:采用(X,Y)的一些平滑函数,例如常数或仿射,采用[0,1]范围内的值,并将函数值分配给以(X为中心的超像素,Y)。

You could also take the distance function from any point in the plane. 您还可以从平面上的任意点获取距离函数。

But this is of no use as it is unrelated to the image content. 但这没有用,因为它与图像内容无关。

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

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