Skip to content

tensorflow support maxpoolgrad(MaxUnPool2d)#14860

Merged
alalek merged 1 commit intoopencv:3.4from
vonchenplus:ocv_maxpoolgrad
Jul 4, 2019
Merged

tensorflow support maxpoolgrad(MaxUnPool2d)#14860
alalek merged 1 commit intoopencv:3.4from
vonchenplus:ocv_maxpoolgrad

Conversation

@vonchenplus
Copy link
Copy Markdown
Contributor

@vonchenplus vonchenplus commented Jun 21, 2019

force_builders_only=linux,docs
build_image:Custom=ubuntu-openvino-2019r1:16.04
build_image:Custom Win=openvino-2019r1
build_image:Custom Mac=openvino-2019r1

test_modules:Custom=dnn,python2,python3,java
test_modules:Custom Win=dnn,python2,python3,java
test_modules:Custom Mac=dnn,python2,python3,java

buildworker:Custom=linux-1
test_opencl:Custom=ON
test_bigdata:Custom=1
test_filter:Custom=*

Merge with extra: opencv/opencv_extra#623

@vonchenplus
Copy link
Copy Markdown
Contributor Author

hello @dkurt, current implement is work well, but a little different from tensorflow.
for example:
Input size: (1, 3, 525, 700)
Tensorflow Output size is: (1, 3, 525, 700)
Our Output size is:(1, 3, 524, 700)
I think i should need to fix this problem, any solution?

@dkurt
Copy link
Copy Markdown
Member

dkurt commented Jun 25, 2019

@vonchenplus, For which parameters you have this shapes? Please share input resolution, kernel size, strides and paddings.

@vonchenplus
Copy link
Copy Markdown
Contributor Author

vonchenplus commented Jun 25, 2019

@dkurt ,
for example:
inp = tf.placeholder(tf.float32, [1, 525, 700, 3], 'input')
pool = tf.layers.max_pooling2d(inp, pool_size=(2, 2), strides=(2, 2))
conv = tf.layers.conv2d(inputs=pool, filters=3, kernel_size=[1, 1], padding='VALID')
unpool = MaxUnPooling2D(pool.op, conv)

layer.input(0) == pool.op.input == [1, 525, 700, 3]
layer,input(1) == pool.op.output == [1, 262, 350, 3]
layer.input(2) == conv == [1, 262, 350, 3]
tensorflow's unpool size is [1, 525, 700, 3], current implement size is [1, 524, 700, 3]

the first input has this shapes.

@dkurt
Copy link
Copy Markdown
Member

dkurt commented Jun 25, 2019

Can you please share text graph so we can see if there are useful parameters in TF graph. You can do it in Python:

for node in graph_def.node:
  print(node)

@vonchenplus
Copy link
Copy Markdown
Contributor Author

vonchenplus commented Jun 26, 2019

hello @dkurt, this is MaxPoolGrad text graph Info, .

name: "MaxPoolGrad"
op: "MaxPoolGrad"
input: "X_content"
input: "max_pooling2d/MaxPool"
input: "conv2d/BiasAdd"
attr {
  key: "T"
  value {
    type: DT_FLOAT
  }
}
attr {
  key: "data_format"
  value {
    s: "NHWC"
  }
}
attr {
  key: "ksize"
  value {
    list {
      i: 1
      i: 2
      i: 2
      i: 1
    }
  }
}
attr {
  key: "padding"
  value {
    s: "VALID"
  }
}
attr {
  key: "strides"
  value {
    list {
      i: 1
      i: 2
      i: 2
      i: 1
    }
  }
}

I don't think there are other parameters with the correct shape, so I connect Maxpool's input as the third input, please have a look, thanks.

@alalek
Copy link
Copy Markdown
Member

alalek commented Jul 2, 2019

As usual avoid using of merge commits in patches.
Use rebase instead (git pull --rebase or git rebase -i updated_upstream_head).

To fix that:

  • save you work + git branch -f saved_work
  • setup upstream remote by following this GitHub guide
  • fetch fresh upstream code: git fetch upstream.
  • rebase your commits onto actual 3.4 branch:
    git rebase -i upstream/3.4
    (check list of your commits, save and quit (Esc + "wq" + Enter)
  • resolve conflicts if any. To continue run git rebase --continue.
  • check commits and diffs (gitk is a nice tool for that: gitk --all --date-order &)
  • check files with your saved copy from step 1.
  • push rebased commits into source branch of your fork (with --force option)

Note: no needs to re-open PR, apply changes "inplace". Do NOT remove your fork or your branch in GitHub - this would break/close this PR completely.

@vonchenplus
Copy link
Copy Markdown
Contributor Author

hello @alalek, I fixed this problem, thinks.

@dkurt
Copy link
Copy Markdown
Member

dkurt commented Jul 2, 2019

Please add skip for Inference Engine backend tests (you may see other tests for reference):

failed tests: https://pullrequest.opencv.org/buildbot/builders/precommit_custom_linux/builds/2327

Copy link
Copy Markdown
Member

@dkurt dkurt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thank you!

@alalek alalek merged commit e00b0f6 into opencv:3.4 Jul 4, 2019
@alalek alalek mentioned this pull request Jul 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants