shepnerd / inpainting_gmcnn

Image Inpainting via Generative Multi-column Convolutional Neural Networks, NeurIPS2018
MIT License
428 stars 98 forks source link

Questions about implementation #3

Closed hi-zhengcheng closed 5 years ago

hi-zhengcheng commented 5 years ago

@shepnerd Thank you for the great work. After reading the paper and code, I can not understand the following code quite well. Need your help.

When computing relative similarity between v and s:

https://github.com/shepnerd/inpainting_gmcnn/blob/fe5295ea8029e59a9cd3ae5547463cf188450229/tensorflow/net/ops.py#L330

    def calc_relative_distances(self, axis=3):
        epsilon = 1e-5
        div = tf.reduce_min(self.raw_distances, axis=axis, keep_dims=True)
        relative_dist = self.raw_distances / (div + epsilon)
        return relative_dist

The paper said: Screen Shot 2019-03-22 at 04 31 44

In my understanding:

  1. max(r) in paper is the div in the code.
  2. When s is not equal to value in div, the code is OK.
  3. When s is equal to the value in div, as the paper said, div should exclude this value first, then find another suitable value.

But the code didn't handle the condition when s is equal to the value in div and didn't exclude it. Is this a small bug in the code or something wrong in my understanding ?

Hope I described it clearly.

shepnerd commented 5 years ago

The given implementation does not deal with your mention condition. We found that omitting excluding step can still encourage patches to find diverse nearest neighbors. Besides, using that step does not improve such diversity further obviously but it does increase a lot computational burden. We will put that in the disclaimer.

hi-zhengcheng notifications@github.com 于2019年3月22日周五 下午7:56写道:

@shepnerd https://github.com/shepnerd Thank you for the great work. After reading the paper and code, I can not understand the following code quite well. Need your help.

When computing relative similarity between v and s:

https://github.com/shepnerd/inpainting_gmcnn/blob/fe5295ea8029e59a9cd3ae5547463cf188450229/tensorflow/net/ops.py#L330

def calc_relative_distances(self, axis=3):
    epsilon = 1e-5
    div = tf.reduce_min(self.raw_distances, axis=axis, keep_dims=True)
    relative_dist = self.raw_distances / (div + epsilon)
    return relative_dist

The paper said: [image: Screen Shot 2019-03-22 at 04 31 44] https://user-images.githubusercontent.com/33408107/54820165-79c1f500-4c5b-11e9-895e-21abf1c0fb62.png

In my understanding:

  1. max(r) in paper is the div in the code.
  2. When s is not equal to value in div, the code is OK.
  3. When s is equal to the value in div, as the paper said, div should exclude this value first, then find another suitable value.

But the code didn't handle the condition when s is equal to the value in div and didn't exclude it. Is this a small bug in the code or something wrong in my understanding ?

Hope I described it clearly.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/shepnerd/inpainting_gmcnn/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/AE1PCLMwxlbVQKxTJJGxvrHHVjnLZOOHks5vZMTQgaJpZM4cDaeH .

hi-zhengcheng commented 5 years ago

Got it, thanks a lot.