{"id":76684,"date":"2026-02-23T01:25:27","date_gmt":"2026-02-22T17:25:27","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/76684.html"},"modified":"2026-02-23T01:25:27","modified_gmt":"2026-02-22T17:25:27","slug":"%e5%88%ab%e8%ae%a9%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%96%ad%e7%94%b5%e6%af%81%e4%ba%86%e4%bd%a0%e4%b8%89%e5%a4%a9%e4%b8%89%e5%a4%9c%e7%9a%84%e8%ae%ad%e7%bb%83%ef%bc%81mmdetection-resume%e5%ae%9e%e6%88%98","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/76684.html","title":{"rendered":"\u522b\u8ba9\u670d\u52a1\u5668\u65ad\u7535\u6bc1\u4e86\u4f60\u4e09\u5929\u4e09\u591c\u7684\u8bad\u7ec3\uff01mmdetection resume\u5b9e\u6218\u907f\u5751\u6307\u5357"},"content":{"rendered":"<h2>\u522b\u8ba9\u670d\u52a1\u5668\u65ad\u7535\u6bc1\u4e86\u4f60\u4e09\u5929\u4e09\u591c\u7684\u8bad\u7ec3&#xff01;mmdetection resume\u5b9e\u6218\u907f\u5751\u6307\u5357<\/h2>\n<p>\u6df1\u591c&#xff0c;\u5b9e\u9a8c\u5ba4\u91cc\u53ea\u6709\u98ce\u6247\u7684\u55e1\u9e23\u548c\u5c4f\u5e55\u7684\u5fae\u5149\u3002\u4f60\u76ef\u7740\u5c4f\u5e55\u4e0a\u7f13\u6162\u589e\u957f\u7684\u9a8c\u8bc1\u96c6mAP\u66f2\u7ebf&#xff0c;\u5fc3\u91cc\u76d8\u7b97\u7740\u518d\u6709\u51e0\u4e2a\u5c0f\u65f6&#xff0c;\u8fd9\u4e2a\u5173\u952e\u5b9e\u9a8c\u7684\u7ed3\u679c\u5c31\u80fd\u51fa\u7089\u4e86\u3002\u7a81\u7136&#xff0c;\u5c4f\u5e55\u4e00\u9ed1&#xff0c;\u98ce\u6247\u58f0\u621b\u7136\u800c\u6b62\u2014\u2014\u6574\u680b\u697c\u8df3\u95f8\u4e86\u3002\u90a3\u4e00\u523b&#xff0c;\u4f60\u8111\u5b50\u91cc\u95ea\u8fc7\u7684\u4e0d\u662f\u5b9e\u9a8c\u6570\u636e&#xff0c;\u800c\u662f\u90a3\u4e2a\u5df2\u7ecf\u8dd1\u4e8672\u5c0f\u65f6\u7684\u8bad\u7ec3\u4efb\u52a1\u3002\u4e09\u5929\u4e09\u591c\u7684\u5fc3\u8840&#xff0c;\u96be\u9053\u8981\u56e0\u4e3a\u4e00\u6b21\u610f\u5916\u65ad\u7535\u5c31\u4ed8\u8bf8\u4e1c\u6d41&#xff1f;<\/p>\n<p>\u5982\u679c\u4f60\u6b63\u5728\u4f7f\u7528MMDetection\u8fd9\u7c7b\u5f00\u6e90\u6846\u67b6\u8fdb\u884c\u8ba1\u7b97\u673a\u89c6\u89c9\u6a21\u578b\u7684\u8bad\u7ec3&#xff0c;\u90a3\u4e48\u201c\u8bad\u7ec3\u4e2d\u65ad\u201d\u51e0\u4e4e\u662f\u4e00\u4e2a\u7ed5\u4e0d\u5f00\u7684\u574e\u3002\u65e0\u8bba\u662f\u670d\u52a1\u5668\u610f\u5916\u91cd\u542f\u3001\u5b9e\u9a8c\u5ba4\u65ad\u7535&#xff0c;\u8fd8\u662f\u7b80\u5355\u7684SSH\u8fde\u63a5\u8d85\u65f6&#xff0c;\u90fd\u53ef\u80fd\u5bfc\u81f4\u4e00\u4e2a\u957f\u65f6\u95f4\u8fd0\u884c\u7684\u8bad\u7ec3\u4efb\u52a1\u621b\u7136\u800c\u6b62\u3002\u597d\u6d88\u606f\u662f&#xff0c;\u73b0\u4ee3\u6df1\u5ea6\u5b66\u4e60\u6846\u67b6\u5927\u591a\u63d0\u4f9b\u4e86\u5b8c\u5584\u7684\u6062\u590d\u673a\u5236&#xff0c;\u574f\u6d88\u606f\u662f&#xff0c;\u5982\u679c\u4f60\u4e0d\u4e86\u89e3\u5176\u4e2d\u7684\u7ec6\u8282\u548c\u9677\u9631&#xff0c;\u6062\u590d\u8fc7\u7a0b\u672c\u8eab\u5c31\u53ef\u80fd\u53d8\u6210\u4e00\u573a\u65b0\u7684\u707e\u96be\u3002<\/p>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u5c31\u662f\u4e3a\u4f60\u51c6\u5907\u7684\u5b9e\u6218\u6307\u5357\u3002\u6211\u4eec\u4e0d\u8c08\u7a7a\u6d1e\u7684\u7406\u8bba&#xff0c;\u76f4\u63a5\u4ece\u90a3\u4e2a\u6700\u8ba9\u4f60\u5fc3\u8df3\u52a0\u901f\u7684\u573a\u666f\u51fa\u53d1&#xff1a;\u670d\u52a1\u5668\u7a81\u7136\u65ad\u7535\u540e&#xff0c;\u5982\u4f55\u5b89\u5168\u3001\u9ad8\u6548\u5730\u6062\u590dMMDetection\u8bad\u7ec3&#xff0c;\u5e76\u4e14\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\u907f\u5f00\u90a3\u4e9b\u5e38\u89c1\u7684\u201c\u5751\u201d\u3002\u6211\u4f1a\u7ed3\u5408\u81ea\u5df1\u591a\u6b21\u201c\u8e29\u5751\u201d\u7684\u7ecf\u9a8c&#xff0c;\u5e26\u4f60\u6df1\u5165\u7406\u89e3&#8211;resume\u53c2\u6570\u80cc\u540e\u7684\u673a\u5236&#xff0c;\u638c\u63e1work_dirs\u76ee\u5f55\u7684\u7ba1\u7406\u827a\u672f&#xff0c;\u5e76\u5b66\u4f1a\u5229\u7528TensorBoard\u65e5\u5fd7\u8fdb\u884c\u7cbe\u51c6\u7684\u95ee\u9898\u8bca\u65ad\u3002\u65e0\u8bba\u4f60\u662f\u521a\u521a\u5165\u95e8CV\u9886\u57df\u7684\u7814\u7a76\u751f&#xff0c;\u8fd8\u662f\u5728\u5de5\u4e1a\u754c\u90e8\u7f72\u6a21\u578b\u7b97\u6cd5\u7684\u5de5\u7a0b\u5e08&#xff0c;\u8fd9\u4e9b\u5b9e\u6218\u6280\u5de7\u90fd\u80fd\u8ba9\u4f60\u5728\u9762\u5bf9\u610f\u5916\u65f6\u66f4\u52a0\u4ece\u5bb9\u3002<\/p>\n<h3>1. \u7406\u89e3\u6838\u5fc3&#xff1a;&#8211;resume \u5230\u5e95\u505a\u4e86\u4ec0\u4e48&#xff1f;<\/h3>\n<p>\u5f88\u591a\u4eba\u4ee5\u4e3a&#8211;resume\u5c31\u662f\u7b80\u5355\u5730\u52a0\u8f7d\u4e00\u4e2a.pth\u6587\u4ef6\u7136\u540e\u7ee7\u7eed\u8bad\u7ec3&#xff0c;\u4f46\u5b9e\u9645\u4e0a&#xff0c;\u8fd9\u4e2a\u7b80\u5355\u7684\u53c2\u6570\u80cc\u540e\u9690\u85cf\u7740\u4e00\u5957\u5b8c\u6574\u7684\u72b6\u6001\u6062\u590d\u673a\u5236\u3002\u7406\u89e3\u8fd9\u5957\u673a\u5236&#xff0c;\u662f\u4f60\u6210\u529f\u6062\u590d\u8bad\u7ec3\u7684\u7b2c\u4e00\u6b65\u3002<\/p>\n<h4>1.1 \u4e0d\u4ec5\u4ec5\u662f\u6743\u91cd&#xff1a;\u8bad\u7ec3\u72b6\u6001\u7684\u5b8c\u6574\u5feb\u7167<\/h4>\n<p>\u5f53\u4f60\u4f7f\u7528&#8211;resume\u65f6&#xff0c;MMDetection&#xff08;\u57fa\u4e8eMMEngine&#xff09;\u5c1d\u8bd5\u6062\u590d\u7684\u4e0d\u4ec5\u4ec5\u662f\u6a21\u578b\u6743\u91cd\u3002\u4e00\u4e2a\u5b8c\u6574\u7684checkpoint\u6587\u4ef6\u5305\u542b\u4e86\u8bad\u7ec3\u5728\u67d0\u4e2a\u65f6\u95f4\u70b9\u7684\u5b8c\u6574\u72b6\u6001&#xff0c;\u8fd9\u901a\u5e38\u5305\u62ec&#xff1a;<\/p>\n<ul>\n<li>\u6a21\u578b\u6743\u91cd&#xff1a;\u8fd9\u662f\u6700\u660e\u663e\u7684\u90e8\u5206&#xff0c;\u5373\u7f51\u7edc\u5404\u5c42\u7684\u53c2\u6570\u3002<\/li>\n<li>\u4f18\u5316\u5668\u72b6\u6001&#xff1a;\u4f18\u5316\u5668&#xff08;\u5982Adam\u3001SGD&#xff09;\u5185\u90e8\u7684\u6240\u6709\u52a8\u91cf\u7f13\u5b58\u3001\u4e8c\u9636\u77e9\u4f30\u8ba1\u7b49\u3002\u5bf9\u4e8eAdam\u4f18\u5316\u5668&#xff0c;\u8fd9\u610f\u5473\u7740\u6bcf\u4e2a\u53c2\u6570\u7684m\u548cv\u5411\u91cf\u3002<\/li>\n<li>\u5b66\u4e60\u7387\u8c03\u5ea6\u5668\u72b6\u6001&#xff1a;\u5f53\u524d\u7684\u5b66\u4e60\u7387\u503c&#xff0c;\u4ee5\u53ca\u8c03\u5ea6\u5668\u5185\u90e8\u7684\u72b6\u6001&#xff08;\u6bd4\u5982CosineAnnealingLR\u5f53\u524d\u5904\u4e8e\u7b2c\u51e0\u4e2a\u5468\u671f&#xff09;\u3002<\/li>\n<li>\u5f53\u524d\u7684epoch\u548citeration\u8ba1\u6570&#xff1a;\u8bad\u7ec3\u8fdb\u884c\u5230\u4e86\u54ea\u4e2aepoch\u7684\u54ea\u4e2abatch\u3002<\/li>\n<li>\u968f\u673a\u6570\u751f\u6210\u5668\u72b6\u6001&#xff1a;\u786e\u4fdd\u6062\u590d\u540e\u6570\u636e\u52a0\u8f7d\u7684\u968f\u673a\u6027\u662f\u4e00\u81f4\u7684\u3002<\/li>\n<li>\u5176\u4ed6\u8bad\u7ec3\u5143\u6570\u636e&#xff1a;\u5982\u5f53\u524d\u7684\u6700\u4f73\u9a8c\u8bc1\u6307\u6807\u3001\u8bad\u7ec3\u65f6\u957f\u7b49\u3002<\/li>\n<\/ul>\n<p>\u4e3a\u4ec0\u4e48\u4f18\u5316\u5668\u72b6\u6001\u5982\u6b64\u91cd\u8981&#xff1f;\u60f3\u8c61\u4e00\u4e0b\u4f60\u5728\u8bad\u7ec3\u4e00\u4e2a\u4f7f\u7528Adam\u4f18\u5316\u5668\u7684\u6a21\u578b\u3002Adam\u4f1a\u4e3a\u6bcf\u4e2a\u53c2\u6570\u7ef4\u62a4\u4e24\u4e2a\u79fb\u52a8\u5e73\u5747\u503c&#xff08;\u4e00\u9636\u77e9\u548c\u4e8c\u9636\u77e9\u4f30\u8ba1&#xff09;\u3002\u5982\u679c\u4f60\u53ea\u52a0\u8f7d\u6a21\u578b\u6743\u91cd\u800c\u91cd\u7f6e\u4f18\u5316\u5668&#xff0c;\u76f8\u5f53\u4e8e\u5728\u8bad\u7ec3\u66f2\u7ebf\u4e2d\u95f4\u7a81\u7136\u6539\u53d8\u4e86\u4f18\u5316\u7b97\u6cd5&#xff0c;\u8fd9\u53ef\u80fd\u5bfc\u81f4\u8bad\u7ec3\u4e0d\u7a33\u5b9a\u751a\u81f3\u53d1\u6563\u3002<\/p>\n<p>\u6ce8\u610f&#xff1a;\u4e0d\u540c\u7248\u672c\u7684MMDetection\/MMEngine\u5728checkpoint\u4e2d\u4fdd\u5b58\u7684\u5177\u4f53\u5b57\u6bb5\u53ef\u80fd\u7565\u6709\u5dee\u5f02\u3002\u5728\u6062\u590d\u8bad\u7ec3\u524d&#xff0c;\u6700\u597d\u5148\u7528Python\u5feb\u901f\u68c0\u67e5\u4e00\u4e0bcheckpoint\u6587\u4ef6\u7684\u5185\u5bb9\u7ed3\u6784\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u7528\u51e0\u884c\u4ee3\u7801\u5feb\u901f\u67e5\u770bcheckpoint\u7684\u5185\u5bb9&#xff1a;<\/p>\n<p>import torch<br \/>\ncheckpoint &#061; torch.load(&#039;your_checkpoint.pth&#039;, map_location&#061;&#039;cpu&#039;)<br \/>\nprint(checkpoint.keys())<br \/>\n# \u901a\u5e38\u4f1a\u770b\u5230&#xff1a;[&#039;meta&#039;, &#039;state_dict&#039;, &#039;optimizer&#039;, &#039;lr_scheduler&#039;, &#039;epoch&#039;, &#039;iter&#039;]<\/p>\n<h4>1.2 resume-from vs load-from&#xff1a;\u5173\u952e\u533a\u522b\u89e3\u6790<\/h4>\n<p>\u5728OpenMMLab\u751f\u6001\u4e2d&#xff0c;\u4f60\u53ef\u80fd\u4f1a\u9047\u5230\u4e24\u4e2a\u76f8\u4f3c\u7684\u53c2\u6570&#xff1a;&#8211;resume-from\u548c&#8211;load-from\u3002\u867d\u7136\u5b83\u4eec\u90fd\u6d89\u53ca\u52a0\u8f7d\u6a21\u578b\u6587\u4ef6&#xff0c;\u4f46\u884c\u4e3a\u6709\u672c\u8d28\u533a\u522b\u3002\u7406\u89e3\u8fd9\u4e2a\u533a\u522b&#xff0c;\u80fd\u5e2e\u4f60\u907f\u514d\u5f88\u591a\u56f0\u60d1\u3002<\/p>\n<table>\n<tr>\u53c2\u6570\u6062\u590d\u7684\u5185\u5bb9epoch\u8ba1\u6570\u5178\u578b\u4f7f\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>&#8211;resume-from<\/td>\n<td>\u6a21\u578b\u6743\u91cd &#043; \u4f18\u5316\u5668\u72b6\u6001 &#043; \u8c03\u5ea6\u5668\u72b6\u6001 &#043; \u968f\u673a\u79cd\u5b50\u7b49\u5b8c\u6574\u8bad\u7ec3\u72b6\u6001<\/td>\n<td>\u7ee7\u627f\u68c0\u67e5\u70b9\u4e2d\u7684epoch\u6570<\/td>\n<td>\u8bad\u7ec3\u610f\u5916\u4e2d\u65ad\u540e\u7684\u6062\u590d<\/td>\n<\/tr>\n<tr>\n<td>&#8211;load-from<\/td>\n<td>\u4ec5\u6a21\u578b\u6743\u91cd<\/td>\n<td>\u4ece0\u5f00\u59cb<\/td>\n<td>\u8fc1\u79fb\u5b66\u4e60\u3001\u5fae\u8c03\u9884\u8bad\u7ec3\u6a21\u578b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8fd9\u4e2a\u533a\u522b\u5728\u5b9e\u9645\u64cd\u4f5c\u4e2d\u975e\u5e38\u5173\u952e\u3002\u4e3e\u4e2a\u4f8b\u5b50&#xff1a;\u5982\u679c\u4f60\u7684\u8bad\u7ec3\u5728epoch 50\u65f6\u4e2d\u65ad&#xff0c;\u4f60\u6709\u4e00\u4e2aepoch_50.pth\u6587\u4ef6\u3002<\/p>\n<ul>\n<li>\u4f7f\u7528&#8211;resume-from epoch_50.pth&#xff1a;\u8bad\u7ec3\u4f1a\u4eceepoch 50\u7ee7\u7eed&#xff0c;\u5b66\u4e60\u7387\u8c03\u5ea6\u5668\u4f1a\u57fa\u4e8e\u4e4b\u524d\u7684\u72b6\u6001\u7ee7\u7eed\u8c03\u6574&#xff0c;\u4f18\u5316\u5668\u52a8\u91cf\u5f97\u4ee5\u4fdd\u6301\u3002<\/li>\n<li>\u4f7f\u7528&#8211;load-from epoch_50.pth&#xff1a;\u8bad\u7ec3\u4f1a\u4eceepoch 0\u5f00\u59cb&#xff0c;\u4f46\u6a21\u578b\u521d\u59cb\u6743\u91cd\u662fepoch 50\u65f6\u7684\u6743\u91cd\u3002\u4f18\u5316\u5668\u72b6\u6001\u88ab\u91cd\u7f6e&#xff0c;\u5b66\u4e60\u7387\u4ece\u5934\u5f00\u59cb\u8c03\u5ea6\u3002<\/li>\n<\/ul>\n<p>\u5728MMDetection 3.x\u7248\u672c\u4e2d&#xff0c;&#8211;resume\u53c2\u6570\u7684\u884c\u4e3a\u5bf9\u5e94\u4e0a\u8868\u4e2d\u7684&#8211;resume-from\u3002\u5982\u679c\u4f60\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bbe\u7f6e&#xff0c;\u5bf9\u5e94\u7684\u5b57\u6bb5\u662fresume &#061; True\u914d\u5408load_from\u8def\u5f84\u3002<\/p>\n<h4>1.3 \u81ea\u52a8\u6062\u590d\u673a\u5236&#xff1a;&#8211;resume\u4e0d\u52a0\u8def\u5f84\u7684\u79d8\u5bc6<\/h4>\n<p>\u4f60\u53ef\u80fd\u89c1\u8fc7\u8fd9\u6837\u7684\u547d\u4ee4&#xff1a;<\/p>\n<p>python tools\/train.py configs\/faster_rcnn\/faster-rcnn_r50_fpn_1x_coco.py &#8211;resume<\/p>\n<p>\u6ce8\u610f\u8fd9\u91cc&#8211;resume\u540e\u9762\u6ca1\u6709\u8ddf\u5177\u4f53\u7684\u6587\u4ef6\u8def\u5f84\u3002\u8fd9\u662fMMEngine\u63d0\u4f9b\u7684\u4e00\u4e2a\u4fbf\u5229\u529f\u80fd&#xff1a;\u81ea\u52a8\u67e5\u627e\u6700\u65b0checkpoint\u3002<\/p>\n<p>\u5f53\u4f60\u4e0d\u6307\u5b9a\u8def\u5f84\u65f6&#xff0c;\u6846\u67b6\u4f1a\u6309\u7167\u4ee5\u4e0b\u903b\u8f91\u5bfb\u627e\u53ef\u6062\u590d\u7684checkpoint&#xff1a;<\/p>\n<li>\u9996\u5148\u68c0\u67e5work_dirs\u4e2d\u5bf9\u5e94\u5b9e\u9a8c\u76ee\u5f55\u4e0b\u7684latest.pth\u6587\u4ef6<\/li>\n<li>\u5982\u679c\u4e0d\u5b58\u5728&#xff0c;\u5219\u67e5\u627e\u6309\u65f6\u95f4\u6233\u6392\u5e8f\u7684\u6700\u65b0.pth\u6587\u4ef6<\/li>\n<li>\u5982\u679c\u627e\u5230&#xff0c;\u81ea\u52a8\u4ece\u6b64\u5904\u6062\u590d&#xff1b;\u5982\u679c\u627e\u4e0d\u5230&#xff0c;\u5219\u91cd\u65b0\u5f00\u59cb\u8bad\u7ec3&#xff08;\u4e0d\u4f1a\u62a5\u9519&#xff01;&#xff09;<\/li>\n<p>\u8fd9\u4e2a\u7279\u6027\u5f88\u65b9\u4fbf&#xff0c;\u4f46\u4e5f\u9690\u85cf\u7740\u98ce\u9669\u3002\u5047\u8bbe\u4f60\u7684latest.pth\u6587\u4ef6\u635f\u574f\u4e86&#xff0c;\u6216\u8005\u88ab\u8bef\u5220\u4e86&#xff0c;\u6846\u67b6\u4f1a\u9ed8\u9ed8\u5730\u5f00\u59cb\u4e00\u4e2a\u65b0\u7684\u8bad\u7ec3&#xff0c;\u800c\u4f60\u53ef\u80fd\u4f1a\u8bef\u4ee5\u4e3a\u6062\u590d\u6210\u529f\u4e86\u3002\u6211\u4e2a\u4eba\u7684\u4e60\u60ef\u662f&#xff1a;\u603b\u662f\u663e\u5f0f\u6307\u5b9acheckpoint\u8def\u5f84&#xff0c;\u9664\u975e\u662f\u5728\u5feb\u901f\u539f\u578b\u5f00\u53d1\u4e2d\u3002<\/p>\n<h3>2. \u65ad\u7535\u540e\u7684\u7b2c\u4e00\u6b65&#xff1a;\u8bca\u65ad\u4e0e\u5b9a\u4f4d<\/h3>\n<p>\u670d\u52a1\u5668\u6062\u590d\u4f9b\u7535\u540e&#xff0c;\u4f60\u7684\u7b2c\u4e00\u53cd\u5e94\u53ef\u80fd\u662f\u7acb\u5373\u5c1d\u8bd5\u6062\u590d\u8bad\u7ec3\u3002\u4f46\u8bf7\u7a0d\u7b49&#xff0c;\u5148\u82b110\u5206\u949f\u505a\u597d\u8bca\u65ad&#xff0c;\u8fd9\u80fd\u907f\u514d\u540e\u7eed\u66f4\u591a\u7684\u65f6\u95f4\u6d6a\u8d39\u3002<\/p>\n<h4>2.1 \u68c0\u67e5\u6587\u4ef6\u7cfb\u7edf\u5b8c\u6574\u6027&#xff1a;\u9690\u85cf\u7684\u6570\u636e\u635f\u574f<\/h4>\n<p>\u7a81\u7136\u65ad\u7535\u6700\u7cdf\u7cd5\u7684\u5f71\u54cd\u4e0d\u662f\u8bad\u7ec3\u4e2d\u65ad&#xff0c;\u800c\u662f\u53ef\u80fd\u5bfc\u81f4\u6587\u4ef6\u7cfb\u7edf\u635f\u574f\u6216\u6587\u4ef6\u5199\u5165\u4e0d\u5b8c\u6574\u3002\u7279\u522b\u662f\u5982\u679c\u65ad\u7535\u53d1\u751f\u5728checkpoint\u4fdd\u5b58\u8fc7\u7a0b\u4e2d&#xff0c;\u4f60\u5f97\u5230\u7684\u53ef\u80fd\u662f\u4e00\u4e2a\u635f\u574f\u7684.pth\u6587\u4ef6\u3002<\/p>\n<p>\u9996\u5148&#xff0c;\u68c0\u67e5\u76ee\u6807\u76ee\u5f55\u7684\u6587\u4ef6\u662f\u5426\u5b8c\u6574&#xff1a;<\/p>\n<p># \u8fdb\u5165\u4f60\u7684\u5b9e\u9a8c\u76ee\u5f55<br \/>\ncd work_dirs\/your_experiment<\/p>\n<p># \u5217\u51fa\u6240\u6709checkpoint\u6587\u4ef6&#xff0c;\u6309\u65f6\u95f4\u6392\u5e8f<br \/>\nls -lt *.pth<\/p>\n<p># \u68c0\u67e5\u6587\u4ef6\u5927\u5c0f\u662f\u5426\u5f02\u5e38&#xff08;\u4e0e\u4e4b\u524d\u7684checkpoint\u6bd4\u8f83&#xff09;<br \/>\nls -lh *.pth<\/p>\n<p># \u5c1d\u8bd5\u7528torch\u52a0\u8f7d&#xff0c;\u68c0\u67e5\u662f\u5426\u635f\u574f<br \/>\npython -c &#034;import torch; ckpt&#061;torch.load(&#039;epoch_50.pth&#039;, map_location&#061;&#039;cpu&#039;); print(&#039;Checkpoint loaded successfully&#039;)&#034;<\/p>\n<p>\u5982\u679c\u6700\u540e\u4e00\u4e2a\u547d\u4ee4\u62a5\u9519&#xff08;\u5982EOFError\u3001pickle.UnpicklingError&#xff09;&#xff0c;\u8bf4\u660e\u6587\u4ef6\u53ef\u80fd\u5df2\u635f\u574f\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b&#xff0c;\u4f60\u4e0d\u80fd\u4f7f\u7528\u8fd9\u4e2acheckpoint\u6062\u590d&#xff0c;\u800c\u9700\u8981\u56de\u9000\u5230\u66f4\u65e9\u7684\u5b8c\u6574checkpoint\u3002<\/p>\n<h4>2.2 \u5b9a\u4f4d\u6b63\u786e\u7684checkpoint&#xff1a;\u4e0d\u4ec5\u4ec5\u662f\u201c\u6700\u65b0\u201d\u7684<\/h4>\n<p>\u5728work_dirs\u76ee\u5f55\u4e2d&#xff0c;\u4f60\u53ef\u80fd\u4f1a\u770b\u5230\u591a\u79cdcheckpoint\u6587\u4ef6&#xff1a;<\/p>\n<ul>\n<li>epoch_{N}.pth&#xff1a;\u6bcf\u4e2aepoch\u7ed3\u675f\u65f6\u4fdd\u5b58\u7684\u5b8c\u6574checkpoint<\/li>\n<li>iter_{N}.pth&#xff1a;\u6309iteration\u95f4\u9694\u4fdd\u5b58\u7684checkpoint&#xff08;\u5982\u679c\u914d\u7f6e\u4e86&#xff09;<\/li>\n<li>latest.pth&#xff1a;\u6307\u5411\u6700\u65b0checkpoint\u7684\u8f6f\u94fe\u63a5\u6216\u5b9e\u9645\u6587\u4ef6<\/li>\n<li>best_{metric}.pth&#xff1a;\u4fdd\u5b58\u7684\u6700\u4f73\u6a21\u578b&#xff08;\u6839\u636e\u9a8c\u8bc1\u6307\u6807&#xff09;<\/li>\n<\/ul>\n<p>\u5173\u952e\u70b9&#xff1a;latest.pth\u4e0d\u4e00\u5b9a\u662f\u4f60\u8bad\u7ec3\u4e2d\u65ad\u65f6\u7684\u51c6\u786e\u72b6\u6001\u3002\u56e0\u4e3acheckpoint\u4fdd\u5b58\u662f\u5f02\u6b65\u64cd\u4f5c&#xff0c;\u5982\u679c\u65ad\u7535\u53d1\u751f\u5728\u4fdd\u5b58\u8fc7\u7a0b\u4e2d&#xff0c;latest.pth\u53ef\u80fd\u6307\u5411\u4e00\u4e2a\u672a\u5b8c\u5168\u5199\u5165\u7684\u6587\u4ef6\u3002<\/p>\n<p>\u66f4\u53ef\u9760\u7684\u65b9\u6cd5\u662f&#xff1a;\u67e5\u770bTensorBoard\u6216\u65e5\u5fd7\u6587\u4ef6&#xff0c;\u786e\u5b9a\u8bad\u7ec3\u5b9e\u9645\u4e2d\u65ad\u7684\u4f4d\u7f6e&#xff0c;\u7136\u540e\u9009\u62e9\u90a3\u4e2a\u65f6\u95f4\u70b9\u4e4b\u524d\u6700\u8fd1\u7684\u4e00\u4e2a\u5b8c\u6574checkpoint\u3002<\/p>\n<h4>2.3 \u7406\u89e3work_dirs\u7684\u76ee\u5f55\u7ed3\u6784<\/h4>\n<p>\u4e00\u4e2a\u7ec4\u7ec7\u826f\u597d\u7684work_dirs\u76ee\u5f55\u662f\u5feb\u901f\u6062\u590d\u8bad\u7ec3\u7684\u57fa\u7840\u3002\u5178\u578b\u7684MMDetection\u5b9e\u9a8c\u76ee\u5f55\u7ed3\u6784\u5982\u4e0b&#xff1a;<\/p>\n<p>work_dirs\/<br \/>\n\u2514\u2500\u2500 faster-rcnn_r50_fpn_1x_coco\/<br \/>\n    \u251c\u2500\u2500 20250101_120000\/          # \u65f6\u95f4\u6233\u5b50\u76ee\u5f55&#xff08;MMEngine\u9ed8\u8ba4&#xff09;<br \/>\n    \u2502   \u251c\u2500\u2500 vis_data\/             # \u53ef\u89c6\u5316\u6570\u636e<br \/>\n    \u2502   \u2502   \u2514\u2500\u2500 events.out.tfevents&#8230;  # TensorBoard\u65e5\u5fd7<br \/>\n    \u2502   \u251c\u2500\u2500 epoch_10.pth          # checkpoint\u6587\u4ef6<br \/>\n    \u2502   \u251c\u2500\u2500 epoch_20.pth<br \/>\n    \u2502   \u251c\u2500\u2500 latest.pth            # \u8f6f\u94fe\u63a5\u5230\u6700\u65b0checkpoint<br \/>\n    \u2502   \u2514\u2500\u2500 best_coco_bbox_mAP.pth # \u6700\u4f73\u6a21\u578b<br \/>\n    \u251c\u2500\u2500 faster-rcnn_r50_fpn_1x_coco.py  # \u8fd0\u884c\u65f6\u914d\u7f6e\u526f\u672c<br \/>\n    \u2514\u2500\u2500 log.txt                   # \u8bad\u7ec3\u65e5\u5fd7<\/p>\n<p>\u5b9e\u7528\u6280\u5de7&#xff1a;\u6211\u4e60\u60ef\u5728\u542f\u52a8\u8bad\u7ec3\u65f6\u4f7f\u7528\u56fa\u5b9a\u7684\u5de5\u4f5c\u76ee\u5f55&#xff0c;\u800c\u4e0d\u662f\u4f9d\u8d56\u65f6\u95f4\u6233&#xff1a;<\/p>\n<p>python tools\/train.py configs\/faster_rcnn\/faster-rcnn_r50_fpn_1x_coco.py \\\\<br \/>\n    &#8211;work-dir work_dirs\/my_experiment_fixed<\/p>\n<p>\u8fd9\u6837&#xff0c;\u6240\u6709\u76f8\u5173\u6587\u4ef6\u90fd\u5728\u4e00\u4e2a\u56fa\u5b9a\u4f4d\u7f6e&#xff0c;\u6062\u590d\u65f6\u66f4\u5bb9\u6613\u627e\u5230\u3002<\/p>\n<h3>3. \u5b9e\u6218\u6062\u590d&#xff1a;\u547d\u4ee4\u3001\u914d\u7f6e\u4e0e\u9677\u9631<\/h3>\n<p>\u73b0\u5728\u8fdb\u5165\u5b9e\u9645\u64cd\u4f5c\u73af\u8282\u3002\u6211\u5c06\u5c55\u793a\u51e0\u79cd\u5e38\u89c1\u7684\u6062\u590d\u573a\u666f&#xff0c;\u5e76\u6307\u51fa\u6bcf\u4e2a\u573a\u666f\u4e2d\u5bb9\u6613\u8e29\u7684\u5751\u3002<\/p>\n<h4>3.1 \u573a\u666f\u4e00&#xff1a;\u4ece\u7279\u5b9aepoch\u6062\u590d&#xff08;\u6700\u5e38\u7528&#xff09;<\/h4>\n<p>\u5047\u8bbe\u4f60\u7684\u8bad\u7ec3\u5728epoch 50\u65f6\u4e2d\u65ad&#xff0c;\u4f60\u60f3\u4eceepoch 45\u7684checkpoint\u7ee7\u7eed\u8bad\u7ec3&#xff08;\u4e3a\u4e86\u7559\u4e00\u4e9b\u5b89\u5168\u8fb9\u9645&#xff09;\u3002<\/p>\n<p>\u65b9\u6cd5\u4e00&#xff1a;\u547d\u4ee4\u884c\u76f4\u63a5\u6307\u5b9a<\/p>\n<p>python tools\/train.py configs\/faster_rcnn\/faster-rcnn_r50_fpn_1x_coco.py \\\\<br \/>\n    &#8211;resume work_dirs\/faster-rcnn_r50_fpn_1x_coco\/epoch_45.pth<\/p>\n<p>\u65b9\u6cd5\u4e8c&#xff1a;\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>\u5982\u679c\u4f60\u9700\u8981\u9891\u7e41\u6062\u590d&#xff0c;\u6216\u8005\u8981\u4e0e\u5176\u4ed6\u53c2\u6570\u4e00\u8d77\u8c03\u6574&#xff0c;\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u53ef\u80fd\u66f4\u65b9\u4fbf&#xff1a;<\/p>\n<p># \u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\u6216\u4fee\u6539<br \/>\nresume &#061; True<br \/>\nload_from &#061; &#039;work_dirs\/faster-rcnn_r50_fpn_1x_coco\/epoch_45.pth&#039;<\/p>\n<p># \u786e\u4fdd\u8bad\u7ec3\u603bepoch\u6570\u8db3\u591f<br \/>\ntrain_cfg &#061; dict(type&#061;&#039;EpochBasedTrainLoop&#039;, max_epochs&#061;100)  # \u539f\u672c\u53ef\u80fd\u662f100&#xff0c;\u73b0\u5728\u4ece45\u5f00\u59cb<\/p>\n<p>\u5e38\u89c1\u9677\u96311&#xff1a;\u914d\u7f6e\u6587\u4ef6\u7248\u672c\u4e0d\u5339\u914d<\/p>\n<p>\u8fd9\u662f\u6062\u590d\u8bad\u7ec3\u65f6\u6700\u5e38\u89c1\u7684\u95ee\u9898\u4e4b\u4e00\u3002\u5982\u679c\u4f60\u5728\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u4fee\u6539\u4e86\u914d\u7f6e\u6587\u4ef6&#xff08;\u6bd4\u5982\u8c03\u6574\u4e86\u6570\u636e\u589e\u5f3a\u53c2\u6570&#xff09;&#xff0c;\u7136\u540e\u5c1d\u8bd5\u7528\u65e7\u7684checkpoint\u6062\u590d&#xff0c;\u53ef\u80fd\u4f1a\u9047\u5230\u9519\u8bef\u3002<\/p>\n<p>\u68c0\u67e5\u70b9&#xff1a;\u6062\u590d\u524d&#xff0c;\u786e\u4fdd\u5f53\u524d\u4f7f\u7528\u7684\u914d\u7f6e\u6587\u4ef6\u4e0e\u751f\u6210checkpoint\u65f6\u4f7f\u7528\u7684\u914d\u7f6e\u6587\u4ef6\u517c\u5bb9\u3002\u81f3\u5c11\u7f51\u7edc\u7ed3\u6784\u4e0d\u5e94\u8be5\u6709\u53d8\u5316\u3002\u4e00\u4e2a\u4fdd\u9669\u7684\u505a\u6cd5\u662f&#xff0c;\u4f7f\u7528work_dirs\u4e2d\u4fdd\u5b58\u7684\u914d\u7f6e\u6587\u4ef6\u526f\u672c&#xff1a;<\/p>\n<p># \u4f7f\u7528work_dirs\u4e2d\u4fdd\u5b58\u7684\u914d\u7f6e\u526f\u672c&#xff0c;\u786e\u4fdd\u5b8c\u5168\u4e00\u81f4<br \/>\npython tools\/train.py work_dirs\/faster-rcnn_r50_fpn_1x_coco\/faster-rcnn_r50_fpn_1x_coco.py \\\\<br \/>\n    &#8211;resume work_dirs\/faster-rcnn_r50_fpn_1x_coco\/epoch_45.pth<\/p>\n<h4>3.2 \u573a\u666f\u4e8c&#xff1a;\u5904\u7406CUDA\u7248\u672c\u4e0e\u73af\u5883\u53d8\u5316<\/h4>\n<p>\u670d\u52a1\u5668\u65ad\u7535\u91cd\u542f\u540e&#xff0c;\u4f60\u53ef\u80fd\u4f1a\u53d1\u73b0CUDA\u7248\u672c\u3001PyTorch\u7248\u672c\u751a\u81f3Python\u73af\u5883\u53d1\u751f\u4e86\u53d8\u5316\u3002\u8fd9\u65f6\u76f4\u63a5\u6062\u590d\u8bad\u7ec3\u53ef\u80fd\u4f1a\u5931\u8d25\u3002<\/p>\n<p>\u95ee\u9898\u8bca\u65ad\u6b65\u9aa4&#xff1a;<\/p>\n<li>\n<p>\u68c0\u67e5CUDA\u53ef\u7528\u6027&#xff1a;<\/p>\n<p> python -c &#034;import torch; print(f&#039;PyTorch: {torch.__version__}&#039;); print(f&#039;CUDA available: {torch.cuda.is_available()}&#039;); print(f&#039;CUDA version: {torch.version.cuda}&#039;)&#034;\n <\/li>\n<li>\n<p>\u68c0\u67e5checkpoint\u7684\u8bbe\u5907\u6620\u5c04&#xff1a; \u5982\u679ccheckpoint\u662f\u5728GPU\u4e0a\u4fdd\u5b58\u7684&#xff0c;\u4f46\u73b0\u5728\u53ea\u80fd\u5728CPU\u4e0a\u52a0\u8f7d&#xff0c;\u9700\u8981\u6307\u5b9amap_location\u3002\u867d\u7136MMDetection\u4f1a\u81ea\u52a8\u5904\u7406&#xff0c;\u4f46\u4e86\u89e3\u539f\u7406\u6709\u5e2e\u52a9&#xff1a;<\/p>\n<p> # \u624b\u52a8\u68c0\u67e5<br \/>\nimport torch<br \/>\ncheckpoint &#061; torch.load(&#039;epoch_45.pth&#039;, map_location&#061;&#039;cpu&#039;)<br \/>\n# \u67e5\u770b\u6743\u91cd\u662f\u5426\u5305\u542bCUDA tensor<br \/>\nfor key, value in checkpoint[&#039;state_dict&#039;].items():<br \/>\n    if value.is_cuda:<br \/>\n        print(f&#034;{key} is on CUDA&#034;)\n <\/li>\n<p>\u89e3\u51b3\u65b9\u6848&#xff1a;<\/p>\n<ul>\n<li>\u5982\u679c\u73af\u5883\u53d8\u5316\u4e0d\u5927&#xff08;\u5982CUDA 11.3\u219211.4&#xff09;&#xff0c;\u901a\u5e38\u53ef\u4ee5\u76f4\u63a5\u6062\u590d<\/li>\n<li>\u5982\u679cCUDA\u7248\u672c\u5dee\u5f02\u5927&#xff0c;\u8003\u8651\u5728CPU\u4e0a\u52a0\u8f7d\u7136\u540e\u4fdd\u5b58&#xff0c;\u518d\u91cd\u65b0\u52a0\u8f7d&#xff1a;import torch<br \/>\ncheckpoint &#061; torch.load(&#039;epoch_45.pth&#039;, map_location&#061;&#039;cpu&#039;)<br \/>\ntorch.save(checkpoint, &#039;epoch_45_cpu.pth&#039;)<br \/>\n \u7136\u540e\u4f7f\u7528\u8fd9\u4e2aCPU\u7248\u672c\u7684checkpoint\u6062\u590d<\/li>\n<\/ul>\n<h4>3.3 \u573a\u666f\u4e09&#xff1a;\u5206\u5e03\u5f0f\u8bad\u7ec3\u6062\u590d<\/h4>\n<p>\u5982\u679c\u4f60\u7684\u539f\u59cb\u8bad\u7ec3\u662f\u591aGPU\u5206\u5e03\u5f0f\u8bad\u7ec3&#xff0c;\u6062\u590d\u65f6\u9700\u8981\u7279\u522b\u6ce8\u610f\u3002<\/p>\n<p>\u5355\u673a\u591a\u5361\u6062\u590d&#xff1a;<\/p>\n<p># \u5047\u8bbe\u539f\u6765\u75284\u5361\u8bad\u7ec3<br \/>\n.\/tools\/dist_train.sh configs\/faster_rcnn\/faster-rcnn_r50_fpn_1x_coco.py 4 \\\\<br \/>\n    &#8211;resume work_dirs\/faster-rcnn_r50_fpn_1x_coco\/epoch_45.pth<\/p>\n<p>\u5173\u952e\u70b9&#xff1a;\u5206\u5e03\u5f0f\u8bad\u7ec3\u7684checkpoint\u5305\u542b\u4e86\u6240\u6709GPU\u7684\u6a21\u578b\u72b6\u6001\u3002\u6062\u590d\u65f6\u4f7f\u7528\u7684GPU\u6570\u91cf\u6700\u597d\u4e0e\u539f\u6765\u76f8\u540c\u3002\u5982\u679c\u5fc5\u987b\u6539\u53d8GPU\u6570\u91cf&#xff0c;\u9700\u8981\u4e86\u89e3&#xff1a;<\/p>\n<ul>\n<li>\u6570\u636e\u5e76\u884c\u4e0b&#xff0c;\u4e0d\u540cGPU\u6570\u91cf\u7684batch size\u6548\u5e94\u4f1a\u4e0d\u540c<\/li>\n<li>\u5982\u679c\u4f7f\u7528SyncBatchNorm&#xff0c;GPU\u6570\u91cf\u53d8\u5316\u4f1a\u5f71\u54cd\u7edf\u8ba1\u91cf<\/li>\n<\/ul>\n<p>\u591a\u673a\u8bad\u7ec3\u6062\u590d&#xff1a; \u591a\u673a\u8bad\u7ec3\u6062\u590d\u66f4\u590d\u6742&#xff0c;\u56e0\u4e3a\u6d89\u53ca\u591a\u4e2a\u8282\u70b9\u7684\u72b6\u6001\u540c\u6b65\u3002\u57fa\u672c\u539f\u5219&#xff1a;<\/p>\n<li>\u6240\u6709\u8282\u70b9\u5fc5\u987b\u80fd\u8bbf\u95ee\u5230\u540c\u4e00\u4e2acheckpoint\u6587\u4ef6&#xff08;\u901a\u8fc7\u5171\u4eab\u5b58\u50a8\u6216\u624b\u52a8\u590d\u5236&#xff09;<\/li>\n<li>\u6062\u590d\u65f6\u4f7f\u7528\u5b8c\u5168\u76f8\u540c\u7684\u8282\u70b9\u6570\u548cGPU\u6570<\/li>\n<li>\u786e\u4fdd\u7f51\u7edc\u914d\u7f6e&#xff08;\u7279\u522b\u662fdist_params\u4e2d\u7684\u7aef\u53e3\u53f7&#xff09;\u4e00\u81f4<\/li>\n<h4>3.4 \u573a\u666f\u56db&#xff1a;\u6062\u590d\u540e\u8c03\u6574\u8bad\u7ec3\u53c2\u6570<\/h4>\n<p>\u6709\u65f6\u4f60\u4e0d\u4ec5\u60f3\u6062\u590d\u8bad\u7ec3&#xff0c;\u8fd8\u60f3\u8d81\u673a\u8c03\u6574\u4e00\u4e9b\u8bad\u7ec3\u53c2\u6570\u3002\u8fd9\u9700\u8981\u8c28\u614e\u5904\u7406\u3002<\/p>\n<p>\u53ef\u4ee5\u5b89\u5168\u8c03\u6574\u7684\u53c2\u6570&#xff1a;<\/p>\n<ul>\n<li>max_epochs&#xff1a;\u589e\u52a0\u8bad\u7ec3\u603b\u8f6e\u6570<\/li>\n<li>checkpoint\u95f4\u9694&#xff1a;\u8c03\u6574\u4fdd\u5b58\u9891\u7387<\/li>\n<li>log_config&#xff1a;\u4fee\u6539\u65e5\u5fd7\u8bb0\u5f55\u95f4\u9694<\/li>\n<\/ul>\n<p>\u9700\u8981\u8c28\u614e\u8c03\u6574\u7684\u53c2\u6570&#xff1a;<\/p>\n<ul>\n<li>optimizer\u7c7b\u578b\u6216\u8d85\u53c2\u6570&#xff1a;\u6539\u53d8\u4f18\u5316\u5668\u6216\u5b66\u4e60\u7387\u4f1a\u7834\u574f\u4f18\u5316\u5668\u72b6\u6001\u7684\u8fde\u7eed\u6027<\/li>\n<li>model\u7ed3\u6784&#xff1a;\u7f51\u7edc\u7ed3\u6784\u53d8\u5316\u53ef\u80fd\u5bfc\u81f4\u6743\u91cd\u52a0\u8f7d\u5931\u8d25<\/li>\n<li>data pipeline&#xff1a;\u6570\u636e\u9884\u5904\u7406\u53d8\u5316\u53ef\u80fd\u5bfc\u81f4\u8bad\u7ec3\u66f2\u7ebf\u4e0d\u8fde\u7eed<\/li>\n<\/ul>\n<p>\u5982\u679c\u5fc5\u987b\u8c03\u6574\u4f18\u5316\u5668&#xff1a; \u5047\u8bbe\u4f60\u60f3\u5728\u6062\u590d\u8bad\u7ec3\u65f6\u628a\u5b66\u4e60\u7387\u964d\u4f4e\u5230\u539f\u6765\u7684\u5341\u5206\u4e4b\u4e00&#xff1a;<\/p>\n<p># \u5728\u914d\u7f6e\u6587\u4ef6\u4e2d<br \/>\n# \u9996\u5148\u6b63\u5e38\u6062\u590d<br \/>\nresume &#061; True<br \/>\nload_from &#061; &#039;work_dirs\/faster-rcnn_r50_fpn_1x_coco\/epoch_45.pth&#039;<\/p>\n<p># \u7136\u540e\u8986\u76d6\u4f18\u5316\u5668\u914d\u7f6e<br \/>\noptim_wrapper &#061; dict(<br \/>\n    type&#061;&#039;OptimWrapper&#039;,<br \/>\n    optimizer&#061;dict(type&#061;&#039;SGD&#039;, lr&#061;0.002, momentum&#061;0.9, weight_decay&#061;0.0001),  # \u539flr\u53ef\u80fd\u662f0.02<br \/>\n    clip_grad&#061;None<br \/>\n)<\/p>\n<p>\u6ce8\u610f&#xff1a;\u8fd9\u6837\u8bbe\u7f6e\u4f1a\u91cd\u7f6e\u4f18\u5316\u5668\u72b6\u6001\u3002\u5982\u679c\u4f60\u5e0c\u671b\u4fdd\u6301\u4f18\u5316\u5668\u52a8\u91cf\u7b49\u72b6\u6001&#xff0c;\u540c\u65f6\u53ea\u8c03\u6574\u5b66\u4e60\u7387&#xff0c;\u9700\u8981\u5728\u6062\u590d\u540e\u901a\u8fc7\u5b66\u4e60\u7387\u8c03\u5ea6\u5668\u5b9e\u73b0\u3002<\/p>\n<h3>4. \u9ad8\u7ea7\u6280\u5de7\u4e0e\u6df1\u5ea6\u8bca\u65ad<\/h3>\n<p>\u638c\u63e1\u4e86\u57fa\u672c\u6062\u590d\u64cd\u4f5c\u540e&#xff0c;\u6211\u4eec\u6765\u770b\u770b\u4e00\u4e9b\u9ad8\u7ea7\u6280\u5de7&#xff0c;\u8fd9\u4e9b\u6280\u5de7\u80fd\u5e2e\u4f60\u5904\u7406\u66f4\u590d\u6742\u7684\u60c5\u51b5&#xff0c;\u5e76\u6df1\u5165\u7406\u89e3\u6062\u590d\u8fc7\u7a0b\u4e2d\u7684\u7ec6\u8282\u3002<\/p>\n<h4>4.1 \u4f7f\u7528TensorBoard\u8fdb\u884c\u6062\u590d\u9a8c\u8bc1<\/h4>\n<p>TensorBoard\u4e0d\u4ec5\u662f\u53ef\u89c6\u5316\u5de5\u5177&#xff0c;\u66f4\u662f\u9a8c\u8bc1\u6062\u590d\u662f\u5426\u6210\u529f\u7684\u5229\u5668\u3002\u6062\u590d\u8bad\u7ec3\u540e&#xff0c;\u4f60\u5e94\u8be5\u7acb\u5373\u68c0\u67e5\u8bad\u7ec3\u66f2\u7ebf\u7684\u8fde\u7eed\u6027\u3002<\/p>\n<p>\u64cd\u4f5c\u6b65\u9aa4&#xff1a;<\/p>\n<li>\n<p>\u542f\u52a8TensorBoard&#xff0c;\u540c\u65f6\u52a0\u8f7d\u65b0\u65e7\u65e5\u5fd7&#xff1a;<\/p>\n<p> tensorboard &#8211;logdir work_dirs\/faster-rcnn_r50_fpn_1x_coco &#8211;port 6006\n <\/li>\n<li>\n<p>\u68c0\u67e5\u5173\u952e\u6307\u6807\u7684\u8fde\u7eed\u6027&#xff1a;<\/p>\n<ul>\n<li>Loss\u66f2\u7ebf&#xff1a;\u6062\u590d\u540e\u7684loss\u503c\u5e94\u8be5\u4e0e\u4e2d\u65ad\u524d\u57fa\u672c\u8854\u63a5&#xff0c;\u4e0d\u4f1a\u51fa\u73b0\u7a81\u53d8<\/li>\n<li>\u5b66\u4e60\u7387\u66f2\u7ebf&#xff1a;\u5982\u679c\u4f7f\u7528\u5b66\u4e60\u7387\u8c03\u5ea6\u5668&#xff0c;\u6062\u590d\u540e\u7684\u5b66\u4e60\u7387\u5e94\u8be5\u5ef6\u7eed\u4e4b\u524d\u7684\u8d8b\u52bf<\/li>\n<li>\u9a8c\u8bc1\u6307\u6807&#xff1a;\u6062\u590d\u540e\u7684\u9a8c\u8bc1\u6307\u6807\u5e94\u8be5\u4e0e\u4e2d\u65ad\u524d\u4fdd\u6301\u53ef\u6bd4\u6027<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5bf9\u6bd4\u5206\u6790&#xff1a; \u5982\u679c\u4f60\u6709\u4e2d\u65ad\u524d\u540e\u7684\u5b8c\u6574\u65e5\u5fd7&#xff0c;\u53ef\u4ee5\u5728TensorBoard\u4e2d\u53e0\u52a0\u663e\u793a&#xff0c;\u76f4\u89c2\u67e5\u770b\u6062\u590d\u6548\u679c&#xff1a;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/via.placeholder.com\/800x400.png?text=%E6%81%A2%E5%A4%8D%E5%89%8D%E5%90%8E%E8%AE%AD%E7%BB%83%E6%9B%B2%E7%BA%BF%E5%AF%B9%E6%AF%94%E5%9B%BE\" alt=\"\u8bad\u7ec3\u66f2\u7ebf\u5bf9\u6bd4\u793a\u4f8b\" \/><\/p>\n<p>\u4e0a\u56fe\u5c55\u793a\u4e86\u7406\u60f3\u60c5\u51b5\u4e0b\u7684\u6062\u590d&#xff1a;\u84dd\u8272\u66f2\u7ebf\u662f\u539f\u59cb\u8bad\u7ec3&#xff0c;\u6a59\u8272\u66f2\u7ebf\u662f\u4eceepoch 45\u6062\u590d\u540e\u7684\u8bad\u7ec3&#xff0c;\u4e24\u8005\u5e73\u6ed1\u8854\u63a5\u3002<\/p>\n<\/li>\n<p>\u5e38\u89c1\u95ee\u9898\u8bca\u65ad&#xff1a;<\/p>\n<ul>\n<li>\u66f2\u7ebf\u8df3\u8dc3&#xff1a;\u5982\u679closs\u5728\u6062\u590d\u540e\u7a81\u7136\u4e0a\u5347&#xff0c;\u53ef\u80fd\u662f\u4f18\u5316\u5668\u72b6\u6001\u4e22\u5931\u6216\u5b66\u4e60\u7387\u8bbe\u7f6e\u4e0d\u5f53<\/li>\n<li>\u6307\u6807\u4e0b\u964d&#xff1a;\u5982\u679c\u9a8c\u8bc1\u6307\u6807\u4e0b\u964d&#xff0c;\u53ef\u80fd\u662f\u8fc7\u62df\u5408\u6216\u6570\u636e\u52a0\u8f7d\u4e0d\u4e00\u81f4<\/li>\n<li>\u66f2\u7ebf\u4e0d\u8fde\u7eed\u4f46\u8d8b\u52bf\u4e00\u81f4&#xff1a;\u5982\u679c\u53ea\u662f\u6570\u503c\u504f\u79fb\u4f46\u8d8b\u52bf\u4e00\u81f4&#xff0c;\u53ef\u80fd\u662f\u968f\u673a\u79cd\u5b50\u4e0d\u540c\u5bfc\u81f4\u7684\u6570\u636e\u987a\u5e8f\u5dee\u5f02<\/li>\n<\/ul>\n<h4>4.2 \u5904\u7406\u201c\u5361\u5728dataloader\u201d\u7684\u95ee\u9898<\/h4>\n<p>\u793e\u533a\u4e2d\u5e38\u89c1\u7684\u4e00\u4e2a\u95ee\u9898\u662f&#xff1a;\u4f7f\u7528&#8211;resume\u540e&#xff0c;\u7a0b\u5e8f\u5361\u5728&#034;Advance dataloader&#034;\u6b65\u9aa4&#xff0c;\u957f\u65f6\u95f4\u6ca1\u6709\u8fdb\u5c55\u3002<\/p>\n<p>\u95ee\u9898\u73b0\u8c61&#xff1a;<\/p>\n<p>05\/17 11:07:53 &#8211; mmengine &#8211; WARNING &#8211; Advance dataloader 32500 steps to skip data that has already been trained<\/p>\n<p>\u539f\u56e0\u5206\u6790&#xff1a; \u8fd9\u662fMMEngine\u7684\u4e00\u4e2a\u8bbe\u8ba1\u7279\u6027\u3002\u4e3a\u4e86\u786e\u4fdd\u6062\u590d\u540e\u6bcf\u4e2a\u6837\u672c\u53ea\u88ab\u8bad\u7ec3\u4e00\u6b21&#xff08;\u907f\u514d\u6570\u636e\u6cc4\u9732&#xff09;&#xff0c;\u6846\u67b6\u4f1a&#034;\u5feb\u8fdb&#034;dataloader&#xff0c;\u8df3\u8fc7\u5df2\u7ecf\u5904\u7406\u8fc7\u7684\u6570\u636e\u3002\u5982\u679c\u4e2d\u65ad\u65f6\u7684iteration\u6570\u5f88\u5927&#xff08;\u598232500&#xff09;&#xff0c;\u8fd9\u4e2a\u5feb\u8fdb\u8fc7\u7a0b\u53ef\u80fd\u9700\u8981\u5f88\u957f\u65f6\u95f4&#xff0c;\u7279\u522b\u662f&#xff1a;<\/p>\n<ul>\n<li>\u6570\u636e\u96c6\u5f88\u5927<\/li>\n<li>\u6570\u636e\u9884\u5904\u7406\u590d\u6742<\/li>\n<li>num_workers\u8bbe\u7f6e\u8f83\u5c0f<\/li>\n<\/ul>\n<p>\u89e3\u51b3\u65b9\u6848&#xff1a;<\/p>\n<li>\n<p>\u589e\u52a0num_workers&#xff1a;<\/p>\n<p> train_dataloader &#061; dict(<br \/>\n    batch_size&#061;2,<br \/>\n    num_workers&#061;8,  # \u589e\u52a0worker\u6570\u91cf&#xff0c;\u52a0\u901f\u6570\u636e\u52a0\u8f7d<br \/>\n    persistent_workers&#061;True,<br \/>\n    sampler&#061;dict(type&#061;&#039;DefaultSampler&#039;, shuffle&#061;True),<br \/>\n    dataset&#061;train_dataset<br \/>\n)\n <\/li>\n<li>\n<p>\u4f7f\u7528\u66f4\u9ad8\u6548\u7684\u6570\u636e\u52a0\u8f7d&#xff1a;<\/p>\n<ul>\n<li>\u786e\u4fdd\u6570\u636e\u5b58\u50a8\u5728SSD\u800c\u4e0d\u662fHDD<\/li>\n<li>\u4f7f\u7528persistent_workers&#061;True\u907f\u514d\u91cd\u590d\u521b\u5efaworker<\/li>\n<li>\u9884\u5904\u7406\u597d\u6570\u636e&#xff0c;\u51cf\u5c11\u5728\u7ebf\u9884\u5904\u7406\u5f00\u9500<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8c03\u6574\u6062\u590d\u7b56\u7565&#xff1a; \u5982\u679c\u5feb\u8fdb\u65f6\u95f4\u5b9e\u5728\u65e0\u6cd5\u63a5\u53d7&#xff0c;\u53ef\u4ee5\u8003\u8651&#xff1a;<\/p>\n<ul>\n<li>\u4e0d\u4ece\u7cbe\u786e\u7684iteration\u6062\u590d&#xff0c;\u800c\u662f\u4ece\u6700\u8fd1\u7684epoch\u5f00\u59cb&#xff08;\u4f1a\u635f\u5931\u5c11\u91cf\u6570\u636e&#xff0c;\u4f46\u901a\u5e38\u5f71\u54cd\u4e0d\u5927&#xff09;<\/li>\n<li>\u4fee\u6539\u6e90\u4ee3\u7801&#xff0c;\u7981\u7528\u4e25\u683c\u7684\u6570\u636e\u8df3\u8fc7&#xff08;\u4e0d\u63a8\u8350&#xff0c;\u53ef\u80fd\u5f71\u54cd\u7ed3\u679c\u53ef\u590d\u73b0\u6027&#xff09;<\/li>\n<\/ul>\n<\/li>\n<h4>4.3 \u968f\u673a\u79cd\u5b50\u4e0e\u53ef\u590d\u73b0\u6027<\/h4>\n<p>\u6df1\u5ea6\u5b66\u4e60\u4e2d\u7684\u968f\u673a\u6027\u4e3b\u8981\u6765\u81ea&#xff1a;<\/p>\n<li>\u6a21\u578b\u6743\u91cd\u521d\u59cb\u5316<\/li>\n<li>\u6570\u636e\u52a0\u8f7d\u987a\u5e8f&#xff08;shuffle&#xff09;<\/li>\n<li>\u6570\u636e\u589e\u5f3a\u7684\u968f\u673a\u53d8\u6362<\/li>\n<li>Dropout\u7b49\u968f\u673a\u64cd\u4f5c<\/li>\n<p>\u6062\u590d\u8bad\u7ec3\u65f6&#xff0c;\u5982\u679c\u968f\u673a\u79cd\u5b50\u7ba1\u7406\u4e0d\u5f53&#xff0c;\u53ef\u80fd\u5bfc\u81f4&#xff1a;<\/p>\n<ul>\n<li>\u4e24\u6b21\u8bad\u7ec3\u7684\u7ed3\u679c\u4e0d\u53ef\u76f4\u63a5\u6bd4\u8f83<\/li>\n<li>\u6062\u590d\u540e\u7684\u8bad\u7ec3\u6548\u679c\u4e0e\u9884\u671f\u4e0d\u7b26<\/li>\n<\/ul>\n<p>MMEngine\u7684\u968f\u673a\u79cd\u5b50\u7ba1\u7406&#xff1a;<\/p>\n<p>MMEngine\u4f1a\u5728checkpoint\u4e2d\u4fdd\u5b58\u968f\u673a\u72b6\u6001&#xff0c;\u6062\u590d\u65f6\u81ea\u52a8\u52a0\u8f7d\u3002\u4f46\u4f60\u9700\u8981\u786e\u4fdd&#xff1a;<\/p>\n<li>\n<p>\u914d\u7f6e\u4e2d\u6b63\u786e\u8bbe\u7f6e\u968f\u673a\u79cd\u5b50&#xff1a;<\/p>\n<p> # \u5728\u914d\u7f6e\u6587\u4ef6\u4e2d<br \/>\nrandomness &#061; dict(seed&#061;42, diff_rank_seed&#061;True)\n <\/li>\n<li>\n<p>\u7406\u89e3diff_rank_seed\u7684\u4f5c\u7528&#xff1a;<\/p>\n<ul>\n<li>False&#xff1a;\u6240\u6709\u8fdb\u7a0b\u4f7f\u7528\u76f8\u540c\u968f\u673a\u79cd\u5b50<\/li>\n<li>True&#xff1a;\u4e0d\u540crank\u7684\u8fdb\u7a0b\u4f7f\u7528\u4e0d\u540c\u7684\u968f\u673a\u79cd\u5b50&#xff08;\u57fa\u4e8e\u57fa\u7840\u79cd\u5b50\u6d3e\u751f&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u6062\u590d\u540e\u7684\u9a8c\u8bc1&#xff1a; \u6062\u590d\u8bad\u7ec3\u540e&#xff0c;\u53ef\u4ee5\u8fd0\u884c\u4e00\u4e2a\u7b80\u77ed\u7684\u9a8c\u8bc1&#xff0c;\u786e\u4fdd\u7ed3\u679c\u4e0e\u4e2d\u65ad\u524d\u4e00\u81f4&#xff08;\u5728\u5141\u8bb8\u7684\u968f\u673a\u8bef\u5dee\u8303\u56f4\u5185&#xff09;\u3002<\/p>\n<\/li>\n<h4>4.4 Checkpoint\u7ba1\u7406\u7b56\u7565<\/h4>\n<p>\u826f\u597d\u7684checkpoint\u7ba1\u7406\u4e0d\u4ec5\u80fd\u5e2e\u4f60\u6062\u590d\u8bad\u7ec3&#xff0c;\u8fd8\u80fd\u4e3a\u6a21\u578b\u9009\u62e9\u3001\u8c03\u8bd5\u548c\u5206\u6790\u63d0\u4f9b\u652f\u6301\u3002<\/p>\n<p>\u63a8\u8350\u7684\u6587\u4ef6\u547d\u540d\u548c\u7ec4\u7ec7\u65b9\u5f0f&#xff1a;<\/p>\n<p>work_dirs\/<br \/>\n\u2514\u2500\u2500 coco_faster_rcnn_r50_20240101\/<br \/>\n    \u251c\u2500\u2500 config.py                    # \u5b9e\u9a8c\u914d\u7f6e<br \/>\n    \u251c\u2500\u2500 train.log                    # \u5b8c\u6574\u8bad\u7ec3\u65e5\u5fd7<br \/>\n    \u251c\u2500\u2500 checkpoints\/                 # \u4e13\u95e8\u5b58\u653echeckpoint<br \/>\n    \u2502   \u251c\u2500\u2500 epoch_10.pth<br \/>\n    \u2502   \u251c\u2500\u2500 epoch_20.pth<br \/>\n    \u2502   \u251c\u2500\u2500 &#8230;<br \/>\n    \u2502   \u2514\u2500\u2500 best\/<br \/>\n    \u2502       \u251c\u2500\u2500 best_mAP_0.425.pth   # \u5305\u542b\u6307\u6807\u503c\u7684\u547d\u540d<br \/>\n    \u2502       \u2514\u2500\u2500 best_loss_1.234.pth<br \/>\n    \u251c\u2500\u2500 tensorboard\/                 # TensorBoard\u65e5\u5fd7<br \/>\n    \u2514\u2500\u2500 analysis\/                    # \u5206\u6790\u7ed3\u679c<\/p>\n<p>\u81ea\u52a8\u5316\u6e05\u7406\u811a\u672c&#xff1a; \u957f\u65f6\u95f4\u8bad\u7ec3\u4f1a\u4ea7\u751f\u5927\u91cfcheckpoint&#xff0c;\u5360\u7528\u5927\u91cf\u78c1\u76d8\u7a7a\u95f4\u3002\u6211\u4f7f\u7528\u4e00\u4e2a\u7b80\u5355\u7684Python\u811a\u672c\u5b9a\u671f\u6e05\u7406&#xff1a;<\/p>\n<p>#!\/usr\/bin\/env python3<br \/>\n&#034;&#034;&#034;<br \/>\ncheckpoint\u6e05\u7406\u811a\u672c<br \/>\n\u4fdd\u7559\u7b56\u7565&#xff1a;<br \/>\n1. \u6bcf10\u4e2aepoch\u4fdd\u7559\u4e00\u4e2a<br \/>\n2. \u6700\u540e10\u4e2aepoch\u5168\u90e8\u4fdd\u7559<br \/>\n3. \u6700\u4f73\u6a21\u578b\u5168\u90e8\u4fdd\u7559<br \/>\n&#034;&#034;&#034;<br \/>\nimport os<br \/>\nimport re<br \/>\nimport glob<\/p>\n<p>def clean_checkpoints(checkpoint_dir, keep_every&#061;10, keep_last&#061;10):<br \/>\n    &#034;&#034;&#034;\u6e05\u7406checkpoint\u6587\u4ef6&#034;&#034;&#034;<br \/>\n    # \u83b7\u53d6\u6240\u6709checkpoint\u6587\u4ef6<br \/>\n    checkpoint_files &#061; glob.glob(os.path.join(checkpoint_dir, &#034;epoch_*.pth&#034;))<\/p>\n<p>    # \u63d0\u53d6epoch\u6570\u5b57<br \/>\n    epoch_files &#061; []<br \/>\n    for f in checkpoint_files:<br \/>\n        match &#061; re.search(r&#039;epoch_(\\\\d&#043;)\\\\.pth&#039;, os.path.basename(f))<br \/>\n        if match:<br \/>\n            epoch &#061; int(match.group(1))<br \/>\n            epoch_files.append((epoch, f))<\/p>\n<p>    # \u6309epoch\u6392\u5e8f<br \/>\n    epoch_files.sort(key&#061;lambda x: x[0])<\/p>\n<p>    # \u786e\u5b9a\u8981\u4fdd\u7559\u7684\u6587\u4ef6<br \/>\n    keep_files &#061; set()<\/p>\n<p>    # \u4fdd\u7559\u7b56\u75651&#xff1a;\u6bcf\u9694keep_every\u4e2a\u4fdd\u7559\u4e00\u4e2a<br \/>\n    for epoch, f in epoch_files:<br \/>\n        if epoch % keep_every &#061;&#061; 0:<br \/>\n            keep_files.add(f)<\/p>\n<p>    # \u4fdd\u7559\u7b56\u75652&#xff1a;\u4fdd\u7559\u6700\u540ekeep_last\u4e2a<br \/>\n    for epoch, f in epoch_files[-keep_last:]:<br \/>\n        keep_files.add(f)<\/p>\n<p>    # \u6c38\u8fdc\u4fdd\u7559best\u6a21\u578b<br \/>\n    best_files &#061; glob.glob(os.path.join(checkpoint_dir, &#034;best_*.pth&#034;))<br \/>\n    keep_files.update(best_files)<\/p>\n<p>    # \u5220\u9664\u4e0d\u9700\u8981\u7684\u6587\u4ef6<br \/>\n    for f in checkpoint_files:<br \/>\n        if f not in keep_files:<br \/>\n            print(f&#034;\u5220\u9664: {f}&#034;)<br \/>\n            os.remove(f)<\/p>\n<p>    print(f&#034;\u6e05\u7406\u5b8c\u6210\u3002\u539f\u59cb{len(checkpoint_files)}\u4e2a\u6587\u4ef6&#xff0c;\u4fdd\u7559{len(keep_files)}\u4e2a&#034;)<\/p>\n<p>if __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    clean_checkpoints(&#034;work_dirs\/my_experiment\/checkpoints&#034;)<\/p>\n<h4>4.5 \u76d1\u63a7\u4e0e\u9884\u8b66\u7cfb\u7edf<\/h4>\n<p>\u5bf9\u4e8e\u957f\u65f6\u95f4\u8bad\u7ec3\u4efb\u52a1&#xff0c;\u9884\u9632\u80dc\u4e8e\u6cbb\u7597\u3002\u5efa\u7acb\u7b80\u5355\u7684\u76d1\u63a7\u7cfb\u7edf&#xff0c;\u53ef\u4ee5\u5728\u95ee\u9898\u53d1\u751f\u524d\u9884\u8b66\u3002<\/p>\n<p>\u57fa\u7840\u76d1\u63a7\u811a\u672c&#xff1a;<\/p>\n<p>#!\/usr\/bin\/env python3<br \/>\n&#034;&#034;&#034;<br \/>\n\u8bad\u7ec3\u76d1\u63a7\u811a\u672c<br \/>\n\u529f\u80fd&#xff1a;<br \/>\n1. \u68c0\u67e5\u8bad\u7ec3\u8fdb\u7a0b\u662f\u5426\u5b58\u6d3b<br \/>\n2. \u68c0\u67e5\u65e5\u5fd7\u662f\u5426\u66f4\u65b0<br \/>\n3. \u68c0\u67e5GPU\u4f7f\u7528\u60c5\u51b5<br \/>\n4. \u53d1\u9001\u9884\u8b66\u901a\u77e5<br \/>\n&#034;&#034;&#034;<br \/>\nimport os<br \/>\nimport time<br \/>\nimport subprocess<br \/>\nimport smtplib<br \/>\nfrom email.mime.text import MIMEText<br \/>\nfrom datetime import datetime<\/p>\n<p>class TrainingMonitor:<br \/>\n    def __init__(self, log_file, check_interval&#061;300):<br \/>\n        self.log_file &#061; log_file<br \/>\n        self.check_interval &#061; check_interval<br \/>\n        self.last_size &#061; 0<br \/>\n        self.last_update &#061; time.time()<\/p>\n<p>    def check_training_alive(self):<br \/>\n        &#034;&#034;&#034;\u68c0\u67e5\u8bad\u7ec3\u8fdb\u7a0b\u662f\u5426\u5b58\u6d3b&#034;&#034;&#034;<br \/>\n        try:<br \/>\n            # \u67e5\u627e\u5305\u542btrain.py\u7684\u8fdb\u7a0b<br \/>\n            result &#061; subprocess.run(<br \/>\n                [&#034;pgrep&#034;, &#034;-f&#034;, &#034;train.py&#034;],<br \/>\n                capture_output&#061;True,<br \/>\n                text&#061;True<br \/>\n            )<br \/>\n            return bool(result.stdout.strip())<br \/>\n        except:<br \/>\n            return False<\/p>\n<p>    def check_log_progress(self):<br \/>\n        &#034;&#034;&#034;\u68c0\u67e5\u65e5\u5fd7\u6587\u4ef6\u662f\u5426\u6709\u66f4\u65b0&#034;&#034;&#034;<br \/>\n        if not os.path.exists(self.log_file):<br \/>\n            return False<\/p>\n<p>        current_size &#061; os.path.getsize(self.log_file)<br \/>\n        current_time &#061; time.time()<\/p>\n<p>        if current_size &gt; self.last_size:<br \/>\n            self.last_size &#061; current_size<br \/>\n            self.last_update &#061; current_time<br \/>\n            return True<br \/>\n        else:<br \/>\n            # \u5982\u679c\u8d85\u8fc71\u5c0f\u65f6\u6ca1\u6709\u66f4\u65b0&#xff0c;\u8ba4\u4e3a\u8bad\u7ec3\u53ef\u80fd\u5361\u4f4f<br \/>\n            if current_time &#8211; self.last_update &gt; 3600:<br \/>\n                return False<br \/>\n            return True<\/p>\n<p>    def check_gpu_status(self):<br \/>\n        &#034;&#034;&#034;\u68c0\u67e5GPU\u72b6\u6001&#034;&#034;&#034;<br \/>\n        try:<br \/>\n            result &#061; subprocess.run(<br \/>\n                [&#034;nvidia-smi&#034;, &#034;&#8211;query-gpu&#061;utilization.gpu,memory.used&#034;,<br \/>\n                 &#034;&#8211;format&#061;csv,noheader,nounits&#034;],<br \/>\n                capture_output&#061;True,<br \/>\n                text&#061;True<br \/>\n            )<br \/>\n            gpu_status &#061; result.stdout.strip().split(&#039;\\\\n&#039;)<br \/>\n            return gpu_status<br \/>\n        except:<br \/>\n            return [&#034;\u68c0\u67e5\u5931\u8d25&#034;]<\/p>\n<p>    def send_alert(self, message):<br \/>\n        &#034;&#034;&#034;\u53d1\u9001\u9884\u8b66\u90ae\u4ef6&#034;&#034;&#034;<br \/>\n        # \u8fd9\u91cc\u9700\u8981\u914d\u7f6e\u4f60\u7684\u90ae\u4ef6\u670d\u52a1\u5668<br \/>\n        msg &#061; MIMEText(message)<br \/>\n        msg[&#039;Subject&#039;] &#061; &#039;\u8bad\u7ec3\u4efb\u52a1\u5f02\u5e38\u9884\u8b66&#039;<br \/>\n        msg[&#039;From&#039;] &#061; &#039;monitor&#064;example.com&#039;<br \/>\n        msg[&#039;To&#039;] &#061; &#039;your_email&#064;example.com&#039;<\/p>\n<p>        # \u5b9e\u9645\u53d1\u9001\u4ee3\u7801&#xff08;\u9700\u8981\u914d\u7f6eSMTP\u670d\u52a1\u5668&#xff09;<br \/>\n        # with smtplib.SMTP(&#039;smtp.example.com&#039;) as server:<br \/>\n        #     server.send_message(msg)<\/p>\n<p>        print(f&#034;\u9884\u8b66: {message}&#034;)<\/p>\n<p>    def run(self):<br \/>\n        &#034;&#034;&#034;\u8fd0\u884c\u76d1\u63a7\u5faa\u73af&#034;&#034;&#034;<br \/>\n        print(f&#034;\u5f00\u59cb\u76d1\u63a7\u8bad\u7ec3\u4efb\u52a1&#xff0c;\u65e5\u5fd7\u6587\u4ef6: {self.log_file}&#034;)<\/p>\n<p>        while True:<br \/>\n            time.sleep(self.check_interval)<\/p>\n<p>            # \u68c0\u67e5\u5404\u9879\u6307\u6807<br \/>\n            if not self.check_training_alive():<br \/>\n                self.send_alert(&#034;\u8bad\u7ec3\u8fdb\u7a0b\u5df2\u505c\u6b62&#xff01;&#034;)<br \/>\n                break<\/p>\n<p>            if not self.check_log_progress():<br \/>\n                self.send_alert(&#034;\u8bad\u7ec3\u65e5\u5fd7\u8d85\u8fc71\u5c0f\u65f6\u672a\u66f4\u65b0&#xff0c;\u53ef\u80fd\u5df2\u5361\u4f4f&#xff01;&#034;)<\/p>\n<p>            gpu_status &#061; self.check_gpu_status()<br \/>\n            for i, status in enumerate(gpu_status):<br \/>\n                util, mem &#061; status.split(&#039;,&#039;)<br \/>\n                if int(util) &lt; 5 and int(mem) &lt; 100:<br \/>\n                    self.send_alert(f&#034;GPU {i} \u5229\u7528\u7387\u8fc7\u4f4e&#xff0c;\u53ef\u80fd\u8bad\u7ec3\u5df2\u505c\u6b62&#xff01;&#034;)<\/p>\n<p>if __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    monitor &#061; TrainingMonitor(&#034;work_dirs\/my_experiment\/train.log&#034;)<br \/>\n    monitor.run()<\/p>\n<p>\u8fd9\u4e2a\u76d1\u63a7\u811a\u672c\u53ef\u4ee5\u4f5c\u4e3a\u4e00\u4e2a\u540e\u53f0\u8fdb\u7a0b\u8fd0\u884c&#xff0c;\u5728\u8bad\u7ec3\u5f02\u5e38\u65f6\u53ca\u65f6\u901a\u77e5\u4f60&#xff0c;\u51cf\u5c11\u635f\u5931\u3002<\/p>\n<h3>5. \u4ece\u7406\u8bba\u5230\u5b9e\u8df5&#xff1a;\u4e00\u4e2a\u5b8c\u6574\u6062\u590d\u6848\u4f8b<\/h3>\n<p>\u8ba9\u6211\u4eec\u901a\u8fc7\u4e00\u4e2a\u5b8c\u6574\u7684\u6848\u4f8b&#xff0c;\u5c06\u524d\u9762\u8bb2\u7684\u6240\u6709\u77e5\u8bc6\u70b9\u4e32\u8054\u8d77\u6765\u3002\u5047\u8bbe\u4f60\u6b63\u5728\u8bad\u7ec3\u4e00\u4e2aFaster R-CNN\u6a21\u578b&#xff0c;\u5728epoch 65\u65f6\u670d\u52a1\u5668\u610f\u5916\u65ad\u7535\u3002<\/p>\n<h4>5.1 \u6848\u4f8b\u80cc\u666f<\/h4>\n<ul>\n<li>\u4efb\u52a1&#xff1a;\u5728COCO\u6570\u636e\u96c6\u4e0a\u8bad\u7ec3Faster R-CNN<\/li>\n<li>\u914d\u7f6e&#xff1a;MMDetection 3.0.0, PyTorch 1.11.0, CUDA 11.3<\/li>\n<li>\u8bad\u7ec3\u8fdb\u5ea6&#xff1a;\u8ba1\u5212100\u4e2aepoch&#xff0c;\u5f53\u524d\u5b8c\u621065\u4e2aepoch<\/li>\n<li>\u4e2d\u65ad\u539f\u56e0&#xff1a;\u5b9e\u9a8c\u5ba4\u533a\u57df\u505c\u7535<\/li>\n<li>\u76ee\u5f55\u7ed3\u6784&#xff1a;work_dirs\/coco_faster_rcnn\/<br \/>\n\u251c\u2500\u2500 20240101_120000\/<br \/>\n\u2502   \u251c\u2500\u2500 epoch_10.pth<br \/>\n\u2502   \u251c\u2500\u2500 epoch_20.pth<br \/>\n\u2502   \u251c\u2500\u2500 &#8230;<br \/>\n\u2502   \u251c\u2500\u2500 epoch_60.pth<br \/>\n\u2502   \u251c\u2500\u2500 epoch_65.pth  # \u6700\u65b0&#xff0c;\u4f46\u53ef\u80fd\u635f\u574f<br \/>\n\u2502   \u2514\u2500\u2500 latest.pth -&gt; epoch_65.pth<br \/>\n\u251c\u2500\u2500 config.py<br \/>\n\u2514\u2500\u2500 train.log\n <\/li>\n<\/ul>\n<h4>5.2 \u6062\u590d\u6b65\u9aa4<\/h4>\n<p>\u7b2c\u4e00\u6b65&#xff1a;\u8bc4\u4f30\u635f\u5931&#xff0c;\u4fdd\u6301\u51b7\u9759<\/p>\n<ul>\n<li>\u9996\u5148\u786e\u8ba4\u670d\u52a1\u5668\u5df2\u5b8c\u5168\u6062\u590d&#xff0c;\u6240\u6709\u670d\u52a1\u6b63\u5e38<\/li>\n<li>\u4e0d\u8981\u7acb\u5373\u5c1d\u8bd5\u6062\u590d\u8bad\u7ec3&#xff0c;\u5148\u505a\u597d\u8bca\u65ad<\/li>\n<\/ul>\n<p>\u7b2c\u4e8c\u6b65&#xff1a;\u68c0\u67e5\u6587\u4ef6\u5b8c\u6574\u6027<\/p>\n<p>cd work_dirs\/coco_faster_rcnn\/20240101_120000<\/p>\n<p># \u68c0\u67e5\u6587\u4ef6\u5927\u5c0f<br \/>\nls -lh epoch_*.pth<br \/>\n# \u6b63\u5e38\u60c5\u51b5&#xff1a;\u6bcf\u4e2a\u6587\u4ef6\u7ea6450MB<br \/>\n# \u5982\u679cepoch_65.pth\u660e\u663e\u504f\u5c0f&#xff08;\u5982100MB&#xff09;&#xff0c;\u53ef\u80fd\u5df2\u635f\u574f<\/p>\n<p># \u5c1d\u8bd5\u52a0\u8f7dcheckpoint<br \/>\npython -c &#034;<br \/>\nimport torch<br \/>\ntry:<br \/>\n    ckpt &#061; torch.load(&#039;epoch_65.pth&#039;, map_location&#061;&#039;cpu&#039;)<br \/>\n    print(&#039;Checkpoint\u52a0\u8f7d\u6210\u529f&#039;)<br \/>\n    print(f&#039;Epoch: {ckpt.get(\\\\&#034;epoch\\\\&#034;, \\\\&#034;N\/A\\\\&#034;)}&#039;)<br \/>\n    print(f&#039;Keys: {list(ckpt.keys())}&#039;)<br \/>\nexcept Exception as e:<br \/>\n    print(f&#039;\u52a0\u8f7d\u5931\u8d25: {e}&#039;)<br \/>\n&#034;<\/p>\n<p>\u5047\u8bbe\u68c0\u67e5\u53d1\u73b0epoch_65.pth\u5df2\u635f\u574f&#xff0c;\u4f46epoch_60.pth\u5b8c\u597d\u3002<\/p>\n<p>\u7b2c\u4e09\u6b65&#xff1a;\u67e5\u770b\u8bad\u7ec3\u65e5\u5fd7&#xff0c;\u786e\u5b9a\u6062\u590d\u70b9<\/p>\n<p># \u67e5\u770b\u65e5\u5fd7\u6700\u540e\u51e0\u884c<br \/>\ntail -50 train.log<\/p>\n<p># \u67e5\u627e\u5173\u952e\u4fe1\u606f<br \/>\ngrep -n &#034;Epoch(val)&#034; train.log | tail -5<br \/>\n# \u8f93\u51fa\u53ef\u80fd\u7c7b\u4f3c&#xff1a;<br \/>\n# 5000: 01\/01 12:30:00 &#8211; mmengine &#8211; INFO &#8211; Epoch(val) [60][100\/100]  mAP: 0.425<br \/>\n# 5100: 01\/01 12:45:00 &#8211; mmengine &#8211; INFO &#8211; Epoch(val) [65][100\/100]  mAP: 0.432<\/p>\n<p>\u4ece\u65e5\u5fd7\u770b&#xff0c;epoch 60\u7684mAP\u662f0.425&#xff0c;epoch 65\u662f0.432\u3002\u867d\u7136\u635f\u5931\u4e865\u4e2aepoch\u7684\u8fdb\u5ea6&#xff0c;\u4f46\u6bd4\u4ece\u5934\u5f00\u59cb\u597d\u3002<\/p>\n<p>\u7b2c\u56db\u6b65&#xff1a;\u51c6\u5907\u6062\u590d\u73af\u5883<\/p>\n<p># \u786e\u8ba4\u5f53\u524d\u73af\u5883<br \/>\npython -c &#034;import torch; print(f&#039;PyTorch {torch.__version__}, CUDA {torch.version.cuda if torch.cuda.is_available() else \\\\&#034;N\/A\\\\&#034;}&#039;)&#034;<\/p>\n<p># \u5982\u679c\u73af\u5883\u6709\u53d8\u5316&#xff0c;\u53ef\u80fd\u9700\u8981\u521b\u5efaconda\u73af\u5883<br \/>\n# conda create -n mmdet python&#061;3.8<br \/>\n# conda activate mmdet<br \/>\n# pip install torch&#061;&#061;1.11.0&#043;cu113 torchvision&#061;&#061;0.12.0&#043;cu113 -f https:\/\/download.pytorch.org\/whl\/torch_stable.html<br \/>\n# pip install mmdet&#061;&#061;3.0.0<\/p>\n<p>\u7b2c\u4e94\u6b65&#xff1a;\u6267\u884c\u6062\u590d\u547d\u4ee4<\/p>\n<p># \u4f7f\u7528epoch_60.pth\u6062\u590d<br \/>\npython tools\/train.py work_dirs\/coco_faster_rcnn\/20240101_120000\/config.py \\\\<br \/>\n    &#8211;resume work_dirs\/coco_faster_rcnn\/20240101_120000\/epoch_60.pth \\\\<br \/>\n    &#8211;work-dir work_dirs\/coco_faster_rcnn_resumed<\/p>\n<p>\u6ce8\u610f\u8fd9\u91cc\u4f7f\u7528\u4e86\u65b0\u7684\u5de5\u4f5c\u76ee\u5f55coco_faster_rcnn_resumed&#xff0c;\u8fd9\u6837\u53ef\u4ee5\u4fdd\u7559\u539f\u59cb\u7684\u8bad\u7ec3\u8bb0\u5f55&#xff0c;\u65b9\u4fbf\u5bf9\u6bd4\u3002<\/p>\n<p>\u7b2c\u516d\u6b65&#xff1a;\u9a8c\u8bc1\u6062\u590d\u6548\u679c<\/p>\n<li>\u67e5\u770b\u63a7\u5236\u53f0\u8f93\u51fa&#xff1a;\u786e\u8ba4\u6062\u590d\u7684epoch\u662f60<\/li>\n<li>\u542f\u52a8TensorBoard\u5bf9\u6bd4&#xff1a;tensorboard &#8211;logdir work_dirs\/coco_faster_rcnn,work_dirs\/coco_faster_rcnn_resumed &#8211;port 6006\n <\/li>\n<li>\u68c0\u67e5\u8bad\u7ec3\u66f2\u7ebf\u8fde\u7eed\u6027&#xff1a;\u91cd\u70b9\u770bloss\u66f2\u7ebf\u662f\u5426\u5e73\u6ed1\u8854\u63a5<\/li>\n<p>\u7b2c\u4e03\u6b65&#xff1a;\u8c03\u6574\u8bad\u7ec3\u8ba1\u5212 \u7531\u4e8e\u635f\u5931\u4e865\u4e2aepoch&#xff0c;\u53ef\u4ee5\u8003\u8651&#xff1a;<\/p>\n<ul>\n<li>\u589e\u52a0\u603bepoch\u6570\u5230105&#xff0c;\u5f25\u8865\u635f\u5931<\/li>\n<li>\u6216\u8005\u4fdd\u6301100\u4e2aepoch&#xff0c;\u63a5\u53d7\u8f7b\u5fae\u7684\u6027\u80fd\u635f\u5931<\/li>\n<\/ul>\n<p>\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u8c03\u6574&#xff1a;<\/p>\n<p># \u4fee\u6539\u914d\u7f6e\u6587\u4ef6<br \/>\ntrain_cfg &#061; dict(type&#061;&#039;EpochBasedTrainLoop&#039;, max_epochs&#061;105)  # \u539f\u4e3a100<\/p>\n<h4>5.3 \u6848\u4f8b\u603b\u7ed3\u4e0e\u7ecf\u9a8c<\/h4>\n<p>\u901a\u8fc7\u8fd9\u4e2a\u6848\u4f8b&#xff0c;\u6211\u4eec\u53ef\u4ee5\u603b\u7ed3\u51fa\u4e00\u4e9b\u5173\u952e\u7ecf\u9a8c&#xff1a;<\/p>\n<li>\u5b9a\u671f\u9a8c\u8bc1checkpoint&#xff1a;\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u5b9a\u671f\u68c0\u67e5checkpoint\u662f\u5426\u53ef\u52a0\u8f7d<\/li>\n<li>\u591a\u7248\u672c\u5907\u4efd&#xff1a;\u91cd\u8981\u7684\u5b9e\u9a8c\u81f3\u5c11\u4fdd\u75593\u4e2a\u5386\u53f2checkpoint<\/li>\n<li>\u8be6\u7ec6\u8bb0\u5f55&#xff1a;\u8bb0\u5f55\u6bcf\u6b21\u8bad\u7ec3\u7684\u73af\u5883\u914d\u7f6e\u3001\u53c2\u6570\u4fee\u6539<\/li>\n<li>\u9884\u7559\u7f13\u51b2&#xff1a;\u91cd\u8981\u7684\u8bad\u7ec3\u4efb\u52a1\u9884\u755920%\u7684\u65f6\u95f4\u7f13\u51b2&#xff0c;\u5e94\u5bf9\u610f\u5916\u4e2d\u65ad<\/li>\n<h3>6. \u9884\u9632\u63aa\u65bd&#xff1a;\u8ba9\u8bad\u7ec3\u66f4\u5065\u58ee<\/h3>\n<p>\u867d\u7136\u6062\u590d\u6280\u5de7\u5f88\u91cd\u8981&#xff0c;\u4f46\u6700\u597d\u7684\u7b56\u7565\u662f\u9884\u9632\u4e2d\u65ad\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u8ba9\u8bad\u7ec3\u8fc7\u7a0b\u66f4\u5065\u58ee\u7684\u5efa\u8bae\u3002<\/p>\n<h4>6.1 \u786c\u4ef6\u4e0e\u57fa\u7840\u8bbe\u65bd<\/h4>\n<ul>\n<li>\u4f7f\u7528UPS&#xff1a;\u4e3a\u5173\u952e\u670d\u52a1\u5668\u914d\u5907\u4e0d\u95f4\u65ad\u7535\u6e90&#xff0c;\u5e94\u5bf9\u77ed\u65f6\u505c\u7535<\/li>\n<li>ECC\u5185\u5b58&#xff1a;\u4f7f\u7528\u5e26\u9519\u8bef\u6821\u6b63\u7684\u5185\u5b58&#xff0c;\u9632\u6b62\u5185\u5b58\u9519\u8bef\u5bfc\u81f4\u8bad\u7ec3\u5d29\u6e83<\/li>\n<li>RAID\u5b58\u50a8&#xff1a;\u4f7f\u7528RAID 1\u6216RAID 5&#xff0c;\u9632\u6b62\u786c\u76d8\u6545\u969c\u5bfc\u81f4\u6570\u636e\u4e22\u5931<\/li>\n<li>\u6e29\u5ea6\u76d1\u63a7&#xff1a;\u786e\u4fddGPU\u6e29\u5ea6\u5728\u5b89\u5168\u8303\u56f4\u5185&#xff0c;\u907f\u514d\u8fc7\u70ed\u964d\u9891\u6216\u5173\u673a<\/li>\n<\/ul>\n<h4>6.2 \u8f6f\u4ef6\u4e0e\u914d\u7f6e\u4f18\u5316<\/h4>\n<p>\u914d\u7f6e\u81ea\u52a8\u4fdd\u5b58\u4e0e\u76d1\u63a7&#xff1a;<\/p>\n<p># \u5728MMDetection\u914d\u7f6e\u4e2d\u4f18\u5316checkpoint\u8bbe\u7f6e<br \/>\ndefault_hooks &#061; dict(<br \/>\n    checkpoint&#061;dict(<br \/>\n        type&#061;&#039;CheckpointHook&#039;,<br \/>\n        interval&#061;1,  # \u6bcf\u4e2aepoch\u90fd\u4fdd\u5b58<br \/>\n        max_keep_ckpts&#061;10,  # \u53ea\u4fdd\u755910\u4e2a\u6700\u65b0checkpoint<br \/>\n        save_optimizer&#061;True,<br \/>\n        save_param_scheduler&#061;True,<br \/>\n        by_epoch&#061;True,<br \/>\n        out_dir&#061;&#039;work_dirs\/my_experiment&#039;,<br \/>\n        save_best&#061;[&#039;coco\/bbox_mAP&#039;, &#039;coco\/bbox_mAP_50&#039;],<br \/>\n        rule&#061;&#039;greater&#039;<br \/>\n    ),<br \/>\n    logger&#061;dict(type&#061;&#039;LoggerHook&#039;, interval&#061;50),<br \/>\n)<\/p>\n<p>\u4f7f\u7528\u8bad\u7ec3\u7ba1\u7406\u5de5\u5177&#xff1a;<\/p>\n<ul>\n<li>Weights &amp; Biases&#xff1a;\u63d0\u4f9b\u5b8c\u6574\u7684\u5b9e\u9a8c\u8ddf\u8e2a\u3001\u7248\u672c\u7ba1\u7406\u548c\u534f\u4f5c\u529f\u80fd<\/li>\n<li>MLflow&#xff1a;\u5f00\u6e90\u5e73\u53f0&#xff0c;\u7ba1\u7406\u673a\u5668\u5b66\u4e60\u751f\u547d\u5468\u671f<\/li>\n<li>DVC&#xff1a;\u6570\u636e\u7248\u672c\u63a7\u5236&#xff0c;\u786e\u4fdd\u5b9e\u9a8c\u53ef\u590d\u73b0<\/li>\n<\/ul>\n<p>\u5b9e\u73b0\u65ad\u70b9\u7eed\u4f20\u7684\u5c01\u88c5\u811a\u672c&#xff1a;<\/p>\n<p>#!\/usr\/bin\/env python3<br \/>\n&#034;&#034;&#034;<br \/>\n\u667a\u80fd\u8bad\u7ec3\u542f\u52a8\u811a\u672c<br \/>\n\u529f\u80fd&#xff1a;<br \/>\n1. \u81ea\u52a8\u68c0\u6d4b\u662f\u5426\u6709\u53ef\u6062\u590d\u7684checkpoint<br \/>\n2. \u5904\u7406\u73af\u5883\u914d\u7f6e<br \/>\n3. \u8bb0\u5f55\u5b8c\u6574\u7684\u8bad\u7ec3\u5143\u6570\u636e<br \/>\n&#034;&#034;&#034;<br \/>\nimport os<br \/>\nimport sys<br \/>\nimport argparse<br \/>\nimport subprocess<br \/>\nimport yaml<br \/>\nfrom datetime import datetime<\/p>\n<p>class SmartTrainLauncher:<br \/>\n    def __init__(self, config_path, work_dir&#061;None):<br \/>\n        self.config_path &#061; config_path<br \/>\n        self.work_dir &#061; work_dir or self._get_default_work_dir()<br \/>\n        self.experiment_id &#061; datetime.now().strftime(&#034;%Y%m%d_%H%M%S&#034;)<\/p>\n<p>    def _get_default_work_dir(self):<br \/>\n        &#034;&#034;&#034;\u6839\u636e\u914d\u7f6e\u6587\u4ef6\u751f\u6210\u9ed8\u8ba4\u5de5\u4f5c\u76ee\u5f55&#034;&#034;&#034;<br \/>\n        config_name &#061; os.path.splitext(os.path.basename(self.config_path))[0]<br \/>\n        return f&#034;work_dirs\/{config_name}&#034;<\/p>\n<p>    def find_latest_checkpoint(self):<br \/>\n        &#034;&#034;&#034;\u67e5\u627e\u6700\u65b0\u7684\u53ef\u6062\u590dcheckpoint&#034;&#034;&#034;<br \/>\n        checkpoint_dir &#061; os.path.join(self.work_dir, &#034;checkpoints&#034;)<br \/>\n        if not os.path.exists(checkpoint_dir):<br \/>\n            return None<\/p>\n<p>        # \u67e5\u627e.pth\u6587\u4ef6<br \/>\n        import glob<br \/>\n        checkpoint_files &#061; glob.glob(os.path.join(checkpoint_dir, &#034;*.pth&#034;))<br \/>\n        if not checkpoint_files:<br \/>\n            return None<\/p>\n<p>        # \u6309\u4fee\u6539\u65f6\u95f4\u6392\u5e8f<br \/>\n        checkpoint_files.sort(key&#061;os.path.getmtime, reverse&#061;True)<\/p>\n<p>        # \u9a8c\u8bc1\u6bcf\u4e2acheckpoint&#xff0c;\u8fd4\u56de\u7b2c\u4e00\u4e2a\u6709\u6548\u7684<br \/>\n        for checkpoint in checkpoint_files:<br \/>\n            if self._validate_checkpoint(checkpoint):<br \/>\n                return checkpoint<\/p>\n<p>        return None<\/p>\n<p>    def _validate_checkpoint(self, checkpoint_path):<br \/>\n        &#034;&#034;&#034;\u9a8c\u8bc1checkpoint\u662f\u5426\u6709\u6548&#034;&#034;&#034;<br \/>\n        try:<br \/>\n            import torch<br \/>\n            checkpoint &#061; torch.load(checkpoint_path, map_location&#061;&#039;cpu&#039;)<br \/>\n            required_keys &#061; [&#039;state_dict&#039;, &#039;meta&#039;]<br \/>\n            return all(key in checkpoint for key in required_keys)<br \/>\n        except:<br \/>\n            return False<\/p>\n<p>    def launch_training(self, resume&#061;True, gpus&#061;1):<br \/>\n        &#034;&#034;&#034;\u542f\u52a8\u8bad\u7ec3&#034;&#034;&#034;<br \/>\n        latest_checkpoint &#061; self.find_latest_checkpoint() if resume else None<\/p>\n<p>        # \u6784\u5efa\u8bad\u7ec3\u547d\u4ee4<br \/>\n        cmd &#061; []<\/p>\n<p>        if gpus &gt; 1:<br \/>\n            cmd.extend([<br \/>\n                &#034;.\/tools\/dist_train.sh&#034;,<br \/>\n                self.config_path,<br \/>\n                str(gpus),<br \/>\n                f&#034;&#8211;work-dir&#061;{self.work_dir}&#034;<br \/>\n            ])<br \/>\n        else:<br \/>\n            cmd.extend([<br \/>\n                &#034;python&#034;, &#034;tools\/train.py&#034;,<br \/>\n                self.config_path,<br \/>\n                f&#034;&#8211;work-dir&#061;{self.work_dir}&#034;<br \/>\n            ])<\/p>\n<p>        # \u6dfb\u52a0resume\u53c2\u6570<br \/>\n        if latest_checkpoint:<br \/>\n            cmd.append(f&#034;&#8211;resume&#061;{latest_checkpoint}&#034;)<br \/>\n            print(f&#034;\u4ece\u68c0\u67e5\u70b9\u6062\u590d: {latest_checkpoint}&#034;)<br \/>\n        else:<br \/>\n            print(&#034;\u5f00\u59cb\u65b0\u7684\u8bad\u7ec3&#034;)<\/p>\n<p>        # \u6dfb\u52a0\u5176\u4ed6\u53c2\u6570<br \/>\n        cmd.extend([<br \/>\n            &#034;&#8211;cfg-options&#034;,<br \/>\n            f&#034;default_hooks.checkpoint.out_dir&#061;{self.work_dir}\/checkpoints&#034;,<br \/>\n            f&#034;default_hooks.logger.log_dir&#061;{self.work_dir}\/logs&#034;<br \/>\n        ])<\/p>\n<p>        # \u6267\u884c\u547d\u4ee4<br \/>\n        print(f&#034;\u6267\u884c\u547d\u4ee4: {&#039; &#039;.join(cmd)}&#034;)<br \/>\n        subprocess.run(cmd)<\/p>\n<p>    def save_experiment_metadata(self):<br \/>\n        &#034;&#034;&#034;\u4fdd\u5b58\u5b9e\u9a8c\u5143\u6570\u636e&#034;&#034;&#034;<br \/>\n        metadata &#061; {<br \/>\n            &#039;experiment_id&#039;: self.experiment_id,<br \/>\n            &#039;config_path&#039;: self.config_path,<br \/>\n            &#039;work_dir&#039;: self.work_dir,<br \/>\n            &#039;start_time&#039;: datetime.now().isoformat(),<br \/>\n            &#039;environment&#039;: {<br \/>\n                &#039;python&#039;: sys.version,<br \/>\n                &#039;pytorch&#039;: self._get_pytorch_version(),<br \/>\n                &#039;cuda&#039;: self._get_cuda_version()<br \/>\n            }<br \/>\n        }<\/p>\n<p>        metadata_path &#061; os.path.join(self.work_dir, &#034;metadata.yaml&#034;)<br \/>\n        os.makedirs(os.path.dirname(metadata_path), exist_ok&#061;True)<\/p>\n<p>        with open(metadata_path, &#039;w&#039;) as f:<br \/>\n            yaml.dump(metadata, f)<\/p>\n<p>    def _get_pytorch_version(self):<br \/>\n        try:<br \/>\n            import torch<br \/>\n            return torch.__version__<br \/>\n        except:<br \/>\n            return &#034;N\/A&#034;<\/p>\n<p>    def _get_cuda_version(self):<br \/>\n        try:<br \/>\n            import torch<br \/>\n            return torch.version.cuda if torch.cuda.is_available() else &#034;N\/A&#034;<br \/>\n        except:<br \/>\n            return &#034;N\/A&#034;<\/p>\n<p>if __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    parser &#061; argparse.ArgumentParser()<br \/>\n    parser.add_argument(&#034;config&#034;, help&#061;&#034;\u914d\u7f6e\u6587\u4ef6\u8def\u5f84&#034;)<br \/>\n    parser.add_argument(&#034;&#8211;work-dir&#034;, help&#061;&#034;\u5de5\u4f5c\u76ee\u5f55&#034;)<br \/>\n    parser.add_argument(&#034;&#8211;no-resume&#034;, action&#061;&#034;store_true&#034;, help&#061;&#034;\u4e0d\u5c1d\u8bd5\u6062\u590d&#034;)<br \/>\n    parser.add_argument(&#034;&#8211;gpus&#034;, type&#061;int, default&#061;1, help&#061;&#034;GPU\u6570\u91cf&#034;)<\/p>\n<p>    args &#061; parser.parse_args()<\/p>\n<p>    launcher &#061; SmartTrainLauncher(args.config, args.work_dir)<br \/>\n    launcher.save_experiment_metadata()<br \/>\n    launcher.launch_training(resume&#061;not args.no_resume, gpus&#061;args.gpus)<\/p>\n<p>\u8fd9\u4e2a\u667a\u80fd\u542f\u52a8\u811a\u672c\u53ef\u4ee5\u5927\u5927\u7b80\u5316\u8bad\u7ec3\u7ba1\u7406&#xff0c;\u81ea\u52a8\u5904\u7406\u6062\u590d\u903b\u8f91&#xff0c;\u5e76\u8bb0\u5f55\u5b8c\u6574\u7684\u5b9e\u9a8c\u5143\u6570\u636e\u3002<\/p>\n<h4>6.3 \u8bad\u7ec3\u7b56\u7565\u4f18\u5316<\/h4>\n<p>\u68af\u5ea6\u7d2f\u79ef&#xff1a;\u5f53GPU\u5185\u5b58\u4e0d\u8db3\u65f6&#xff0c;\u4f7f\u7528\u68af\u5ea6\u7d2f\u79ef\u6a21\u62df\u66f4\u5927\u7684batch size&#xff0c;\u800c\u4e0d\u662f\u76f4\u63a5\u4f7f\u7528\u5c0fbatch size&#xff1a;<\/p>\n<p># \u5728\u914d\u7f6e\u6587\u4ef6\u4e2d<br \/>\ntrain_cfg &#061; dict(<br \/>\n    type&#061;&#039;EpochBasedTrainLoop&#039;,<br \/>\n    max_epochs&#061;100,<br \/>\n    val_interval&#061;1<br \/>\n)<\/p>\n<p>optim_wrapper &#061; dict(<br \/>\n    type&#061;&#039;OptimWrapper&#039;,<br \/>\n    optimizer&#061;dict(type&#061;&#039;SGD&#039;, lr&#061;0.02, momentum&#061;0.9, weight_decay&#061;0.0001),<br \/>\n    clip_grad&#061;dict(max_norm&#061;35, norm_type&#061;2),<br \/>\n    accumulative_counts&#061;4  # \u6bcf4\u4e2aiteration\u7d2f\u79ef\u4e00\u6b21\u68af\u5ea6<br \/>\n)<\/p>\n<p>\u6df7\u5408\u7cbe\u5ea6\u8bad\u7ec3&#xff1a;\u4f7f\u7528AMP\u51cf\u5c11\u663e\u5b58\u5360\u7528&#xff0c;\u52a0\u5feb\u8bad\u7ec3\u901f\u5ea6&#xff1a;<\/p>\n<p>python tools\/train.py configs\/faster_rcnn\/faster-rcnn_r50_fpn_1x_coco.py &#8211;amp<\/p>\n<p>\u5b9a\u671f\u9a8c\u8bc1\u4e0e\u65e9\u505c&#xff1a;\u907f\u514d\u5728\u65e0\u6548\u7684\u8bad\u7ec3\u4e0a\u6d6a\u8d39\u65f6\u95f4&#xff1a;<\/p>\n<p># \u65e9\u505c\u914d\u7f6e<br \/>\ndefault_hooks &#061; dict(<br \/>\n    early_stopping&#061;dict(<br \/>\n        type&#061;&#039;EarlyStoppingHook&#039;,<br \/>\n        monitor&#061;&#039;coco\/bbox_mAP&#039;,<br \/>\n        patience&#061;10,  # 10\u4e2aepoch\u6ca1\u6709\u63d0\u5347\u5c31\u505c\u6b62<br \/>\n        min_delta&#061;0.001,<br \/>\n        rule&#061;&#039;greater&#039;<br \/>\n    )<br \/>\n)<\/p>\n<h3>7. \u793e\u533a\u8d44\u6e90\u4e0e\u95ee\u9898\u6392\u67e5<\/h3>\n<p>\u5373\u4f7f\u505a\u4e86\u5145\u5206\u51c6\u5907&#xff0c;\u6062\u590d\u8bad\u7ec3\u65f6\u4ecd\u53ef\u80fd\u9047\u5230\u5404\u79cd\u95ee\u9898\u3002\u8fd9\u65f6&#xff0c;\u77e5\u9053\u5982\u4f55\u6709\u6548\u5229\u7528\u793e\u533a\u8d44\u6e90\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<h4>7.1 \u6709\u6548\u641c\u7d22\u4e0e\u95ee\u9898\u5b9a\u4f4d<\/h4>\n<p>\u9047\u5230\u95ee\u9898\u65f6&#xff0c;\u4e0d\u8981\u7acb\u5373\u53d1\u5e16\u63d0\u95ee\u3002\u9996\u5148\u5c1d\u8bd5&#xff1a;<\/p>\n<li>\u68c0\u67e5\u5b98\u65b9\u6587\u6863&#xff1a;OpenMMLab\u6587\u6863\u66f4\u65b0\u9891\u7e41&#xff0c;\u5f88\u591a\u95ee\u9898\u5728\u65b0\u7248\u672c\u4e2d\u5df2\u89e3\u51b3<\/li>\n<li>\u641c\u7d22GitHub Issues&#xff1a;\u4f7f\u7528\u5173\u952e\u8bcd\u7ec4\u5408\u641c\u7d22&#xff0c;\u5982&#034;resume dataloader stuck mmdetection&#034;<\/li>\n<li>\u67e5\u770b\u7248\u672c\u517c\u5bb9\u6027&#xff1a;\u786e\u8ba4\u4f60\u7684MMDetection\u3001MMCV\u3001MMEngine\u3001PyTorch\u7248\u672c\u517c\u5bb9<\/li>\n<p>\u5e38\u7528\u8bca\u65ad\u547d\u4ee4&#xff1a;<\/p>\n<p># \u68c0\u67e5\u7248\u672c\u517c\u5bb9\u6027<br \/>\npython -c &#034;import mmdet, mmcv, mmengine; print(f&#039;MMDetection: {mmdet.__version__}&#039;); print(f&#039;MMCV: {mmcv.__version__}&#039;); print(f&#039;MMEngine: {mmengine.__version__}&#039;)&#034;<\/p>\n<p># \u68c0\u67e5CUDA\u548ccuDNN<br \/>\npython -c &#034;import torch; print(f&#039;CUDA available: {torch.cuda.is_available()}&#039;); print(f&#039;cuDNN enabled: {torch.backends.cudnn.enabled}&#039;)&#034;<\/p>\n<h4>7.2 \u51c6\u5907\u6709\u6548\u7684\u95ee\u9898\u62a5\u544a<\/h4>\n<p>\u5982\u679c\u9700\u8981\u5411\u793e\u533a\u6c42\u52a9&#xff0c;\u63d0\u4f9b\u5b8c\u6574\u7684\u4fe1\u606f\u80fd\u5927\u5927\u52a0\u5feb\u95ee\u9898\u89e3\u51b3\u901f\u5ea6\u3002\u4e00\u4e2a\u6709\u6548\u7684\u95ee\u9898\u62a5\u544a\u5e94\u5305\u62ec&#xff1a;<\/p>\n<li>\n<p>\u73af\u5883\u4fe1\u606f&#xff1a;<\/p>\n<p> OS: Ubuntu 20.04<br \/>\nPython: 3.8.10<br \/>\nPyTorch: 1.11.0&#043;cu113<br \/>\nCUDA: 11.3<br \/>\nMMCV: 2.0.0<br \/>\nMMDetection: 3.0.0\n <\/li>\n<li>\n<p>\u590d\u73b0\u6b65\u9aa4&#xff1a;<\/p>\n<ul>\n<li>\u5b8c\u6574\u7684\u8bad\u7ec3\u547d\u4ee4<\/li>\n<li>\u914d\u7f6e\u6587\u4ef6&#xff08;\u7b80\u5316\u4f46\u5173\u952e\u90e8\u5206\u5b8c\u6574&#xff09;<\/li>\n<li>\u6570\u636e\u51c6\u5907\u6b65\u9aa4<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u9519\u8bef\u4fe1\u606f&#xff1a;<\/p>\n<ul>\n<li>\u5b8c\u6574\u7684\u9519\u8bef\u5806\u6808<\/li>\n<li>\u76f8\u5173\u65e5\u5fd7\u7247\u6bb5<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5df2\u5c1d\u8bd5\u7684\u89e3\u51b3\u65b9\u6848&#xff1a;<\/p>\n<ul>\n<li>\u4f60\u5df2\u5c1d\u8bd5\u8fc7\u54ea\u4e9b\u65b9\u6cd5<\/li>\n<li>\u6bcf\u79cd\u65b9\u6cd5\u7684\u7ed3\u679c<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u9644\u52a0\u4fe1\u606f&#xff1a;<\/p>\n<ul>\n<li>\u95ee\u9898\u662f\u5426\u53ef\u7a33\u5b9a\u590d\u73b0<\/li>\n<li>\u5728\u54ea\u4e9b\u7248\u672c\u4e2d\u51fa\u73b0\/\u4e0d\u51fa\u73b0<\/li>\n<\/ul>\n<\/li>\n<h4>7.3 \u5b66\u4e60\u8d44\u6e90\u63a8\u8350<\/h4>\n<ul>\n<li>\u5b98\u65b9\u6587\u6863&#xff1a;MMDetection Documentation<\/li>\n<li>GitHub\u4ed3\u5e93&#xff1a;open-mmlab\/mmdetection<\/li>\n<li>\u793e\u533a\u8bba\u575b&#xff1a;OpenMMLab\u793e\u533a<\/li>\n<li>\u8bba\u6587\u4e0e\u6559\u7a0b&#xff1a;\u5173\u6ce8OpenMMLab\u56e2\u961f\u5728CVPR\u3001ICCV\u7b49\u4f1a\u8bae\u4e0a\u7684\u6559\u7a0b<\/li>\n<\/ul>\n<h3>8. \u603b\u7ed3&#xff1a;\u6784\u5efa\u4f60\u7684\u6062\u590d\u5de5\u4f5c\u6d41<\/h3>\n<p>\u8bad\u7ec3\u4e2d\u65ad\u867d\u7136\u4ee4\u4eba\u6cae\u4e27&#xff0c;\u4f46\u901a\u8fc7\u7cfb\u7edf\u5316\u7684\u51c6\u5907\u548c\u6b63\u786e\u7684\u6062\u590d\u7b56\u7565&#xff0c;\u4f60\u53ef\u4ee5\u5c06\u635f\u5931\u964d\u5230\u6700\u4f4e\u3002\u56de\u987e\u672c\u6587\u7684\u5185\u5bb9&#xff0c;\u6211\u5efa\u8bae\u4f60\u5efa\u7acb\u81ea\u5df1\u7684\u6062\u590d\u5de5\u4f5c\u6d41&#xff1a;<\/p>\n<li>\n<p>\u9884\u9632\u9636\u6bb5&#xff1a;<\/p>\n<ul>\n<li>\u914d\u7f6e\u786c\u4ef6\u4fdd\u62a4&#xff08;UPS\u3001ECC\u5185\u5b58&#xff09;<\/li>\n<li>\u8bbe\u7f6e\u5b9a\u671fcheckpoint\u4fdd\u5b58<\/li>\n<li>\u5b9e\u73b0\u8bad\u7ec3\u76d1\u63a7\u548c\u9884\u8b66<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u51c6\u5907\u9636\u6bb5&#xff1a;<\/p>\n<ul>\n<li>\u7ec4\u7ec7\u597dwork_dirs\u76ee\u5f55\u7ed3\u6784<\/li>\n<li>\u8bb0\u5f55\u5b8c\u6574\u7684\u5b9e\u9a8c\u5143\u6570\u636e<\/li>\n<li>\u5b9a\u671f\u9a8c\u8bc1checkpoint\u5b8c\u6574\u6027<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u6062\u590d\u9636\u6bb5&#xff1a;<\/p>\n<ul>\n<li>\u4fdd\u6301\u51b7\u9759&#xff0c;\u5148\u8bca\u65ad\u518d\u884c\u52a8<\/li>\n<li>\u68c0\u67e5\u6587\u4ef6\u5b8c\u6574\u6027&#xff0c;\u9009\u62e9\u6b63\u786e\u7684\u6062\u590d\u70b9<\/li>\n<li>\u9a8c\u8bc1\u73af\u5883\u4e00\u81f4\u6027&#xff0c;\u5904\u7406\u7248\u672c\u95ee\u9898<\/li>\n<li>\u4f7f\u7528TensorBoard\u9a8c\u8bc1\u6062\u590d\u6548\u679c<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u4f18\u5316\u9636\u6bb5&#xff1a;<\/p>\n<ul>\n<li>\u5206\u6790\u4e2d\u65ad\u539f\u56e0&#xff0c;\u6539\u8fdb\u9884\u9632\u63aa\u65bd<\/li>\n<li>\u4f18\u5316\u8bad\u7ec3\u914d\u7f6e&#xff0c;\u51cf\u5c11\u4e2d\u65ad\u5f71\u54cd<\/li>\n<li>\u5efa\u7acb\u6807\u51c6\u5316\u6062\u590d\u6d41\u7a0b<\/li>\n<\/ul>\n<\/li>\n<p>\u5728\u5b9e\u9645\u9879\u76ee\u4e2d&#xff0c;\u6211\u53d1\u73b0\u6700\u6709\u6548\u7684\u7b56\u7565\u662f\u5b9a\u671f\u4fdd\u5b58\u5b8c\u6574\u7684\u5b9e\u9a8c\u72b6\u6001&#xff0c;\u5305\u62ec\u4ee3\u7801\u3001\u6570\u636e\u3001\u914d\u7f6e\u548c\u8bad\u7ec3\u72b6\u6001\u3002\u8fd9\u6837&#xff0c;\u5373\u4f7f\u53d1\u751f\u6700\u574f\u7684\u60c5\u51b5&#xff0c;\u4f60\u4e5f\u80fd\u5feb\u901f\u6062\u590d\u5230\u6700\u8fd1\u7684\u53ef\u7528\u72b6\u6001\u3002<\/p>\n<p>\u8bad\u7ec3\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u5c31\u50cf\u4e00\u573a\u9a6c\u62c9\u677e&#xff0c;\u800c\u4e0d\u662f\u77ed\u8dd1\u3002\u610f\u5916\u4e2d\u65ad\u662f\u8fd9\u6761\u8def\u4e0a\u5e38\u89c1\u7684\u969c\u788d&#xff0c;\u4f46\u6709\u4e86\u6b63\u786e\u7684\u5de5\u5177\u548c\u7b56\u7565&#xff0c;\u4f60\u5b8c\u5168\u53ef\u4ee5\u8de8\u8d8a\u8fd9\u4e9b\u969c\u788d&#xff0c;\u6700\u7ec8\u5230\u8fbe\u7ec8\u70b9\u3002\u8bb0\u4f4f&#xff0c;\u6bcf\u4e2a\u6210\u529f\u6062\u590d\u7684\u8bad\u7ec3\u4efb\u52a1&#xff0c;\u90fd\u662f\u5bf9\u4f60\u5de5\u7a0b\u80fd\u529b\u7684\u4e00\u6b21\u63d0\u5347\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u522b\u8ba9\u670d\u52a1\u5668\u65ad\u7535\u6bc1\u4e86\u4f60\u4e09\u5929\u4e09\u591c\u7684\u8bad\u7ec3&#xff01;mmdetection resume\u5b9e\u6218\u907f\u5751\u6307\u5357<br \/>\n\u6df1\u591c&#xff0c;\u5b9e\u9a8c\u5ba4\u91cc\u53ea\u6709\u98ce\u6247\u7684\u55e1\u9e23\u548c\u5c4f\u5e55\u7684\u5fae\u5149\u3002\u4f60\u76ef\u7740\u5c4f\u5e55\u4e0a\u7f13\u6162\u589e\u957f\u7684\u9a8c\u8bc1\u96c6mAP\u66f2\u7ebf&#xff0c;\u5fc3\u91cc\u76d8\u7b97\u7740\u518d\u6709\u51e0\u4e2a\u5c0f\u65f6&#xff0c;\u8fd9\u4e2a\u5173\u952e\u5b9e\u9a8c\u7684\u7ed3\u679c\u5c31\u80fd\u51fa\u7089\u4e86\u3002\u7a81\u7136&#xff0c;\u5c4f\u5e55\u4e00\u9ed1&#xff0c;\u98ce\u6247\u58f0\u621b\u7136\u800c\u6b62\u2014\u2014\u6574\u680b\u697c\u8df3\u95f8\u4e86\u3002\u90a3\u4e00\u523b&#xff0c;\u4f60\u8111\u5b50\u91cc\u95ea\u8fc7\u7684\u4e0d\u662f\u5b9e\u9a8c\u6570\u636e&#xff0c;\u800c\u662f\u90a3\u4e2a\u5df2\u7ecf\u8dd1\u4e8672\u5c0f\u65f6\u7684\u8bad\u7ec3\u4efb\u52a1\u3002\u4e09\u5929\u4e09\u591c\u7684\u5fc3\u8840&amp;#xff<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8268,6948,8269,86],"topic":[],"class_list":["post-76684","post","type-post","status-publish","format-standard","hentry","category-server","tag-mmdetection","tag-6948","tag-8269","tag-86"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u522b\u8ba9\u670d\u52a1\u5668\u65ad\u7535\u6bc1\u4e86\u4f60\u4e09\u5929\u4e09\u591c\u7684\u8bad\u7ec3\uff01mmdetection resume\u5b9e\u6218\u907f\u5751\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/76684.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u522b\u8ba9\u670d\u52a1\u5668\u65ad\u7535\u6bc1\u4e86\u4f60\u4e09\u5929\u4e09\u591c\u7684\u8bad\u7ec3\uff01mmdetection resume\u5b9e\u6218\u907f\u5751\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u522b\u8ba9\u670d\u52a1\u5668\u65ad\u7535\u6bc1\u4e86\u4f60\u4e09\u5929\u4e09\u591c\u7684\u8bad\u7ec3&#xff01;mmdetection resume\u5b9e\u6218\u907f\u5751\u6307\u5357 \u6df1\u591c&#xff0c;\u5b9e\u9a8c\u5ba4\u91cc\u53ea\u6709\u98ce\u6247\u7684\u55e1\u9e23\u548c\u5c4f\u5e55\u7684\u5fae\u5149\u3002\u4f60\u76ef\u7740\u5c4f\u5e55\u4e0a\u7f13\u6162\u589e\u957f\u7684\u9a8c\u8bc1\u96c6mAP\u66f2\u7ebf&#xff0c;\u5fc3\u91cc\u76d8\u7b97\u7740\u518d\u6709\u51e0\u4e2a\u5c0f\u65f6&#xff0c;\u8fd9\u4e2a\u5173\u952e\u5b9e\u9a8c\u7684\u7ed3\u679c\u5c31\u80fd\u51fa\u7089\u4e86\u3002\u7a81\u7136&#xff0c;\u5c4f\u5e55\u4e00\u9ed1&#xff0c;\u98ce\u6247\u58f0\u621b\u7136\u800c\u6b62\u2014\u2014\u6574\u680b\u697c\u8df3\u95f8\u4e86\u3002\u90a3\u4e00\u523b&#xff0c;\u4f60\u8111\u5b50\u91cc\u95ea\u8fc7\u7684\u4e0d\u662f\u5b9e\u9a8c\u6570\u636e&#xff0c;\u800c\u662f\u90a3\u4e2a\u5df2\u7ecf\u8dd1\u4e8672\u5c0f\u65f6\u7684\u8bad\u7ec3\u4efb\u52a1\u3002\u4e09\u5929\u4e09\u591c\u7684\u5fc3\u8840&amp;#xff\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/76684.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-22T17:25:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/via.placeholder.com\/800x400.png?text=%E6%81%A2%E5%A4%8D%E5%89%8D%E5%90%8E%E8%AE%AD%E7%BB%83%E6%9B%B2%E7%BA%BF%E5%AF%B9%E6%AF%94%E5%9B%BE\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/76684.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/76684.html\",\"name\":\"\u522b\u8ba9\u670d\u52a1\u5668\u65ad\u7535\u6bc1\u4e86\u4f60\u4e09\u5929\u4e09\u591c\u7684\u8bad\u7ec3\uff01mmdetection resume\u5b9e\u6218\u907f\u5751\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-22T17:25:27+00:00\",\"dateModified\":\"2026-02-22T17:25:27+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/76684.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/76684.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/76684.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u522b\u8ba9\u670d\u52a1\u5668\u65ad\u7535\u6bc1\u4e86\u4f60\u4e09\u5929\u4e09\u591c\u7684\u8bad\u7ec3\uff01mmdetection resume\u5b9e\u6218\u907f\u5751\u6307\u5357\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u522b\u8ba9\u670d\u52a1\u5668\u65ad\u7535\u6bc1\u4e86\u4f60\u4e09\u5929\u4e09\u591c\u7684\u8bad\u7ec3\uff01mmdetection resume\u5b9e\u6218\u907f\u5751\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/76684.html","og_locale":"zh_CN","og_type":"article","og_title":"\u522b\u8ba9\u670d\u52a1\u5668\u65ad\u7535\u6bc1\u4e86\u4f60\u4e09\u5929\u4e09\u591c\u7684\u8bad\u7ec3\uff01mmdetection resume\u5b9e\u6218\u907f\u5751\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u522b\u8ba9\u670d\u52a1\u5668\u65ad\u7535\u6bc1\u4e86\u4f60\u4e09\u5929\u4e09\u591c\u7684\u8bad\u7ec3&#xff01;mmdetection resume\u5b9e\u6218\u907f\u5751\u6307\u5357 \u6df1\u591c&#xff0c;\u5b9e\u9a8c\u5ba4\u91cc\u53ea\u6709\u98ce\u6247\u7684\u55e1\u9e23\u548c\u5c4f\u5e55\u7684\u5fae\u5149\u3002\u4f60\u76ef\u7740\u5c4f\u5e55\u4e0a\u7f13\u6162\u589e\u957f\u7684\u9a8c\u8bc1\u96c6mAP\u66f2\u7ebf&#xff0c;\u5fc3\u91cc\u76d8\u7b97\u7740\u518d\u6709\u51e0\u4e2a\u5c0f\u65f6&#xff0c;\u8fd9\u4e2a\u5173\u952e\u5b9e\u9a8c\u7684\u7ed3\u679c\u5c31\u80fd\u51fa\u7089\u4e86\u3002\u7a81\u7136&#xff0c;\u5c4f\u5e55\u4e00\u9ed1&#xff0c;\u98ce\u6247\u58f0\u621b\u7136\u800c\u6b62\u2014\u2014\u6574\u680b\u697c\u8df3\u95f8\u4e86\u3002\u90a3\u4e00\u523b&#xff0c;\u4f60\u8111\u5b50\u91cc\u95ea\u8fc7\u7684\u4e0d\u662f\u5b9e\u9a8c\u6570\u636e&#xff0c;\u800c\u662f\u90a3\u4e2a\u5df2\u7ecf\u8dd1\u4e8672\u5c0f\u65f6\u7684\u8bad\u7ec3\u4efb\u52a1\u3002\u4e09\u5929\u4e09\u591c\u7684\u5fc3\u8840&amp;#xff","og_url":"https:\/\/www.wsisp.com\/helps\/76684.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-22T17:25:27+00:00","og_image":[{"url":"https:\/\/via.placeholder.com\/800x400.png?text=%E6%81%A2%E5%A4%8D%E5%89%8D%E5%90%8E%E8%AE%AD%E7%BB%83%E6%9B%B2%E7%BA%BF%E5%AF%B9%E6%AF%94%E5%9B%BE"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"14 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/76684.html","url":"https:\/\/www.wsisp.com\/helps\/76684.html","name":"\u522b\u8ba9\u670d\u52a1\u5668\u65ad\u7535\u6bc1\u4e86\u4f60\u4e09\u5929\u4e09\u591c\u7684\u8bad\u7ec3\uff01mmdetection resume\u5b9e\u6218\u907f\u5751\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-22T17:25:27+00:00","dateModified":"2026-02-22T17:25:27+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/76684.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/76684.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/76684.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u522b\u8ba9\u670d\u52a1\u5668\u65ad\u7535\u6bc1\u4e86\u4f60\u4e09\u5929\u4e09\u591c\u7684\u8bad\u7ec3\uff01mmdetection resume\u5b9e\u6218\u907f\u5751\u6307\u5357"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/76684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=76684"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/76684\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=76684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=76684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=76684"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=76684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}