{"action":"created","issue":{"url":"https://api.github.com/repos/daigo0927/PWC-Net_tf/issues/1","repository_url":"https://api.github.com/repos/daigo0927/PWC-Net_tf","labels_url":"https://api.github.com/repos/daigo0927/PWC-Net_tf/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/daigo0927/PWC-Net_tf/issues/1/comments","events_url":"https://api.github.com/repos/daigo0927/PWC-Net_tf/issues/1/events","html_url":"https://github.com/daigo0927/PWC-Net_tf/issues/1","id":327303455,"number":1,"title":"Warping layer","user":{"login":"linchuming","id":8861423,"avatar_url":"https://avatars2.githubusercontent.com/u/8861423?v=4","gravatar_id":"","url":"https://api.github.com/users/linchuming","html_url":"https://github.com/linchuming","followers_url":"https://api.github.com/users/linchuming/followers","following_url":"https://api.github.com/users/linchuming/following{/other_user}","gists_url":"https://api.github.com/users/linchuming/gists{/gist_id}","starred_url":"https://api.github.com/users/linchuming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linchuming/subscriptions","organizations_url":"https://api.github.com/users/linchuming/orgs","repos_url":"https://api.github.com/users/linchuming/repos","events_url":"https://api.github.com/users/linchuming/events{/privacy}","received_events_url":"https://api.github.com/users/linchuming/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-29T12:42:21Z","updated_at":"2018-05-30T04:48:58Z","closed_at":null,"author_association":"NONE","body":"Can you consider the bilinear warping operation?\r\nExample:\r\n\r\n```\r\ndef tf_flow_warp(input, flow):\r\n    shape = tf.shape(input)\r\n    N = shape[0]\r\n    H = shape[1]\r\n    W = shape[2]\r\n    # C = shape[3]\r\n    N_i = tf.range(0, N)  # 0 .. N-1\r\n    W_i = tf.range(0, W)\r\n    H_i = tf.range(0, H)\r\n\r\n    n, h, w = tf.meshgrid(N_i, H_i, W_i, indexing='ij')\r\n    n = tf.expand_dims(n, axis=3)  # [N, W, H, 1]\r\n    h = tf.expand_dims(h, axis=3)\r\n    w = tf.expand_dims(w, axis=3)\r\n\r\n    n = tf.cast(n, tf.float32)\r\n    h = tf.cast(h, tf.float32)\r\n    w = tf.cast(w, tf.float32)\r\n\r\n    v_row, v_col = tf.split(flow, 2, axis=-1)  # split flow into v_row & v_col\r\n    \"\"\" calculate index \"\"\"\r\n    v_r0 = tf.floor(v_row)\r\n    v_r1 = v_r0 + 1\r\n    v_c0 = tf.floor(v_col)\r\n    v_c1 = v_c0 + 1\r\n\r\n    H_ = tf.cast(H - 1, tf.float32)\r\n    W_ = tf.cast(W - 1, tf.float32)\r\n    i_r0 = tf.clip_by_value(h + v_r0, 0., H_)\r\n    i_r1 = tf.clip_by_value(h + v_r1, 0., H_)\r\n    i_c0 = tf.clip_by_value(w + v_c0, 0., W_)\r\n    i_c1 = tf.clip_by_value(w + v_c1, 0., W_)\r\n\r\n    i_r0c0 = tf.cast(tf.concat([n, i_r0, i_c0], axis=-1), tf.int32)\r\n    i_r0c1 = tf.cast(tf.concat([n, i_r0, i_c1], axis=-1), tf.int32)\r\n    i_r1c0 = tf.cast(tf.concat([n, i_r1, i_c0], axis=-1), tf.int32)\r\n    i_r1c1 = tf.cast(tf.concat([n, i_r1, i_c1], axis=-1), tf.int32)\r\n\r\n    \"\"\" take value from index \"\"\"\r\n    f00 = tf.gather_nd(input, i_r0c0)\r\n    f01 = tf.gather_nd(input, i_r0c1)\r\n    f10 = tf.gather_nd(input, i_r1c0)\r\n    f11 = tf.gather_nd(input, i_r1c1)\r\n\r\n    \"\"\" calculate coeff \"\"\"\r\n    w00 = (v_r1 - v_row) * (v_c1 - v_col)\r\n    w01 = (v_r1 - v_row) * (v_col - v_c0)\r\n    w10 = (v_row - v_r0) * (v_c1 - v_col)\r\n    w11 = (v_row - v_r0) * (v_col - v_c0)\r\n\r\n    out = w00 * f00 + w01 * f01 + w10 * f10 + w11 * f11\r\n    return out\r\n```"},"comment":{"url":"https://api.github.com/repos/daigo0927/PWC-Net_tf/issues/comments/393029440","html_url":"https://github.com/daigo0927/PWC-Net_tf/issues/1#issuecomment-393029440","issue_url":"https://api.github.com/repos/daigo0927/PWC-Net_tf/issues/1","id":393029440,"user":{"login":"linchuming","id":8861423,"avatar_url":"https://avatars2.githubusercontent.com/u/8861423?v=4","gravatar_id":"","url":"https://api.github.com/users/linchuming","html_url":"https://github.com/linchuming","followers_url":"https://api.github.com/users/linchuming/followers","following_url":"https://api.github.com/users/linchuming/following{/other_user}","gists_url":"https://api.github.com/users/linchuming/gists{/gist_id}","starred_url":"https://api.github.com/users/linchuming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linchuming/subscriptions","organizations_url":"https://api.github.com/users/linchuming/orgs","repos_url":"https://api.github.com/users/linchuming/repos","events_url":"https://api.github.com/users/linchuming/events{/privacy}","received_events_url":"https://api.github.com/users/linchuming/received_events","type":"User","site_admin":false},"created_at":"2018-05-30T04:48:58Z","updated_at":"2018-05-30T04:48:58Z","author_association":"NONE","body":"@daigo0927 You are welcome. I like your project. I think the paper utilizes the bilinear warping instead of nearest neighbor warping (cast into integer) . But the warping operation may just affect a little performance and is not important module.  "}}
{"actor":{"display_login":"linchuming"}}