简体   繁体   中英

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]. 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). 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). Is it helpful?

This also suggests, that you should rather go with collegues advice, as CRF has nothing to do with your problem. CRF is a classifier, sequence classifier to be exact, requiring labeled examples to learn from and has nothing to do with the setting presented.

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.
  • 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 .

Consequently you are trying to find {a_i}_{i=1}^N such that they minimize

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.

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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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