{"id":15083,"date":"2023-05-04T15:05:27","date_gmt":"2023-05-04T07:05:27","guid":{"rendered":"http:\/\/139.9.1.231\/?p=15083"},"modified":"2023-05-04T15:50:52","modified_gmt":"2023-05-04T07:50:52","slug":"learning-stereo-from-single-images","status":"publish","type":"post","link":"http:\/\/139.9.1.231\/index.php\/2023\/05\/04\/learning-stereo-from-single-images\/","title":{"rendered":"Learning Stereo from Single Images"},"content":{"rendered":"\n<p class=\"has-text-align-center has-bright-blue-background-color has-background\"><strong>\u8bba\u6587\uff1a<a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/nianticlabs\/stereo-from-mono\/\" target=\"_blank\">https:\/\/github.com\/nianticlabs\/stereo-from-mono\/<\/a><\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center has-bright-blue-background-color has-background\"><strong>[ECCV 2020]<a rel=\"noreferrer noopener\" href=\"https:\/\/arxiv.org\/abs\/2008.01484\" target=\"_blank\"> Learning stereo from single images<\/a> <\/strong><\/p>\n\n\n\n<p>        <strong>\u5bfc\u8bfb\uff1a\u5728\u8fdb\u884c\u7acb\u4f53\u5339\u914d\u7684\u8fc7\u7a0b\u4e2d\u6210\u5bf9\u4e14\u5e26\u6807\u7b7e\u7684\u8bad\u7ec3\u6570\u636e\u662f\u5f88\u96be\u53bb\u83b7\u53d6\u7684\uff0c\u5bf9\u6b64\u73b0\u6709\u7684\u5f88\u591a\u65b9\u6cd5\u90fd\u662f\u5728\u865a\u62df\u7684\u5408\u6210\u6570\u636e\uff08\u5982SceneFlow\u3001FlayingThings3D\u7b49\u6570\u636e\u96c6\uff09\u4e0a\u8bad\u7ec3\u5b8c\u6210\u7684\uff0c\u81ea\u7136\u5176\u5728\u5b9e\u9645\u591a\u6837\u5316\u7684\u573a\u666f\u4e2d\u6cdb\u5316\u8fc1\u79fb\u80fd\u529b\u662f\u5f88\u5f31\u7684\u3002\u5bf9\u6b64\u6587\u7ae0\u901a\u8fc7\u4f7f\u7528MiDas\u5bf9\u4efb\u610f\u7684\u8f93\u5165\u56fe\u50cf\u8fdb\u884c\u6df1\u5ea6\u4f30\u8ba1\uff0c\u5e76\u5c06\u6df1\u5ea6\u56fe\u8f6c\u6362\u5230\u89c6\u5dee\u56fe\uff0c\u4e4b\u540e\u6309\u7167\u89c6\u5dee\u56fe\u5bf9\u6e90\u56fe\u50cf\u8fdb\u884c\u53d8\u6362\u5f97\u5230\u53e6\u5916\u4e00\u4e2a\u89c6\u56fe\uff0c\u5176\u4e2d\u4f1a\u5bf9\u751f\u6210\u7684\u53e6\u5916\u4e00\u4e2a\u89c6\u56fe\u8fdb\u884c\u4fee\u590d\u548c\u8865\u507f\u4f18\u5316\u4ece\u800c\u6784\u5efa\u4e00\u4e2a\u53cc\u76ee\u7acb\u4f53\u56fe\u50cf\u5bf9\u3002\u81ea\u6b64\uff0c\u53cc\u76ee\u7acb\u4f53\u56fe\u50cf\u5bf9\u6784\u9020\u5b8c\u6210\uff0c\u63a5\u4e0b\u6765\u4fbf\u662f\u4f7f\u7528\u4e00\u4e2a\u53cc\u76ee\u7acb\u4f53\u5339\u914d\u7f51\u7edc\u5728\u8fd9\u4e9b\u6570\u636e\u4e0a\u8fdb\u884c\u8bad\u7ec3\u3002\u6b63\u662f\u7531\u4e8e\u8bad\u7ec3\u6570\u636e\u7684\u591a\u6837\u5316\u6587\u7ae0\u63d0\u51fa\u7684\u7b97\u6cd5\u76f8\u6bd4\u5408\u6210\u6570\u636e\u4e0a\u8bad\u7ec3\u5f97\u5230\u7684\u5339\u914d\u7f51\u7edc\u66f4\u52a0\u9c81\u68d2\u3002<\/strong><\/p>\n\n\n\n<p>\u6587\u7ae0\u7684\u7b97\u6cd5\u5728\u505a\u7acb\u4f53\u5339\u914d\u7684\u65f6\u5019\u5e76\u6ca1\u6709\u91c7\u7528\u5408\u6210\u6570\u636e\uff0c\u800c\u662f\u5728\u591a\u6837\u5316\u771f\u5b9e\u6570\u636e\u57fa\u7840\u4e0a\u901a\u8fc7\u7b56\u7565\u5f97\u5230\u5408\u6210\u7684\u56fe\u50cf\u5bf9\uff0c\u4ece\u800c\u6781\u5927\u589e\u52a0\u4e86\u7f51\u7edc\u7684\u6cdb\u5316\u80fd\u529b\uff0c\u4e0b\u9762\u56fe\u4e2d\u5c55\u793a\u7684\u5c31\u662f\u4e24\u79cd\u8bad\u7ec3\u7b56\u7565\u7684\u5bf9\u6bd4\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"752\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-1024x752.png\" alt=\"\" class=\"wp-image-15088\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-1024x752.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-300x220.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-768x564.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image.png 1206w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u6587\u7ae0\u4e2d\u4f7f\u7528\u5230\u7684\u98ce\u683c\u591a\u6837\u5316\u6570\u636e\u96c6\u79f0\u4e4b\u4e3aMfS\uff08Mono for Stereo\u2019 dataset\uff09\uff0c\u5176\u4e2d\u5305\u542b\u7684\u6570\u636e\u96c6\u6709\uff1aCOCO 2017 \uff0cMapillary Vistas\uff0cADE20K \uff0cDepth in the Wild\uff0cDIODE \u3002\u7ecf\u8fc7\u6574\u7406\u4e4b\u540e\u5176\u4e2d\u5305\u542b\u7684\u6570\u636e\u603b\u91cf\u4e3a\uff1a597727\u3002<\/p>\n\n\n\n<h3>\u65b9\u6cd5\u8bbe\u8ba1<\/h3>\n\n\n\n<p>\u6587\u7ae0\u7b97\u6cd5\u7684\u6574\u4f53pipeline\u89c1\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"494\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-1-1024x494.png\" alt=\"\" class=\"wp-image-15093\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-1-1024x494.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-1-300x145.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-1-768x370.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-1.png 1207w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3>\u6570\u636e\u751f\u6210\u4f18\u5316\u7b56\u7565<\/h3>\n\n\n\n<p>depth sharpening\uff1a\u6587\u7ae0\u4f7f\u7528\u7684\u662f\u4e00\u4e2a\u5355\u76ee\u6df1\u5ea6\u4f30\u8ba1\u7f51\u7edc\u8fdb\u884c\u6df1\u5ea6\u9884\u6807\u6ce8\uff0c\u81ea\u7136\u5176\u4e2d\u7684\u51e0\u4f55\u7ea6\u675f\u6027\u6bd4\u8f83\u5f31\uff0c\u56e0\u800c\u6309\u7167\u6df1\u5ea6\u4f30\u8ba1\u7ed3\u679c\u5bf9\u539f\u56fe\u5411\u8fdb\u884cwarp\u4e4b\u540e\u5b58\u5728\u4e00\u4e9b\u5b64\u7acb\u7684\u50cf\u7d20\u70b9\uff08flying points\uff09\uff0c\u4e5f\u5c31\u662f\u4e0b\u56fe\u4e2d\u4e2d\u95f4\u90e8\u5206\u7684\u6548\u679c\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-2-1024x661.png\" alt=\"\" class=\"wp-image-15096\" width=\"527\" height=\"340\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-2-1024x661.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-2-300x194.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-2-768x496.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-2.png 1212w\" sizes=\"(max-width: 527px) 100vw, 527px\" \/><\/figure><\/div>\n\n\n\n<p>        \u5bf9\u6b64\uff0c\u6587\u7ae0\u4e3a\u4e86\u89e3\u51b3\u8be5\u95ee\u9898\u9996\u5148\u901a\u8fc7Sobel\u68af\u5ea6\u7b97\u5b50\u53bb\u68c0\u6d4b\u90a3\u4e9b\u68af\u5ea6\u54cd\u5e94\u5927\u4e8e3\u7684\u533a\u57df\uff08\u4e5f\u5c31\u662f\u6587\u7ae0\u8bf4\u7684flying points\uff09\uff0c\u4e4b\u540e\u5c06\u8fd9\u4e9b\u70b9\u7684\u6df1\u5ea6\u4e4b\u8bbe\u7f6e\u4e3a\u6700\u8fd1\u975eflying points\u533a\u57df\u7684\u503c\u3002\u4ece\u800c\u5b9e\u73b0depth sharpening\uff0c\u5728\u56fe3\u4e2d\u4e5f\u6bd4\u8f83\u4e86\u6709\u65e0\u8be5\u7b56\u7565\u5bf9\u4e8e\u505a\u540e\u6548\u679c\u7684\u5f71\u54cd\u3002\u8fd9\u90e8\u5206\u5b9e\u73b0\u7684\u4ee3\u7801\u53ef\u4ee5\u53c2\u8003\uff1a<\/p>\n\n\n\n<p>datasets\/warp_dataset.py#L112<\/p>\n\n\n\n<p>if not self.disable_sharpening:<br># now find disparity gradients and set to nearest &#8211; stop flying pixels<br>edges = sobel(disparity) &gt; 3 # \u9009\u62e9\u68af\u5ea6\u5927\u7684\u533a\u57df\uff0c\u5927\u6982\u7387\u4e3aflying points<br>disparity[edges] = 0 # \u5c06\u5176\u8bbe\u7f6e\u4e3a0<br>mask = disparity &gt; 0 # \u53d6\u51fa\u9700\u8981\u63d2\u503c\u7684\u4f4d\u7f6e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try:  # \u5bf9\u89c6\u5dee\u56fe\u4e0d\u4e3a0\u7684\u533a\u57df\u8fdb\u884c\u63d2\u503c\uff0c\u91cd\u70b9\u5173\u6ce8\u7684\u5c31\u662fflying points\n    disparity = griddata(np.stack(&#91;self.ys&#91;mask].ravel(), self.xs&#91;mask].ravel()], 1),\n                         disparity&#91;mask].ravel(), np.stack(&#91;self.ys.ravel(),\n                                                            self.xs.ravel()], 1),\n                         method='nearest').reshape(self.feed_height, self.process_width)\nexcept (ValueError, IndexError) as e:\n    pass  # just return disparity\n<\/code><\/pre>\n\n\n\n<p>occlusion\u548ccollision\u533a\u57df\u5904\u7406:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-3-1024x99.png\" alt=\"\" class=\"wp-image-15099\" width=\"689\" height=\"66\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-3-1024x99.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-3-300x29.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-3-768x75.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-3-1536x149.png 1536w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-3.png 1927w\" sizes=\"(max-width: 689px) 100vw, 689px\" \/><\/figure>\n\n\n\n<p>\u5bf9\u4e8e\u8fd9\u4e00\u90e8\u5206\u7684\u4ee3\u7801\u53ef\u4ee5\u53c2\u8003\u4e0b\u9762\u7684\u5b9e\u73b0\u8fc7\u7a0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># datasets\/warp_dataset.py#L227\ndef project_image(self, image, disp_map, background_image):\n\n    image = np.array(image)\n    background_image = np.array(background_image)\n\n    # set up for projection\n    warped_image = np.zeros_like(image).astype(float)\n    warped_image = np.stack(&#91;warped_image] * 2, 0)\n    pix_locations = self.xs - disp_map  # \u6839\u636e\u89c6\u5dee\u8ba1\u7b97\u65b0\u7684\u5750\u6807\n\n    # find where occlusions are, and remove from disparity map\n    mask = self.get_occlusion_mask(pix_locations)  # \u6839\u636e\u53ef\u89c1\u6027\u51c6\u5219\u83b7\u53d6occlusion mask\uff08\u5bf9\u5e94\u90e8\u5206\u4e3a0\uff09\n    masked_pix_locations = pix_locations * mask - self.process_width * (1 - mask)\n\n    # do projection - linear interpolate up to 1 pixel away\n    weights = np.ones((2, self.feed_height, self.process_width)) * 10000\n\n    for col in range(self.process_width - 1, -1, -1):  # \u6309\u7167\u6709\u6548\u50cf\u7d20\u8fdb\u884c\u63d2\u503c\u5f97\u5230\u53f3\u89c6\u56fe\n        loc = masked_pix_locations&#91;:, col]\n        loc_up = np.ceil(loc).astype(int)\n        loc_down = np.floor(loc).astype(int)\n        weight_up = loc_up - loc\n        weight_down = 1 - weight_up\n\n        mask = loc_up &gt;= 0\n        mask&#91;mask] = \\\n            weights&#91;0, np.arange(self.feed_height)&#91;mask], loc_up&#91;mask]] &gt; weight_up&#91;mask]\n        weights&#91;0, np.arange(self.feed_height)&#91;mask], loc_up&#91;mask]] = \\\n            weight_up&#91;mask]\n        warped_image&#91;0, np.arange(self.feed_height)&#91;mask], loc_up&#91;mask]] = \\\n            image&#91;:, col]&#91;mask] \/ 255.\n\n        mask = loc_down &gt;= 0\n        mask&#91;mask] = \\\n            weights&#91;1, np.arange(self.feed_height)&#91;mask], loc_down&#91;mask]] &gt; weight_down&#91;mask]\n        weights&#91;1, np.arange(self.feed_height)&#91;mask], loc_down&#91;mask]] = weight_down&#91;mask]\n        warped_image&#91;1, np.arange(self.feed_height)&#91;mask], loc_down&#91;mask]] = \\\n            image&#91;:, col]&#91;mask] \/ 255.\n\n    weights \/= weights.sum(0, keepdims=True) + 1e-7  # normalise\n    weights = np.expand_dims(weights, -1)\n    warped_image = warped_image&#91;0] * weights&#91;1] + warped_image&#91;1] * weights&#91;0]  # \u6309\u7167\u63d2\u503c\u6743\u91cd\u8fdb\u884c\u878d\u5408\n    warped_image *= 255.\n\n    # now fill occluded regions with random background\n    if not self.disable_background:  # occlusion\u90e8\u5206\u8865\u5145\n        warped_image&#91;warped_image.max(-1) == 0] = background_image&#91;warped_image.max(-1) == 0]\n\n    warped_image = warped_image.astype(np.uint8)\n\n    return warped_image\n<\/code><\/pre>\n\n\n\n<h3>\u5b9e\u9a8c\u7ed3\u679c<\/h3>\n\n\n\n<p>\u6587\u7ae0\u63d0\u51fa\u7684\u4e24\u79cd\u6570\u636e\u4f18\u5316\u7b56\u7565\uff0c\u5176\u6709\u6548\u6027\u5bf9\u6bd4\u89c1\u4e0b\u8868\u6240\u793a\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"230\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-4-1024x230.png\" alt=\"\" class=\"wp-image-15103\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-4-1024x230.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-4-300x67.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-4-768x172.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-4.png 1207w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u7acb\u4f53\u5339\u914d\u6570\u636e\u751f\u6210\u65b9\u6cd5\u5728\u6700\u540e\u6027\u80fd\u4e0a\u7684\u6bd4\u8f83\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"458\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-5-1024x458.png\" alt=\"\" class=\"wp-image-15104\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-5-1024x458.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-5-300x134.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-5-768x344.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-5.png 1173w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u6587\u7ae0\u7684\u65b9\u6cd5\u4e0e\u57fa\u51c6\u7684\u5bf9\u6bd4\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"511\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-6-1024x511.png\" alt=\"\" class=\"wp-image-15105\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-6-1024x511.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-6-300x150.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-6-768x383.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2023\/05\/image-6.png 1177w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bba\u6587\uff1ahttps:\/\/github.com\/nianticlabs\/stereo-from-mono\/ [EC &hellip; <a href=\"http:\/\/139.9.1.231\/index.php\/2023\/05\/04\/learning-stereo-from-single-images\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Learning Stereo from Single Images<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,35,36],"tags":[],"_links":{"self":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/15083"}],"collection":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/comments?post=15083"}],"version-history":[{"count":17,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/15083\/revisions"}],"predecessor-version":[{"id":15107,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/15083\/revisions\/15107"}],"wp:attachment":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/media?parent=15083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/categories?post=15083"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/tags?post=15083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}