{"id":45,"date":"2022-03-01T09:52:02","date_gmt":"2022-03-01T09:52:02","guid":{"rendered":"https:\/\/blog.liguanxin.cn\/?p=45"},"modified":"2022-03-02T12:41:47","modified_gmt":"2022-03-02T12:41:47","slug":"ras-pytorch%e4%bb%a3%e7%a0%81%e8%af%a6%e8%a7%a3%e4%bb%a5%e5%8f%8a%e5%88%b0mindspore%e7%9a%84%e8%bf%81%e7%a7%bb","status":"publish","type":"post","link":"https:\/\/blog.liguanxin.cn\/index.php\/2022\/03\/01\/ras-pytorch%e4%bb%a3%e7%a0%81%e8%af%a6%e8%a7%a3%e4%bb%a5%e5%8f%8a%e5%88%b0mindspore%e7%9a%84%e8%bf%81%e7%a7%bb\/","title":{"rendered":"RAS-pytorch\u4ee3\u7801\u8be6\u89e3\u4ee5\u53ca\u5230mindspore\u7684\u8fc1\u79fb"},"content":{"rendered":"\n<p>RAS\u5373\u201cReverse Attention-Based Residual Network for Salient Object Detection\u201d\uff0c\u662f\u4e00\u4e2a\u56fe\u50cf\u663e\u8457\u6027\u68c0\u6d4b\u7684\u7b97\u6cd5\uff0c\u5177\u6709\u8bad\u7ec3\u901f\u5ea6\u5feb\uff0c\u53c2\u6570\u91cf\u5c11\u7684\u4f18\u70b9\u3002<\/p>\n\n\n\n<p>github\u6e90\u4ee3\u7801\uff1a<a href=\"https:\/\/github.com\/ShuhanChen\/RAS-pytorch\">ShuhanChen\/RAS-pytorch: Pytorch code for our TIP20 paper: Reverse Attention Based Residual Network for Salient Object Detection.. (github.com)<\/a><\/p>\n\n\n\n<p>\u8bba\u6587\uff1a<a href=\"https:\/\/ieeexplore.ieee.org\/abstract\/document\/8966594\" data-type=\"URL\" data-id=\"https:\/\/ieeexplore.ieee.org\/abstract\/document\/8966594\">Reverse Attention-Based Residual Network for Salient Object Detection<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"989\" height=\"561\" src=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image.png\" alt=\"\" class=\"wp-image-46\" srcset=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image.png 989w, https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-300x170.png 300w, https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-768x436.png 768w\" sizes=\"(max-width: 989px) 100vw, 989px\" \/><\/figure>\n\n\n\n<h2><strong>pytorch\u4ee3\u7801\u76ee\u5f55\u7ed3\u6784\uff1a<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\u251c\u2500\u2500 v1\n  \u251c\u2500\u2500 data.py      # \u6570\u636e\u8bfb\u53d6\n  \u251c\u2500\u2500 RAS.py       # RAS\u7f51\u7edc\u4e3b\u7ed3\u6784\n  \u251c\u2500\u2500 ResNet50.py  # ResNet50\u7f51\u7edc\n  \u251c\u2500\u2500 test.py      # \u7f51\u7edc\u63a8\u7406<\/code><code>\n  \u2514\u2500\u2500 train.py<\/code>     # \u7f51\u7edc\u8bad\u7ec3<\/pre>\n\n\n\n<h2><strong>\u5404\u4e2a\u7c7b\u7684\u4f5c\u7528\uff1a<\/strong><\/h2>\n\n\n\n<ul><li>data.py\u6587\u4ef6<\/li><\/ul>\n\n\n\n<p><code> <\/code>       <code>class SalObjDataset<\/code>:<\/p>\n\n\n\n<p>        \u663e\u8457\u6027\u68c0\u6d4b\u6570\u636e\u96c6\u8bfb\u53d6\uff0c\u5bf9\u56fe\u50cf\u6570\u636e\u8fdb\u884crandom_flip\u3001random_rotate\u64cd\u4f5c\u4ee5\u53caNormalize\uff0c\u6700\u540e\u88c1\u526a\u6210352*352\u7684\u56fe\u50cf\u3002<\/p>\n\n\n\n<p><code> <\/code>       <code>class test_dataset<\/code>:<\/p>\n\n\n\n<p>        \u4e0e\u4e0a\u9762\u7c7b\u4f3c\uff0c\u53ea\u4fdd\u7559resize\u548cNormalize\u64cd\u4f5c\u3002<\/p>\n\n\n\n<ul><li>RAS.py\u6587\u4ef6<\/li><\/ul>\n\n\n\n<p><code> <\/code>       <code>class MSCM<\/code>:<\/p>\n\n\n\n<p>        \u591a\u5c3a\u5ea6\u4e0a\u4e0b\u6587\u5377\u79ef\u6a21\u5757\uff0c\u7528\u4e8e\u6355\u6349\u5168\u5c40\u663e\u8457\u6027\u7684\u7ebf\u7d22\uff0c\u7528\u8fd9\u4e2a\u7ed3\u6784\u53ef\u4ee5\u5728\u4e0d\u964d\u4f4e\u6027\u80fd\u7684\u60c5\u51b5\u4e0b\u5b9e\u73b0\u66f4\u5c11\u7684\u53c2\u6570\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"375\" height=\"252\" src=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-1.png\" alt=\"\" class=\"wp-image-50\" srcset=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-1.png 375w, https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-1-300x202.png 300w\" sizes=\"(max-width: 375px) 100vw, 375px\" \/><\/figure><\/div>\n\n\n\n<p>        <code>class RA:<\/code><\/p>\n\n\n\n<p>        \u81ea\u4e0a\u800c\u4e0b\u7684\u53cd\u5411\u6ce8\u610f\u529b\u6a21\u5757\uff0c\u5bf9ResNet50\u7684\u5404\u5c42\u8fdb\u884c\u5904\u7406\u3002\u5229\u7528resnet\u6df1\u5c42\u4e2d\u5177\u6709\u9ad8\u8bed\u4e49\u7f6e\u4fe1\u5ea6\u4f46\u4f4e\u5206\u8fa8\u7387\u7684\u7279\u6027\u3002\u901a\u8fc7\u64e6\u9664\u6bcf\u4e2a\u4fa7\u8f93\u51fa\u7279\u5f81\u7684\u9884\u6d4b\u533a\u57df\u6765\u8ba9\u7f51\u7edc\u8865\u5145\u7ec6\u8282\u3002\u800c\u5f53\u524d\u533a\u57df\u662f\u4ece\u66f4\u6df1\u5c42\u4e0a\u91c7\u6837\u83b7\u5f97\u7684\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"955\" height=\"395\" src=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-2.png\" alt=\"\" class=\"wp-image-51\" srcset=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-2.png 955w, https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-2-300x124.png 300w, https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-2-768x318.png 768w\" sizes=\"(max-width: 955px) 100vw, 955px\" \/><\/figure>\n\n\n\n<p>      <code>  class RAS:<\/code><\/p>\n\n\n\n<p>        \u7f51\u7edc\u7684\u6574\u4f53\u7ed3\u6784\uff0c\u628a\u4eceresnet\u5f97\u5230\u76845\u4e2a\u5c42\u8fdb\u884c\u5904\u7406\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"672\" height=\"552\" src=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-3.png\" alt=\"\" class=\"wp-image-53\" srcset=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-3.png 672w, https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-3-300x246.png 300w\" sizes=\"(max-width: 672px) 100vw, 672px\" \/><\/figure><\/div>\n\n\n\n<ul><li>ResNet50.py\u6587\u4ef6<\/li><\/ul>\n\n\n\n<p>        \u4e0eResNet50\u7ed3\u6784\u7c7b\u4f3c\uff0c\u4e0d\u540c\u4e4b\u5904\u5728\u4e8e\u6700\u540e\u7684\u8f93\u51fa\u6539\u6210\u4e86return5\u4e2a\u5c42\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"438\" height=\"258\" src=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-4.png\" alt=\"\" class=\"wp-image-54\" srcset=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-4.png 438w, https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-4-300x177.png 300w\" sizes=\"(max-width: 438px) 100vw, 438px\" \/><\/figure><\/div>\n\n\n\n<ul><li>train.py\u6587\u4ef6<\/li><\/ul>\n\n\n\n<p>        \u7f51\u7edc\u8bad\u7ec3\u6587\u4ef6\uff0c\u53ef\u8c03\u7684\u8d85\u53c2\u6709\uff1aepoch, lr, trainsize, batchsize, decay_epoch\u3002<\/p>\n\n\n\n<p>        loss\u503c\u7684\u8ba1\u7b97\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"627\" height=\"174\" src=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-5.png\" alt=\"\" class=\"wp-image-55\" srcset=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-5.png 627w, https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-5-300x83.png 300w\" sizes=\"(max-width: 627px) 100vw, 627px\" \/><\/figure><\/div>\n\n\n\n<p>        \u9996\u5148\u662fBCEloss\uff08\u4e8c\u8fdb\u5236\u4ea4\u53c9\u71b5\uff09\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img src=\"https:\/\/img-blog.csdnimg.cn\/20200702152953393.png\" alt=\"\"\/><\/figure><\/div>\n\n\n\n<p>        \u7136\u540e\u4f5c\u8005\u91c7\u7528\u7684\u662f\u975e\u5e38\u89c4\u7684IOUloss\u3002<\/p>\n\n\n\n<ul><li>test.py\u6587\u4ef6<\/li><\/ul>\n\n\n\n<p>        \u7528\u4e8e\u751f\u6210\u63a8\u7406\u7ed3\u679c\uff0c\u4ee5\u53ca\u8ba1\u7b97\u751f\u6210\u56fe\u50cf\u7684FPS\u3002<\/p>\n\n\n\n<ul><li>Evaluation\u6587\u4ef6<\/li><\/ul>\n\n\n\n<p>        \u539f\u7248\u662f\u7528MATLAB\u5199\u7684\u8bc4\u4f30\u51fd\u6570\uff0c\u6211\u628a\u5176\u4e2d\u7684F-measure\u548cMAE\u6539\u5199\u6210python\u7248\u672c\u3002<\/p>\n\n\n\n<p>        \u4ee3\u7801\uff1a<a href=\"https:\/\/gitee.com\/latrawy\/saliency-evaluation-code\">Saliency-Evaluation-Code: \u4ee3\u7801\u4fee\u6539\u81eahttps:\/\/github.com\/jiwei0921\/Saliency-Evaluation-Toolbox#saliency-evaluation-toolbox\uff0c\u628a\u5176\u4e2d\u7684F-measure\u548cMAE scores\u6539\u5199\u4e3apython\u7248\u672c (gitee.com)<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2>\u8fc1\u79fb\u5230\u534e\u4e3a\u6607\u817e\u7684mindspore\u6846\u67b6\uff1a<\/h2>\n\n\n\n<p><a href=\"https:\/\/gitee.com\/mindspore\/models\/tree\/master\/research\/cv\/ras\">research\/cv\/ras \u00b7 MindSpore\/models &#8211; \u7801\u4e91 &#8211; \u5f00\u6e90\u4e2d\u56fd (gitee.com)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>RAS\u5373\u201cReverse Attention-Based Residual Network for Salie [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":65,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/posts\/45"}],"collection":[{"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":9,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"predecessor-version":[{"id":63,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/posts\/45\/revisions\/63"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/media\/65"}],"wp:attachment":[{"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}