Files

1 line
80 KiB
JavaScript

"use strict";(globalThis.webpackChunkblog=globalThis.webpackChunkblog||[]).push([[6667],{28453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>r});var d=s(96540);const l={},c=d.createContext(l);function i(e){const n=d.useContext(c);return d.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function r(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:i(e.components),d.createElement(c.Provider,{value:n},e.children)}},79273:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>t,contentTitle:()=>r,default:()=>x,frontMatter:()=>i,metadata:()=>d,toc:()=>h});const d=JSON.parse('{"id":"\u4e2a\u4eba\u77e5\u8bc6\u5e93/AI/PyTorch/\u7b2c\u5341\u7ae0/YOLO\u7cfb\u5217\u89e3\u8bfb/MMYOLO\u5b9e\u73b0/rtmdet_description","title":"rtmdet_description.md","description":"|\u4f5c\u8005|\u4fee\u8ba2\u65f6\u95f4|","source":"@site/docs/\u4e2a\u4eba\u77e5\u8bc6\u5e93/10.AI/01.PyTorch/10.\u7b2c\u5341\u7ae0/YOLO\u7cfb\u5217\u89e3\u8bfb/MMYOLO\u5b9e\u73b0/rtmdet_description.md","sourceDirName":"\u4e2a\u4eba\u77e5\u8bc6\u5e93/10.AI/01.PyTorch/10.\u7b2c\u5341\u7ae0/YOLO\u7cfb\u5217\u89e3\u8bfb/MMYOLO\u5b9e\u73b0","slug":"/\u4e2a\u4eba\u77e5\u8bc6\u5e93/AI/PyTorch/\u7b2c\u5341\u7ae0/YOLO\u7cfb\u5217\u89e3\u8bfb/MMYOLO\u5b9e\u73b0/rtmdet_description","permalink":"/docs/\u4e2a\u4eba\u77e5\u8bc6\u5e93/AI/PyTorch/\u7b2c\u5341\u7ae0/YOLO\u7cfb\u5217\u89e3\u8bfb/MMYOLO\u5b9e\u73b0/rtmdet_description","draft":false,"unlisted":false,"editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/docs/\u4e2a\u4eba\u77e5\u8bc6\u5e93/10.AI/01.PyTorch/10.\u7b2c\u5341\u7ae0/YOLO\u7cfb\u5217\u89e3\u8bfb/MMYOLO\u5b9e\u73b0/rtmdet_description.md","tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"model_design.md","permalink":"/docs/\u4e2a\u4eba\u77e5\u8bc6\u5e93/AI/PyTorch/\u7b2c\u5341\u7ae0/YOLO\u7cfb\u5217\u89e3\u8bfb/MMYOLO\u5b9e\u73b0/model_design"},"next":{"title":"yolov5_description.md","permalink":"/docs/\u4e2a\u4eba\u77e5\u8bc6\u5e93/AI/PyTorch/\u7b2c\u5341\u7ae0/YOLO\u7cfb\u5217\u89e3\u8bfb/MMYOLO\u5b9e\u73b0/yolov5_description"}}');var l=s(74848),c=s(28453);const i={},r="rtmdet_description.md",t={},h=[{value:"0 \u7b80\u4ecb",id:"0-\u7b80\u4ecb",level:2},{value:"1 v1.0 \u7b97\u6cd5\u539f\u7406\u548c MMYOLO \u5b9e\u73b0\u89e3\u6790",id:"1-v10-\u7b97\u6cd5\u539f\u7406\u548c-mmyolo-\u5b9e\u73b0\u89e3\u6790",level:2},{value:"1.1 \u6570\u636e\u589e\u5f3a\u6a21\u5757",id:"11-\u6570\u636e\u589e\u5f3a\u6a21\u5757",level:3},{value:"1.1.1 \u4e3a\u56fe\u50cf\u6df7\u5408\u6570\u636e\u589e\u5f3a\u5f15\u5165 Cache",id:"111-\u4e3a\u56fe\u50cf\u6df7\u5408\u6570\u636e\u589e\u5f3a\u5f15\u5165-cache",level:4},{value:"1.1.2 Mosaic",id:"112-mosaic",level:4},{value:"1.1.3 MixUp",id:"113-mixup",level:4},{value:"1.1.4 \u5f3a\u5f31\u4e24\u9636\u6bb5\u8bad\u7ec3",id:"114-\u5f3a\u5f31\u4e24\u9636\u6bb5\u8bad\u7ec3",level:4},{value:"1.2 \u6a21\u578b\u7ed3\u6784",id:"12-\u6a21\u578b\u7ed3\u6784",level:3},{value:"1.2.1 Backbone",id:"121-backbone",level:4},{value:"1.2.2 CSPNeXt Block",id:"122-cspnext-block",level:4},{value:"1.2.3 \u8c03\u6574\u68c0\u6d4b\u5668\u4e0d\u540c stage \u95f4\u7684 block \u6570",id:"123-\u8c03\u6574\u68c0\u6d4b\u5668\u4e0d\u540c-stage-\u95f4\u7684-block-\u6570",level:4},{value:"1.2.4 Neck",id:"124-neck",level:4},{value:"1.2.5 Backbone \u4e0e Neck \u4e4b\u95f4\u7684\u53c2\u6570\u91cf\u548c\u8ba1\u7b97\u91cf\u7684\u5747\u8861",id:"125-backbone-\u4e0e-neck-\u4e4b\u95f4\u7684\u53c2\u6570\u91cf\u548c\u8ba1\u7b97\u91cf\u7684\u5747\u8861",level:4},{value:"1.2.6 Head",id:"126-head",level:4},{value:"1.3 \u6b63\u8d1f\u6837\u672c\u5339\u914d\u7b56\u7565",id:"13-\u6b63\u8d1f\u6837\u672c\u5339\u914d\u7b56\u7565",level:3},{value:"1.3.1 Bbox \u7f16\u89e3\u7801\u8fc7\u7a0b",id:"131-bbox-\u7f16\u89e3\u7801\u8fc7\u7a0b",level:4},{value:"1.3.2 \u5339\u914d\u7b56\u7565",id:"132-\u5339\u914d\u7b56\u7565",level:4},{value:"1.4 Loss \u8bbe\u8ba1",id:"14-loss-\u8bbe\u8ba1",level:3},{value:"QualityFocalLoss",id:"qualityfocalloss",level:4},{value:"GIoULoss",id:"giouloss",level:4},{value:"1.5 \u4f18\u5316\u7b56\u7565\u548c\u8bad\u7ec3\u8fc7\u7a0b",id:"15-\u4f18\u5316\u7b56\u7565\u548c\u8bad\u7ec3\u8fc7\u7a0b",level:3},{value:"1.6 \u63a8\u7406\u548c\u540e\u5904\u7406\u8fc7\u7a0b",id:"16-\u63a8\u7406\u548c\u540e\u5904\u7406\u8fc7\u7a0b",level:3},{value:"2 \u603b\u7ed3",id:"2-\u603b\u7ed3",level:2}];function o(e){const n={a:"a",code:"code",div:"div",h1:"h1",h2:"h2",h3:"h3",h4:"h4",header:"header",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,c.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.header,{children:(0,l.jsx)(n.h1,{id:"rtmdet_descriptionmd",children:"rtmdet_description.md"})}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{style:{textAlign:"left"},children:"\u4f5c\u8005"}),(0,l.jsx)(n.th,{style:{textAlign:"left"},children:"\u4fee\u8ba2\u65f6\u95f4"})]})}),(0,l.jsx)(n.tbody,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{style:{textAlign:"left"},children:(0,l.jsx)(n.img,{src:"https://img.shields.io/badge/wjlin0-%E4%B8%AA%E4%BA%BA%E7%9F%A5%E8%AF%86%E5%BA%93-green",alt:"wjlin0"})}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"2026-06-07 20:53:40"})]})})]}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{style:{textAlign:"left"},children:"\u4f5c\u8005"}),(0,l.jsx)(n.th,{style:{textAlign:"left"},children:"\u4fee\u8ba2\u65f6\u95f4"})]})}),(0,l.jsx)(n.tbody,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{style:{textAlign:"left"},children:(0,l.jsx)(n.img,{src:"https://img.shields.io/badge/wjlin0-%E4%B8%AA%E4%BA%BA%E7%9F%A5%E8%AF%86%E5%BA%93-green",alt:"wjlin0"})}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"2025-10-31 15:44:29"})]})})]}),"\n",(0,l.jsx)(n.h1,{id:"rtmdet-\u539f\u7406\u548c\u5b9e\u73b0\u5168\u89e3\u6790",children:"RTMDet \u539f\u7406\u548c\u5b9e\u73b0\u5168\u89e3\u6790"}),"\n",(0,l.jsx)(n.h2,{id:"0-\u7b80\u4ecb",children:"0 \u7b80\u4ecb"}),"\n",(0,l.jsx)(n.p,{children:"\u9ad8\u6027\u80fd\uff0c\u4f4e\u5ef6\u65f6\u7684\u5355\u9636\u6bb5\u76ee\u6807\u68c0\u6d4b\u5668"}),"\n",(0,l.jsxs)(n.div,{align:"center",children:["\n",(0,l.jsx)(n.img,{alt:"RTMDet_structure_v1.2",src:"https://user-images.githubusercontent.com/27466624/200001002-008ac696-e74d-4da1-9c6d-07149e2ad752.jpg"}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:"\u4ee5\u4e0a\u7ed3\u6784\u56fe\u7531 RangeKing@github \u7ed8\u5236\u3002"}),"\n",(0,l.jsxs)(n.p,{children:["\u6700\u8fd1\u4e00\u6bb5\u65f6\u95f4\uff0c\u5f00\u6e90\u754c\u6d8c\u73b0\u51fa\u4e86\u5927\u91cf\u7684\u9ad8\u7cbe\u5ea6\u76ee\u6807\u68c0\u6d4b\u9879\u76ee\uff0c\u5176\u4e2d\u6700\u7a81\u51fa\u7684\u5c31\u662f YOLO \u7cfb\u5217\uff0cOpenMMLab \u4e5f\u5728\u4e0e\u793e\u533a\u7684\u5408\u4f5c\u4e0b\u63a8\u51fa\u4e86 MMYOLO\u3002\n\u5728\u8c03\u7814\u4e86\u5f53\u524d YOLO \u7cfb\u5217\u7684\u8bf8\u591a\u6539\u8fdb\u6a21\u578b\u540e\uff0cMMDetection \u6838\u5fc3\u5f00\u53d1\u8005\u9488\u5bf9\u8fd9\u4e9b\u8bbe\u8ba1\u4ee5\u53ca\u8bad\u7ec3\u65b9\u5f0f\u8fdb\u884c\u4e86\u7ecf\u9a8c\u6027\u7684\u603b\u7ed3\uff0c\u5e76\u8fdb\u884c\u4e86\u4f18\u5316\uff0c\u63a8\u51fa\u4e86\u9ad8\u7cbe\u5ea6\u3001\u4f4e\u5ef6\u65f6\u7684\u5355\u9636\u6bb5\u76ee\u6807\u68c0\u6d4b\u5668 RTMDet, ",(0,l.jsx)(n.strong,{children:"R"}),"eal-",(0,l.jsx)(n.strong,{children:"t"}),"ime ",(0,l.jsx)(n.strong,{children:"M"}),"odels for Object ",(0,l.jsx)(n.strong,{children:"Det"}),"ection\n(",(0,l.jsx)(n.strong,{children:"R"}),"elease ",(0,l.jsx)(n.strong,{children:"t"}),"o ",(0,l.jsx)(n.strong,{children:"M"}),"anufacture)"]}),"\n",(0,l.jsx)(n.p,{children:"RTMDet \u7531 tiny/s/m/l/x \u4e00\u7cfb\u5217\u4e0d\u540c\u5927\u5c0f\u7684\u6a21\u578b\u7ec4\u6210\uff0c\u4e3a\u4e0d\u540c\u7684\u5e94\u7528\u573a\u666f\u63d0\u4f9b\u4e86\u4e0d\u540c\u7684\u9009\u62e9\u3002\n\u5176\u4e2d\uff0cRTMDet-x \u5728 52.6 mAP \u7684\u7cbe\u5ea6\u4e0b\u8fbe\u5230\u4e86 300+ FPS \u7684\u63a8\u7406\u901f\u5ea6\u3002"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-{note}",children:"\u6ce8\uff1a\u63a8\u7406\u901f\u5ea6\u548c\u7cbe\u5ea6\u6d4b\u8bd5\uff08\u4e0d\u5305\u542b NMS\uff09\u662f\u5728 1 \u5757 NVIDIA 3090 GPU \u4e0a\u7684 `TensorRT 8.4.3, cuDNN 8.2.0, FP16, batch size=1` \u6761\u4ef6\u91cc\u6d4b\u8bd5\u7684\u3002\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u800c\u6700\u8f7b\u91cf\u7684\u6a21\u578b RTMDet-tiny\uff0c\u5728\u4ec5\u6709 4M \u53c2\u6570\u91cf\u7684\u60c5\u51b5\u4e0b\u4e5f\u80fd\u591f\u8fbe\u5230 40.9 mAP\uff0c\u4e14\u63a8\u7406\u901f\u5ea6 < 1 ms\u3002"}),"\n",(0,l.jsxs)(n.div,{align:"center",children:["\n",(0,l.jsx)(n.img,{alt:"RTMDet_\u7cbe\u5ea6\u56fe",src:"https://user-images.githubusercontent.com/12907710/192182907-f9a671d6-89cb-4d73-abd8-c2b9dada3c66.png"}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:"\u4e0a\u56fe\u4e2d\u7684\u7cbe\u5ea6\u662f\u548c 300 epoch \u8bad\u7ec3\u4e0b\u7684\u516c\u5e73\u5bf9\u6bd4\uff0c\u4e3a\u4e0d\u4f7f\u7528\u84b8\u998f\u7684\u7ed3\u679c\u3002"}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{}),(0,l.jsx)(n.th,{children:"mAP"}),(0,l.jsx)(n.th,{children:"Params"}),(0,l.jsx)(n.th,{children:"Flops"}),(0,l.jsx)(n.th,{children:"Inference speed"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"Baseline(YOLOX)"}),(0,l.jsx)(n.td,{children:"40.2"}),(0,l.jsx)(n.td,{children:"9M"}),(0,l.jsx)(n.td,{children:"13.4G"}),(0,l.jsx)(n.td,{children:"1.2ms"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"+ AdamW + Flat Cosine"}),(0,l.jsx)(n.td,{children:"40.6 (+0.4)"}),(0,l.jsx)(n.td,{children:"9M"}),(0,l.jsx)(n.td,{children:"13.4G"}),(0,l.jsx)(n.td,{children:"1.2ms"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"+ CSPNeXt backbone & PAFPN"}),(0,l.jsx)(n.td,{children:"41.8 (+1.2)"}),(0,l.jsx)(n.td,{children:"10.07M (+1.07)"}),(0,l.jsx)(n.td,{children:"14.8G (+1.4)"}),(0,l.jsx)(n.td,{children:"1.22ms (+0.02)"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"+ SepBNHead"}),(0,l.jsx)(n.td,{children:"41.8 (+0)"}),(0,l.jsx)(n.td,{children:"8.89M (-1.18)"}),(0,l.jsx)(n.td,{children:"14.8G"}),(0,l.jsx)(n.td,{children:"1.22ms"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"+ Label Assign & Loss"}),(0,l.jsx)(n.td,{children:"42.9 (+1.1)"}),(0,l.jsx)(n.td,{children:"8.89M"}),(0,l.jsx)(n.td,{children:"14.8G"}),(0,l.jsx)(n.td,{children:"1.22ms"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"+ Cached Mosaic & MixUp"}),(0,l.jsx)(n.td,{children:"44.2 (+1.3)"}),(0,l.jsx)(n.td,{children:"8.89M"}),(0,l.jsx)(n.td,{children:"14.8G"}),(0,l.jsx)(n.td,{children:"1.22ms"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"+ RSB-pretrained backbone"}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"44.5 (+0.3)"})}),(0,l.jsx)(n.td,{children:"8.89M"}),(0,l.jsx)(n.td,{children:"14.8G"}),(0,l.jsx)(n.td,{children:"1.22ms"})]})]})]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["\u5b98\u65b9\u5f00\u6e90\u5730\u5740\uff1a ",(0,l.jsx)(n.a,{href:"https://github.com/open-mmlab/mmdetection/blob/3.x/configs/rtmdet/README.md",children:"https://github.com/open-mmlab/mmdetection/blob/3.x/configs/rtmdet/README.md"})]}),"\n",(0,l.jsxs)(n.li,{children:["MMYOLO \u5f00\u6e90\u5730\u5740\uff1a ",(0,l.jsx)(n.a,{href:"https://github.com/open-mmlab/mmyolo/blob/main/configs/rtmdet/README.md",children:"https://github.com/open-mmlab/mmyolo/blob/main/configs/rtmdet/README.md"})]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"1-v10-\u7b97\u6cd5\u539f\u7406\u548c-mmyolo-\u5b9e\u73b0\u89e3\u6790",children:"1 v1.0 \u7b97\u6cd5\u539f\u7406\u548c MMYOLO \u5b9e\u73b0\u89e3\u6790"}),"\n",(0,l.jsx)(n.h3,{id:"11-\u6570\u636e\u589e\u5f3a\u6a21\u5757",children:"1.1 \u6570\u636e\u589e\u5f3a\u6a21\u5757"}),"\n",(0,l.jsx)(n.p,{children:"RTMDet \u91c7\u7528\u4e86\u591a\u79cd\u6570\u636e\u589e\u5f3a\u7684\u65b9\u5f0f\u6765\u589e\u52a0\u6a21\u578b\u7684\u6027\u80fd\uff0c\u4e3b\u8981\u5305\u62ec\u5355\u56fe\u6570\u636e\u589e\u5f3a:"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.strong,{children:"RandomResize \u968f\u673a\u5c3a\u5ea6\u53d8\u6362"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.strong,{children:"RandomCrop \u968f\u673a\u88c1\u526a"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.strong,{children:"HSVRandomAug \u989c\u8272\u7a7a\u95f4\u589e\u5f3a"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.strong,{children:"RandomFlip \u968f\u673a\u6c34\u5e73\u7ffb\u8f6c"})}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:"\u4ee5\u53ca\u6df7\u5408\u7c7b\u6570\u636e\u589e\u5f3a\uff1a"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.strong,{children:"Mosaic \u9a6c\u8d5b\u514b"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.strong,{children:"MixUp \u56fe\u50cf\u6df7\u5408"})}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:"\u6570\u636e\u589e\u5f3a\u6d41\u7a0b\u5982\u4e0b\uff1a"}),"\n",(0,l.jsxs)(n.div,{align:"center",children:["\n",(0,l.jsx)(n.img,{alt:"image",src:"https://user-images.githubusercontent.com/33799979/192956011-78f89d89-ac9f-4a40-b4f1-056b49b704ef.png",width:"800"}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:"\u5176\u4e2d RandomResize \u8d85\u53c2\u5728\u5927\u6a21\u578b M,L,X \u548c\u5c0f\u6a21\u578b S, Tiny \u4e0a\u662f\u4e0d\u4e00\u6837\u7684\uff0c\u5927\u6a21\u578b\u7531\u4e8e\u53c2\u6570\u8f83\u591a\uff0c\u53ef\u4ee5\u4f7f\u7528 large scale jitter \u7b56\u7565\u5373\u53c2\u6570\u4e3a (0.1,2.0)\uff0c\u800c\u5c0f\u6a21\u578b\u91c7\u7528 stand scale jitter \u7b56\u7565\u5373 (0.5, 2.0) \u7b56\u7565\u3002\nMMDetection \u5f00\u6e90\u5e93\u4e2d\u5df2\u7ecf\u5bf9\u5355\u56fe\u6570\u636e\u589e\u5f3a\u8fdb\u884c\u4e86\u5c01\u88c5\uff0c\u7528\u6237\u901a\u8fc7\u7b80\u5355\u7684\u4fee\u6539\u914d\u7f6e\u5373\u53ef\u4f7f\u7528\u5e93\u4e2d\u63d0\u4f9b\u7684\u4efb\u4f55\u6570\u636e\u589e\u5f3a\u529f\u80fd\uff0c\u4e14\u90fd\u662f\u5c5e\u4e8e\u6bd4\u8f83\u5e38\u89c4\u7684\u6570\u636e\u589e\u5f3a\uff0c\u4e0d\u9700\u8981\u7279\u6b8a\u4ecb\u7ecd\u3002\u4e0b\u9762\u5c06\u5177\u4f53\u4ecb\u7ecd\u6df7\u5408\u7c7b\u6570\u636e\u589e\u5f3a\u7684\u5177\u4f53\u5b9e\u73b0\u3002"}),"\n",(0,l.jsxs)(n.p,{children:["\u4e0e YOLOv5 \u4e0d\u540c\u7684\u662f\uff0cYOLOv5 \u8ba4\u4e3a\u5728 S \u548c Nano \u6a21\u578b\u4e0a\u4f7f\u7528 MixUp \u662f\u8fc7\u5269\u7684\uff0c\u5c0f\u6a21\u578b\u4e0d\u9700\u8981\u8fd9\u4e48\u5f3a\u7684\u6570\u636e\u589e\u5f3a\u3002\u800c RTMDet \u5728 S \u548c Tiny \u4e0a\u4e5f\u4f7f\u7528\u4e86 MixUp\uff0c\u8fd9\u662f\u56e0\u4e3a RTMDet \u5728\u6700\u540e 20 epoch \u4f1a\u5207\u6362\u4e3a\u6b63\u5e38\u7684 aug\uff0c \u5e76\u901a\u8fc7\u8bad\u7ec3\u8bc1\u660e\u8fd9\u4e2a\u64cd\u4f5c\u662f\u6709\u6548\u7684\u3002 \u5e76\u4e14 RTMDet \u4e3a\u6df7\u5408\u7c7b\u6570\u636e\u589e\u5f3a\u5f15\u5165\u4e86 Cache \u65b9\u6848\uff0c\u6709\u6548\u5730\u51cf\u5c11\u4e86\u56fe\u50cf\u5904\u7406\u7684\u65f6\u95f4, \u548c\u5f15\u5165\u4e86\u53ef\u8c03\u8d85\u53c2 ",(0,l.jsx)(n.code,{children:"max_cached_images"})," \uff0c\u5f53\u4f7f\u7528\u8f83\u5c0f\u7684 cache \u65f6\uff0c\u5176\u6548\u679c\u7c7b\u4f3c ",(0,l.jsx)(n.code,{children:"repeated augmentation"}),"\u3002\u5177\u4f53\u4ecb\u7ecd\u5982\u4e0b\uff1a"]}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{}),(0,l.jsx)(n.th,{children:"Use cache"}),(0,l.jsx)(n.th,{children:"ms / 100 imgs"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"Mosaic"}),(0,l.jsx)(n.td,{}),(0,l.jsx)(n.td,{children:"87.1"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"Mosaic"}),(0,l.jsx)(n.td,{children:"\u221a"}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"24.0"})})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"MixUp"}),(0,l.jsx)(n.td,{}),(0,l.jsx)(n.td,{children:"19.3"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"MixUp"}),(0,l.jsx)(n.td,{children:"\u221a"}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"12.4"})})]})]})]}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{}),(0,l.jsx)(n.th,{children:"RTMDet-s"}),(0,l.jsx)(n.th,{children:"RTMDet-l"})]})}),(0,l.jsx)(n.tbody,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"Mosaic + MixUp + 20e finetune"}),(0,l.jsx)(n.td,{children:"43.9"}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"51.3"})})]})})]}),"\n",(0,l.jsx)(n.h4,{id:"111-\u4e3a\u56fe\u50cf\u6df7\u5408\u6570\u636e\u589e\u5f3a\u5f15\u5165-cache",children:"1.1.1 \u4e3a\u56fe\u50cf\u6df7\u5408\u6570\u636e\u589e\u5f3a\u5f15\u5165 Cache"}),"\n",(0,l.jsx)(n.p,{children:"Mosaic&MixUp \u6d89\u53ca\u5230\u591a\u5f20\u56fe\u7247\u7684\u6df7\u5408\uff0c\u5b83\u4eec\u7684\u8017\u65f6\u4f1a\u662f\u666e\u901a\u6570\u636e\u589e\u5f3a\u7684 K \u500d(K \u4e3a\u6df7\u5165\u56fe\u7247\u7684\u6570\u91cf)\u3002 \u5982\u5728 YOLOv5 \u4e2d\uff0c\u6bcf\u6b21\u505a Mosaic \u65f6\uff0c 4 \u5f20\u56fe\u7247\u7684\u4fe1\u606f\u90fd\u9700\u8981\u4ece\u786c\u76d8\u4e2d\u91cd\u65b0\u52a0\u8f7d\u3002 \u800c RTMDet \u53ea\u9700\u8981\u91cd\u65b0\u8f7d\u5165\u5f53\u524d\u7684\u4e00\u5f20\u56fe\u7247\uff0c\u5176\u4f59\u53c2\u4e0e\u6df7\u5408\u589e\u5f3a\u7684\u56fe\u7247\u5219\u4ece\u7f13\u5b58\u961f\u5217\u4e2d\u83b7\u53d6\uff0c\u901a\u8fc7\u727a\u7272\u4e00\u5b9a\u5185\u5b58\u7a7a\u95f4\u7684\u65b9\u5f0f\u5927\u5e45\u63d0\u5347\u4e86\u6548\u7387\u3002 \u53e6\u5916\u901a\u8fc7\u8c03\u6574 cache \u7684\u5927\u5c0f\u4ee5\u53ca pop \u7684\u65b9\u5f0f\uff0c\u4e5f\u53ef\u4ee5\u8c03\u6574\u589e\u5f3a\u7684\u5f3a\u5ea6\u3002"}),"\n",(0,l.jsxs)(n.div,{align:"center",children:["\n",(0,l.jsx)(n.img,{alt:"data cache",src:"https://user-images.githubusercontent.com/33799979/192730011-90e2a28d-e163-4399-bf87-d3012007d8c3.png",width:"800"}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:"\u5982\u56fe\u6240\u793a\uff0ccache \u961f\u5217\u4e2d\u9884\u5148\u50a8\u5b58\u4e86 N \u5f20\u5df2\u52a0\u8f7d\u7684\u56fe\u50cf\u4e0e\u6807\u7b7e\u6570\u636e\uff0c\u6bcf\u4e00\u4e2a\u8bad\u7ec3 step \u4e2d\u53ea\u9700\u52a0\u8f7d\u4e00\u5f20\u65b0\u7684\u56fe\u7247\u53ca\u5176\u6807\u7b7e\u6570\u636e\u5e76\u66f4\u65b0\u5230 cache \u961f\u5217\u4e2d(cache \u961f\u5217\u4e2d\u7684\u56fe\u50cf\u53ef\u91cd\u590d\uff0c\u5982\u56fe\u4e2d\u51fa\u73b0\u4e24\u6b21 img3)\uff0c\u540c\u65f6\u5982\u679c cache \u961f\u5217\u957f\u5ea6\u8d85\u8fc7\u9884\u8bbe\u957f\u5ea6\uff0c\u5219\u968f\u673a pop \u4e00\u5f20\u56fe\uff08\u4e3a\u4e86 Tiny \u6a21\u578b\u8bad\u7ec3\u66f4\u7a33\u5b9a\uff0c\u5728 Tiny \u6a21\u578b\u4e2d\u4e0d\u91c7\u7528\u968f\u673a pop \u7684\u65b9\u5f0f, \u800c\u662f\u79fb\u9664\u6700\u5148\u52a0\u5165\u7684\u56fe\u7247\uff09\uff0c\u5f53\u9700\u8981\u8fdb\u884c\u6df7\u5408\u6570\u636e\u589e\u5f3a\u65f6\uff0c\u53ea\u9700\u8981\u4ece cache \u4e2d\u968f\u673a\u9009\u62e9\u9700\u8981\u7684\u56fe\u50cf\u8fdb\u884c\u62fc\u63a5\u7b49\u5904\u7406\uff0c\u800c\u4e0d\u9700\u8981\u5168\u90e8\u4ece\u786c\u76d8\u4e2d\u52a0\u8f7d\uff0c\u8282\u7701\u4e86\u56fe\u50cf\u52a0\u8f7d\u7684\u65f6\u95f4\u3002"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-{note}",children:"cache \u961f\u5217\u7684\u6700\u5927\u957f\u5ea6 N \u4e3a\u53ef\u8c03\u6574\u53c2\u6570\uff0c\u6839\u636e\u7ecf\u9a8c\u6027\u7684\u539f\u5219\uff0c\u5f53\u4e3a\u6bcf\u4e00\u5f20\u9700\u8981\u6df7\u5408\u7684\u56fe\u7247\u63d0\u4f9b\u5341\u4e2a\u7f13\u5b58\u65f6\uff0c\u53ef\u4ee5\u8ba4\u4e3a\u63d0\u4f9b\u4e86\u8db3\u591f\u7684\u968f\u673a\u6027\uff0c\u800c Mosaic \u589e\u5f3a\u662f\u56db\u5f20\u56fe\u6df7\u5408\uff0c\u56e0\u6b64 cache \u6570\u91cf\u9ed8\u8ba4 N=40\uff0c \u540c\u7406 MixUp \u7684 cache \u6570\u91cf\u9ed8\u8ba4\u4e3a20\uff0c tiny \u6a21\u578b\u9700\u8981\u66f4\u7a33\u5b9a\u7684\u8bad\u7ec3\u6761\u4ef6\uff0c\u56e0\u6b64\u5176 cache \u6570\u91cf\u4e5f\u4e3a\u5176\u4f59\u89c4\u683c\u6a21\u578b\u7684\u4e00\u534a\uff08 MixUp \u4e3a10\uff0cMosaic \u4e3a20\uff09\n"})}),"\n",(0,l.jsxs)(n.p,{children:["\u5728\u5177\u4f53\u5b9e\u73b0\u4e2d\uff0cMMYOLO \u8bbe\u8ba1\u4e86 ",(0,l.jsx)(n.code,{children:"BaseMiximageTransform"})," \u7c7b\u6765\u652f\u6301\u591a\u5f20\u56fe\u50cf\u6df7\u5408\u6570\u636e\u589e\u5f3a\uff1a"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-python",children:"if self.use_cached:\n # Be careful: deep copying can be very time-consuming\n # if results includes dataset.\n dataset = results.pop('dataset', None)\n self.results_cache.append(copy.deepcopy(results)) # \u5c06\u5f53\u524d\u52a0\u8f7d\u7684\u56fe\u7247\u6570\u636e\u7f13\u5b58\u5230 cache \u4e2d\n if len(self.results_cache) > self.max_cached_images:\n if self.random_pop: # \u9664\u4e86tiny\u6a21\u578b\uff0cself.random_pop=True\n index = random.randint(0, len(self.results_cache) - 1)\n else:\n index = 0\n self.results_cache.pop(index)\n\n if len(self.results_cache) <= 4:\n return results\nelse:\n assert 'dataset' in results\n # Be careful: deep copying can be very time-consuming\n # if results includes dataset.\n dataset = results.pop('dataset', None)\n"})}),"\n",(0,l.jsx)(n.h4,{id:"112-mosaic",children:"1.1.2 Mosaic"}),"\n",(0,l.jsx)(n.p,{children:"Mosaic \u662f\u5c06 4 \u5f20\u56fe\u62fc\u63a5\u4e3a 1 \u5f20\u5927\u56fe\uff0c\u76f8\u5f53\u4e8e\u53d8\u76f8\u7684\u589e\u52a0\u4e86 batch size\uff0c\u5177\u4f53\u6b65\u9aa4\u4e3a\uff1a"}),"\n",(0,l.jsxs)(n.ol,{children:["\n",(0,l.jsx)(n.li,{children:"\u6839\u636e\u7d22\u5f15\u968f\u673a\u4ece\u81ea\u5b9a\u4e49\u6570\u636e\u96c6\u4e2d\u518d\u91c7\u68373\u4e2a\u56fe\u50cf\uff0c\u53ef\u80fd\u91cd\u590d"}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-python",children:'def get_indexes(self, dataset: Union[BaseDataset, list]) -> list:\n """Call function to collect indexes.\n\n Args:\n dataset (:obj:`Dataset` or list): The dataset or cached list.\n\n Returns:\n list: indexes.\n """\n indexes = [random.randint(0, len(dataset)) for _ in range(3)]\n return indexes\n'})}),"\n",(0,l.jsxs)(n.ol,{start:"2",children:["\n",(0,l.jsx)(n.li,{children:"\u968f\u673a\u9009\u51fa 4 \u5e45\u56fe\u50cf\u76f8\u4ea4\u7684\u4e2d\u70b9\u3002"}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-python",children:"# mosaic center x, y\ncenter_x = int(\n random.uniform(*self.center_ratio_range) * self.img_scale[1])\ncenter_y = int(\n random.uniform(*self.center_ratio_range) * self.img_scale[0])\ncenter_position = (center_x, center_y)\n"})}),"\n",(0,l.jsxs)(n.ol,{start:"3",children:["\n",(0,l.jsxs)(n.li,{children:["\u6839\u636e\u91c7\u6837\u7684 index \u8bfb\u53d6\u56fe\u7247\u5e76\u62fc\u63a5, \u62fc\u63a5\u524d\u4f1a\u5148\u8fdb\u884c ",(0,l.jsx)(n.code,{children:"keep-ratio"})," \u7684 resize \u56fe\u7247(\u5373\u4e3a\u6700\u5927\u8fb9\u4e00\u5b9a\u662f 640)\u3002"]}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-python",children:"# keep_ratio resize\nscale_ratio_i = min(self.img_scale[0] / h_i,\n self.img_scale[1] / w_i)\nimg_i = mmcv.imresize(\n img_i, (int(w_i * scale_ratio_i), int(h_i * scale_ratio_i)))\n"})}),"\n",(0,l.jsxs)(n.ol,{start:"4",children:["\n",(0,l.jsx)(n.li,{children:"\u62fc\u63a5\u540e\uff0c\u628a bbox \u548c label \u5168\u90e8\u62fc\u63a5\u8d77\u6765\uff0c\u7136\u540e\u5bf9 bbox \u8fdb\u884c\u88c1\u526a\u4f46\u662f\u4e0d\u8fc7\u6ee4(\u53ef\u80fd\u51fa\u73b0\u4e00\u4e9b\u65e0\u6548\u6846)"}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-python",children:"mosaic_bboxes.clip_([2 * self.img_scale[0], 2 * self.img_scale[1]])\n"})}),"\n",(0,l.jsxs)(n.p,{children:["\u66f4\u591a\u7684\u5173\u4e8e Mosaic \u539f\u7406\u7684\u8be6\u60c5\u53ef\u4ee5\u53c2\u8003 ",(0,l.jsx)(n.a,{href:"/docs/%E4%B8%AA%E4%BA%BA%E7%9F%A5%E8%AF%86%E5%BA%93/AI/PyTorch/%E7%AC%AC%E5%8D%81%E7%AB%A0/YOLO%E7%B3%BB%E5%88%97%E8%A7%A3%E8%AF%BB/MMYOLO%E5%AE%9E%E7%8E%B0/yolov5_description",children:"YOLOv5 \u539f\u7406\u548c\u5b9e\u73b0\u5168\u89e3\u6790"})," \u4e2d\u7684 Mosaic \u539f\u7406\u5206\u6790\u3002"]}),"\n",(0,l.jsx)(n.h4,{id:"113-mixup",children:"1.1.3 MixUp"}),"\n",(0,l.jsx)(n.p,{children:"RTMDet \u7684 MixUp \u5b9e\u73b0\u65b9\u5f0f\u4e0e YOLOX \u4e2d\u4e00\u6837\uff0c\u53ea\u4e0d\u8fc7\u589e\u52a0\u4e86\u7c7b\u4f3c\u4e0a\u6587\u4e2d\u63d0\u5230\u7684 cache \u529f\u80fd\u3002"}),"\n",(0,l.jsxs)(n.p,{children:["\u66f4\u591a\u7684\u5173\u4e8e MixUp \u539f\u7406\u7684\u8be6\u60c5\u4e5f\u53ef\u4ee5\u53c2\u8003 ",(0,l.jsx)(n.a,{href:"/docs/%E4%B8%AA%E4%BA%BA%E7%9F%A5%E8%AF%86%E5%BA%93/AI/PyTorch/%E7%AC%AC%E5%8D%81%E7%AB%A0/YOLO%E7%B3%BB%E5%88%97%E8%A7%A3%E8%AF%BB/MMYOLO%E5%AE%9E%E7%8E%B0/yolov5_description",children:"YOLOv5 \u539f\u7406\u548c\u5b9e\u73b0\u5168\u89e3\u6790"})," \u4e2d\u7684 MixUp \u539f\u7406\u5206\u6790\u3002"]}),"\n",(0,l.jsx)(n.h4,{id:"114-\u5f3a\u5f31\u4e24\u9636\u6bb5\u8bad\u7ec3",children:"1.1.4 \u5f3a\u5f31\u4e24\u9636\u6bb5\u8bad\u7ec3"}),"\n",(0,l.jsx)(n.p,{children:"Mosaic+MixUp \u5931\u771f\u5ea6\u6bd4\u8f83\u9ad8\uff0c\u6301\u7eed\u7528\u592a\u5f3a\u7684\u6570\u636e\u589e\u5f3a\u5bf9\u6a21\u578b\u5e76\u4e0d\u4e00\u5b9a\u6709\u76ca\u3002YOLOX \u4e2d\u7387\u5148\u4f7f\u7528\u4e86\u5f3a\u5f31\u4e24\u9636\u6bb5\u7684\u8bad\u5ddd\u7ec3\u65b9\u5f0f\uff0c\u4f46\u7531\u4e8e\u5f15\u5165\u4e86\u65cb\u8f6c\uff0c\u5207\u7247\u5bfc\u81f4 box \u6807\u6ce8\u4ea7\u751f\u8bef\u5dee\uff0c\u9700\u8981\u5728\u7b2c\u4e8c\u9636\u6bb5\u5f15\u5165\u989d\u5916\u7684 L1oss \u6765\u7ea0\u6b63\u56de\u5f52\u5206\u652f\u7684\u6027\u80fd\u3002"}),"\n",(0,l.jsx)(n.p,{children:"\u4e3a\u4e86\u4f7f\u6570\u636e\u589e\u5f3a\u7684\u65b9\u5f0f\u66f4\u4e3a\u901a\u7528\uff0cRTMDet \u5728\u524d 280 epoch \u4f7f\u7528\u4e0d\u5e26\u65cb\u8f6c\u7684 Mosaic+MixUp, \u4e14\u901a\u8fc7\u6df7\u5165 8 \u5f20\u56fe\u7247\u6765\u63d0\u5347\u5f3a\u5ea6\u4ee5\u53ca\u6b63\u6837\u672c\u6570\u3002\u540e 20 epoch \u4f7f\u7528\u6bd4\u8f83\u5c0f\u7684\u5b66\u4e60\u7387\u5728\u6bd4\u8f83\u5f31\u7684\u589e\u5f3a\u4e0b\u8fdb\u884c\u5fae\u8c03\uff0c\u540c\u65f6\u5728 EMA \u7684\u4f5c\u7528\u4e0b\u5c06\u53c2\u6570\u7f13\u6162\u66f4\u65b0\u81f3\u6a21\u578b\uff0c\u80fd\u591f\u5f97\u5230\u6bd4\u8f83\u5927\u7684\u63d0\u5347\u3002"}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{}),(0,l.jsx)(n.th,{children:"RTMDet-s"}),(0,l.jsx)(n.th,{children:"RTMDet-l"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"LSJ + rand crop"}),(0,l.jsx)(n.td,{children:"42.3"}),(0,l.jsx)(n.td,{children:"46.7"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"Mosaic+MixUp"}),(0,l.jsx)(n.td,{children:"41.9"}),(0,l.jsx)(n.td,{children:"49.8"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"Mosaic + MixUp + 20e finetune"}),(0,l.jsx)(n.td,{children:"43.9"}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"51.3"})})]})]})]}),"\n",(0,l.jsx)(n.h3,{id:"12-\u6a21\u578b\u7ed3\u6784",children:"1.2 \u6a21\u578b\u7ed3\u6784"}),"\n",(0,l.jsxs)(n.p,{children:["RTMDet \u6a21\u578b\u6574\u4f53\u7ed3\u6784\u548c ",(0,l.jsx)(n.a,{href:"https://arxiv.org/abs/2107.08430",children:"YOLOX"})," \u51e0\u4e4e\u4e00\u81f4\uff0c\u7531 ",(0,l.jsx)(n.code,{children:"CSPNeXt"})," + ",(0,l.jsx)(n.code,{children:"CSPNeXtPAFPN"})," + ",(0,l.jsx)(n.code,{children:"\u5171\u4eab\u5377\u79ef\u6743\u91cd\u4f46\u5206\u522b\u8ba1\u7b97 BN \u7684 SepBNHead"})," \u6784\u6210\u3002\u5185\u90e8\u6838\u5fc3\u6a21\u5757\u4e5f\u662f ",(0,l.jsx)(n.code,{children:"CSPLayer"}),"\uff0c\u4f46\u5bf9\u5176\u4e2d\u7684 ",(0,l.jsx)(n.code,{children:"Basic Block"})," \u8fdb\u884c\u4e86\u6539\u8fdb\uff0c\u63d0\u51fa\u4e86 ",(0,l.jsx)(n.code,{children:"CSPNeXt Block"}),"\u3002"]}),"\n",(0,l.jsx)(n.h4,{id:"121-backbone",children:"1.2.1 Backbone"}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"CSPNeXt"})," \u6574\u4f53\u4ee5 ",(0,l.jsx)(n.code,{children:"CSPDarknet"})," \u4e3a\u57fa\u7840\uff0c\u5171 5 \u5c42\u7ed3\u6784\uff0c\u5305\u542b 1 \u4e2a ",(0,l.jsx)(n.code,{children:"Stem Layer"})," \u548c 4 \u4e2a ",(0,l.jsx)(n.code,{children:"Stage Layer"}),"\uff1a"]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"Stem Layer"})," \u662f 3 \u5c42 3x3 kernel \u7684 ",(0,l.jsx)(n.code,{children:"ConvModule"})," \uff0c\u4e0d\u540c\u4e8e\u4e4b\u524d\u7684 ",(0,l.jsx)(n.code,{children:"Focus"})," \u6a21\u5757\u6216\u8005 1 \u5c42 6x6 kernel \u7684 ",(0,l.jsx)(n.code,{children:"ConvModule"})," \u3002"]}),"\n"]}),"\n",(0,l.jsxs)(n.li,{children:["\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"Stage Layer"})," \u603b\u4f53\u7ed3\u6784\u4e0e\u5df2\u6709\u6a21\u578b\u7c7b\u4f3c\uff0c\u524d 3 \u4e2a ",(0,l.jsx)(n.code,{children:"Stage Layer"})," \u7531 1 \u4e2a ",(0,l.jsx)(n.code,{children:"ConvModule"})," \u548c 1 \u4e2a ",(0,l.jsx)(n.code,{children:"CSPLayer"})," \u7ec4\u6210\u3002\u7b2c 4 \u4e2a ",(0,l.jsx)(n.code,{children:"Stage Layer"})," \u5728 ",(0,l.jsx)(n.code,{children:"ConvModule"})," \u548c ",(0,l.jsx)(n.code,{children:"CSPLayer"})," \u4e2d\u95f4\u589e\u52a0\u4e86 ",(0,l.jsx)(n.code,{children:"SPPF"})," \u6a21\u5757\uff08MMDetection \u7248\u672c\u4e3a ",(0,l.jsx)(n.code,{children:"SPP"})," \u6a21\u5757\uff09\u3002"]}),"\n"]}),"\n",(0,l.jsxs)(n.li,{children:["\n",(0,l.jsxs)(n.p,{children:["\u5982\u6a21\u578b\u56fe Details \u90e8\u5206\u6240\u793a\uff0c",(0,l.jsx)(n.code,{children:"CSPLayer"})," \u7531 3 \u4e2a ",(0,l.jsx)(n.code,{children:"ConvModule"})," + n \u4e2a ",(0,l.jsx)(n.code,{children:"CSPNeXt Block"}),"(\u5e26\u6b8b\u5dee\u8fde\u63a5) + 1 \u4e2a ",(0,l.jsx)(n.code,{children:"Channel Attention"})," \u6a21\u5757\u7ec4\u6210\u3002",(0,l.jsx)(n.code,{children:"ConvModule"})," \u4e3a 1 \u5c42 3x3 ",(0,l.jsx)(n.code,{children:"Conv2d"})," + ",(0,l.jsx)(n.code,{children:"BatchNorm"})," + ",(0,l.jsx)(n.code,{children:"SiLU"})," \u6fc0\u6d3b\u51fd\u6570\u3002",(0,l.jsx)(n.code,{children:"Channel Attention"})," \u6a21\u5757\u4e3a 1 \u5c42 ",(0,l.jsx)(n.code,{children:"AdaptiveAvgPool2d"})," + 1 \u5c42 1x1 ",(0,l.jsx)(n.code,{children:"Conv2d"})," + ",(0,l.jsx)(n.code,{children:"Hardsigmoid"})," \u6fc0\u6d3b\u51fd\u6570\u3002",(0,l.jsx)(n.code,{children:"CSPNeXt Block"})," \u6a21\u5757\u5728\u4e0b\u8282\u8be6\u7ec6\u8bb2\u8ff0\u3002"]}),"\n"]}),"\n",(0,l.jsxs)(n.li,{children:["\n",(0,l.jsxs)(n.p,{children:["\u5982\u679c\u60f3\u9605\u8bfb Backbone - ",(0,l.jsx)(n.code,{children:"CSPNeXt"})," \u7684\u6e90\u7801\uff0c\u53ef\u4ee5 ",(0,l.jsx)(n.a,{href:"https://github.com/open-mmlab/mmyolo/blob/main/mmyolo/models/backbones/cspnext.py#L16-L171",children:(0,l.jsx)(n.strong,{children:"\u70b9\u6b64"})})," \u8df3\u8f6c\u3002"]}),"\n"]}),"\n"]}),"\n",(0,l.jsx)(n.h4,{id:"122-cspnext-block",children:"1.2.2 CSPNeXt Block"}),"\n",(0,l.jsxs)(n.p,{children:["Darknet \uff08\u56fe a\uff09\u4f7f\u7528 1x1 \u4e0e 3x3 \u5377\u79ef\u7684 ",(0,l.jsx)(n.code,{children:"Basic Block"}),"\u3002",(0,l.jsx)(n.a,{href:"https://arxiv.org/abs/2209.02976",children:"YOLOv6"})," \u3001",(0,l.jsx)(n.a,{href:"https://arxiv.org/abs/2207.02696",children:"YOLOv7"})," \u3001",(0,l.jsx)(n.a,{href:"https://arxiv.org/abs/2203.16250",children:"PPYOLO-E"})," \uff08\u56fe b & c\uff09\u4f7f\u7528\u4e86\u91cd\u53c2\u6570\u5316 Block\u3002\u4f46\u91cd\u53c2\u6570\u5316\u7684\u8bad\u7ec3\u4ee3\u4ef7\u9ad8\uff0c\u4e14\u4e0d\u6613\u91cf\u5316\uff0c\u9700\u8981\u5176\u4ed6\u65b9\u5f0f\u6765\u5f25\u8865\u91cf\u5316\u8bef\u5dee\u3002\nRTMDet \u5219\u501f\u9274\u4e86\u6700\u8fd1\u6bd4\u8f83\u70ed\u95e8\u7684 ",(0,l.jsx)(n.a,{href:"https://arxiv.org/abs/2201.03545",children:"ConvNeXt"})," \u3001",(0,l.jsx)(n.a,{href:"https://arxiv.org/abs/2203.06717",children:"RepLKNet"})," \u7684\u505a\u6cd5\uff0c\u4e3a ",(0,l.jsx)(n.code,{children:"Basic Block"})," \u52a0\u5165\u4e86\u5927 kernel \u7684 ",(0,l.jsx)(n.code,{children:"depth-wise"})," \u5377\u79ef\uff08\u56fe d\uff09\uff0c\u5e76\u5c06\u5176\u547d\u540d\u4e3a ",(0,l.jsx)(n.code,{children:"CSPNeXt Block"}),"\u3002"]}),"\n",(0,l.jsxs)(n.div,{align:"center",children:["\n",(0,l.jsx)(n.img,{alt:"BasicBlock",src:"https://user-images.githubusercontent.com/27466624/192752976-4c20f944-1ef0-4746-892e-ba814cdcda20.png"}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:"\u5173\u4e8e\u4e0d\u540c kernel \u5927\u5c0f\u7684\u5b9e\u9a8c\u7ed3\u679c\uff0c\u5982\u4e0b\u8868\u6240\u793a\u3002"}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{children:"Kernel size"}),(0,l.jsx)(n.th,{children:"params"}),(0,l.jsx)(n.th,{children:"flops"}),(0,l.jsx)(n.th,{children:"latency-bs1-TRT-FP16 / ms"}),(0,l.jsx)(n.th,{children:"mAP"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"3x3"}),(0,l.jsx)(n.td,{children:"50.8"}),(0,l.jsx)(n.td,{children:"79.61G"}),(0,l.jsx)(n.td,{children:"2.1"}),(0,l.jsx)(n.td,{children:"50.0"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"5x5"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"50.92M"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"79.7G"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"2.11"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"50.9"})})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"7x7"}),(0,l.jsx)(n.td,{children:"51.1"}),(0,l.jsx)(n.td,{children:"80.34G"}),(0,l.jsx)(n.td,{children:"2.73"}),(0,l.jsx)(n.td,{children:"51.1"})]})]})]}),"\n",(0,l.jsxs)(n.p,{children:["\u5982\u679c\u60f3\u9605\u8bfb ",(0,l.jsx)(n.code,{children:"Basic Block"})," \u548c ",(0,l.jsx)(n.code,{children:"CSPNeXt Block"})," \u6e90\u7801\uff0c\u53ef\u4ee5",(0,l.jsx)(n.a,{href:"https://github.com/open-mmlab/mmdetection/blob/3.x/mmdet/models/layers/csp_layer.py#L79-L146",children:(0,l.jsx)(n.strong,{children:"\u70b9\u6b64"})}),"\u8df3\u8f6c\u3002"]}),"\n",(0,l.jsx)(n.h4,{id:"123-\u8c03\u6574\u68c0\u6d4b\u5668\u4e0d\u540c-stage-\u95f4\u7684-block-\u6570",children:"1.2.3 \u8c03\u6574\u68c0\u6d4b\u5668\u4e0d\u540c stage \u95f4\u7684 block \u6570"}),"\n",(0,l.jsxs)(n.p,{children:["\u7531\u4e8e ",(0,l.jsx)(n.code,{children:"CSPNeXt Block"})," \u5185\u4f7f\u7528\u4e86 ",(0,l.jsx)(n.code,{children:"depth-wise"})," \u5377\u79ef\uff0c\u5355\u4e2a block \u5185\u7684\u5c42\u6570\u589e\u591a\u3002\u5982\u679c\u4fdd\u6301\u539f\u6709\u7684 stage \u5185\u7684 block \u6570\uff0c\u5219\u4f1a\u5bfc\u81f4\u6a21\u578b\u7684\u63a8\u7406\u901f\u5ea6\u5927\u5e45\u964d\u4f4e\u3002"]}),"\n",(0,l.jsx)(n.p,{children:"RTMDet \u91cd\u65b0\u8c03\u6574\u4e86\u4e0d\u540c stage \u95f4\u7684 block \u6570\uff0c\u5e76\u8c03\u6574\u4e86\u901a\u9053\u7684\u8d85\u53c2\uff0c\u5728\u4fdd\u8bc1\u4e86\u7cbe\u5ea6\u7684\u60c5\u51b5\u4e0b\u63d0\u5347\u4e86\u63a8\u7406\u901f\u5ea6\u3002"}),"\n",(0,l.jsx)(n.p,{children:"\u5173\u4e8e\u4e0d\u540c block \u6570\u7684\u5b9e\u9a8c\u7ed3\u679c\uff0c\u5982\u4e0b\u8868\u6240\u793a\u3002"}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{children:"Num blocks"}),(0,l.jsx)(n.th,{children:"params"}),(0,l.jsx)(n.th,{children:"flops"}),(0,l.jsx)(n.th,{children:"latency-bs1-TRT-FP16 / ms"}),(0,l.jsx)(n.th,{children:"mAP"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"L+3-9-9-3"}),(0,l.jsx)(n.td,{children:"53.4"}),(0,l.jsx)(n.td,{children:"86.28"}),(0,l.jsx)(n.td,{children:"2.6"}),(0,l.jsx)(n.td,{children:"51.4"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"L+3-6-6-3"}),(0,l.jsx)(n.td,{children:"50.92M"}),(0,l.jsx)(n.td,{children:"79.7G"}),(0,l.jsx)(n.td,{children:"2.11"}),(0,l.jsx)(n.td,{children:"50.9"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"L+3-6-6-3 + channel attention"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"52.3M"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"79.9G"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"2.4"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"51.3"})})]})]})]}),"\n",(0,l.jsxs)(n.p,{children:["\u6700\u540e\u4e0d\u540c\u5927\u5c0f\u6a21\u578b\u7684 block \u6570\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u53c2\u89c1",(0,l.jsx)(n.a,{href:"https://github.com/open-mmlab/mmyolo/blob/main/mmyolo/models/backbones/cspnext.py#L50-L56",children:"\u6e90\u7801"})," \u3002"]}),"\n",(0,l.jsx)(n.h4,{id:"124-neck",children:"1.2.4 Neck"}),"\n",(0,l.jsx)(n.p,{children:"Neck \u6a21\u578b\u7ed3\u6784\u548c YOLOX \u51e0\u4e4e\u4e00\u6837\uff0c\u53ea\u4e0d\u8fc7\u5185\u90e8\u7684 block \u8fdb\u884c\u4e86\u66ff\u6362\u3002"}),"\n",(0,l.jsx)(n.h4,{id:"125-backbone-\u4e0e-neck-\u4e4b\u95f4\u7684\u53c2\u6570\u91cf\u548c\u8ba1\u7b97\u91cf\u7684\u5747\u8861",children:"1.2.5 Backbone \u4e0e Neck \u4e4b\u95f4\u7684\u53c2\u6570\u91cf\u548c\u8ba1\u7b97\u91cf\u7684\u5747\u8861"}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.a,{href:"https://arxiv.org/abs/1911.09070",children:"EfficientDet"})," \u3001",(0,l.jsx)(n.a,{href:"https://arxiv.org/abs/1904.07392",children:"NASFPN"})," \u7b49\u5de5\u4f5c\u5728\u6539\u8fdb Neck \u65f6\u5f80\u5f80\u805a\u7126\u4e8e\u5982\u4f55\u4fee\u6539\u7279\u5f81\u878d\u5408\u7684\u65b9\u5f0f\u3002 \u4f46\u5f15\u5165\u8fc7\u591a\u7684\u8fde\u63a5\u4f1a\u589e\u52a0\u68c0\u6d4b\u5668\u7684\u5ef6\u65f6\uff0c\u5e76\u589e\u52a0\u5185\u5b58\u5f00\u9500\u3002"]}),"\n",(0,l.jsxs)(n.p,{children:["\u6240\u4ee5 RTMDet \u9009\u62e9\u4e0d\u5f15\u5165\u989d\u5916\u7684\u8fde\u63a5\uff0c\u800c\u662f\u6539\u53d8 Backbone \u4e0e Neck \u95f4\u53c2\u6570\u91cf\u7684\u914d\u6bd4\u3002\u8be5\u914d\u6bd4\u662f\u901a\u8fc7\u624b\u52a8\u8c03\u6574 Backbone \u548c Neck \u7684 ",(0,l.jsx)(n.code,{children:"expand_ratio"})," \u53c2\u6570\u6765\u5b9e\u73b0\u7684\uff0c\u5176\u6570\u503c\u5728 Backbone \u548c Neck \u4e2d\u90fd\u4e3a 0.5\u3002",(0,l.jsx)(n.code,{children:"expand_ratio"})," \u5b9e\u9645\u4e0a\u662f\u6539\u53d8 ",(0,l.jsx)(n.code,{children:"CSPLayer"})," \u4e2d\u5404\u5c42\u901a\u9053\u6570\u7684\u53c2\u6570\uff08\u5177\u4f53\u53ef\u89c1\u6a21\u578b\u56fe ",(0,l.jsx)(n.code,{children:"CSPLayer"})," \u90e8\u5206\uff09\u3002\u5982\u679c\u60f3\u8fdb\u884c\u4e0d\u540c\u914d\u6bd4\u7684\u5b9e\u9a8c\uff0c\u53ef\u4ee5\u901a\u8fc7\u8c03\u6574\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684 ",(0,l.jsx)(n.a,{href:"https://github.com/open-mmlab/mmyolo/blob/main/configs/rtmdet/rtmdet_l_8xb32-300e_coco.py#L32",children:"backbone {expand_ratio}"})," \u548c ",(0,l.jsx)(n.a,{href:"https://github.com/open-mmlab/mmyolo/blob/main/configs/rtmdet/rtmdet_l_8xb32-300e_coco.py#L45",children:"neck {expand_ratio}"})," \u53c2\u6570\u5b8c\u6210\u3002"]}),"\n",(0,l.jsxs)(n.p,{children:["\u5b9e\u9a8c\u53d1\u73b0\uff0c\u5f53 Neck \u5728\u6574\u4e2a\u6a21\u578b\u4e2d\u7684\u53c2\u6570\u91cf\u5360\u6bd4\u66f4\u9ad8\u65f6\uff0c\u5ef6\u65f6\u66f4\u4f4e\uff0c\u4e14\u5bf9\u7cbe\u5ea6\u7684\u5f71\u54cd\u5f88\u5c0f\u3002\u4f5c\u8005\u5728\u76f4\u64ad\u7b54\u7591\u65f6\u56de\u590d\uff0cRTMDet \u5728 Neck \u8fd9\u4e00\u90e8\u5206\u7684\u5b9e\u9a8c\u53c2\u8003\u4e86 ",(0,l.jsx)(n.a,{href:"https://arxiv.org/abs/2202.04256",children:"GiraffeDet"})," \u7684\u505a\u6cd5\uff0c\u4f46\u6ca1\u6709\u50cf GiraffeDet \u4e00\u6837\u5f15\u5165\u989d\u5916\u8fde\u63a5\uff08\u8be6\u7ec6\u53ef\u53c2\u89c1 ",(0,l.jsx)(n.a,{href:"https://www.bilibili.com/video/BV1e841147GD",children:"RTMDet \u53d1\u5e03\u89c6\u9891"})," 31\u520640\u79d2\u5de6\u53f3\u7684\u5185\u5bb9\uff09\u3002"]}),"\n",(0,l.jsx)(n.p,{children:"\u5173\u4e8e\u4e0d\u540c\u53c2\u6570\u91cf\u914d\u6bd4\u7684\u5b9e\u9a8c\u7ed3\u679c\uff0c\u5982\u4e0b\u8868\u6240\u793a\u3002"}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{children:"Model size"}),(0,l.jsx)(n.th,{children:"Backbone"}),(0,l.jsx)(n.th,{children:"Neck"}),(0,l.jsx)(n.th,{children:"params"}),(0,l.jsx)(n.th,{children:"flops"}),(0,l.jsx)(n.th,{children:"latency / ms"}),(0,l.jsx)(n.th,{children:"mAP"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"S"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"47%"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"45%"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"8.54M"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"15.76G"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"1.21"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"43.9"})})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"S"}),(0,l.jsx)(n.td,{children:"63%"}),(0,l.jsx)(n.td,{children:"29%"}),(0,l.jsx)(n.td,{children:"9.01M"}),(0,l.jsx)(n.td,{children:"15.85G"}),(0,l.jsx)(n.td,{children:"1.37"}),(0,l.jsx)(n.td,{children:"43.7"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"L"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"47%"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"45%"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"50.92M"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"79.7G"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"2.11"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"50.9"})})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"L"}),(0,l.jsx)(n.td,{children:"63%"}),(0,l.jsx)(n.td,{children:"29%"}),(0,l.jsx)(n.td,{children:"57.43M"}),(0,l.jsx)(n.td,{children:"93.73"}),(0,l.jsx)(n.td,{children:"2.57"}),(0,l.jsx)(n.td,{children:"51.0"})]})]})]}),"\n",(0,l.jsxs)(n.p,{children:["\u5982\u679c\u60f3\u9605\u8bfb Neck - ",(0,l.jsx)(n.code,{children:"CSPNeXtPAFPN"})," \u7684\u6e90\u7801\uff0c\u53ef\u4ee5",(0,l.jsx)(n.a,{href:"https://github.com/open-mmlab/mmyolo/blob/main/mmyolo/models/necks/cspnext_pafpn.py#L15-L201",children:(0,l.jsx)(n.strong,{children:"\u70b9\u6b64"})})," \u8df3\u8f6c\u3002"]}),"\n",(0,l.jsx)(n.h4,{id:"126-head",children:"1.2.6 Head"}),"\n",(0,l.jsxs)(n.p,{children:["\u4f20\u7edf\u7684 YOLO \u7cfb\u5217\u90fd\u4f7f\u7528\u540c\u4e00 Head \u8fdb\u884c\u5206\u7c7b\u548c\u56de\u5f52\u3002YOLOX \u5219\u5c06\u5206\u7c7b\u548c\u56de\u5f52\u5206\u652f\u89e3\u8026\uff0cPPYOLO-E \u548c YOLOv6 \u5219\u5f15\u5165\u4e86 ",(0,l.jsx)(n.a,{href:"https://arxiv.org/abs/2108.07755",children:"TOOD"})," \u4e2d\u7684\u7ed3\u6784\u3002\u5b83\u4eec\u5728\u4e0d\u540c\u7279\u5f81\u5c42\u7ea7\u4e4b\u95f4\u90fd\u4f7f\u7528\u72ec\u7acb\u7684 Head\uff0c\u56e0\u6b64 Head \u5728\u6a21\u578b\u4e2d\u4e5f\u5360\u6709\u8f83\u591a\u7684\u53c2\u6570\u91cf\u3002"]}),"\n",(0,l.jsxs)(n.p,{children:["RTMDet \u53c2\u8003\u4e86 ",(0,l.jsx)(n.a,{href:"https://arxiv.org/abs/1904.07392",children:"NAS-FPN"})," \u4e2d\u7684\u505a\u6cd5\uff0c\u4f7f\u7528\u4e86 ",(0,l.jsx)(n.code,{children:"SepBNHead"}),"\uff0c\u5728\u4e0d\u540c\u5c42\u4e4b\u95f4\u5171\u4eab\u5377\u79ef\u6743\u91cd\uff0c\u4f46\u662f\u72ec\u7acb\u8ba1\u7b97 BN\uff08BatchNorm\uff09 \u7684\u7edf\u8ba1\u91cf\u3002"]}),"\n",(0,l.jsx)(n.p,{children:"\u5173\u4e8e\u4e0d\u540c\u7ed3\u6784 Head \u7684\u5b9e\u9a8c\u7ed3\u679c\uff0c\u5982\u4e0b\u8868\u6240\u793a\u3002"}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{children:"Head type"}),(0,l.jsx)(n.th,{children:"params"}),(0,l.jsx)(n.th,{children:"flops"}),(0,l.jsx)(n.th,{children:"latency / ms"}),(0,l.jsx)(n.th,{children:"mAP"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"Fully-shared head"}),(0,l.jsx)(n.td,{children:"52.32"}),(0,l.jsx)(n.td,{children:"80.23"}),(0,l.jsx)(n.td,{children:"2.44"}),(0,l.jsx)(n.td,{children:"48.0"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{children:"Separated head"}),(0,l.jsx)(n.td,{children:"57.03"}),(0,l.jsx)(n.td,{children:"80.23"}),(0,l.jsx)(n.td,{children:"2.44"}),(0,l.jsx)(n.td,{children:"51.2"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsxs)(n.td,{children:[(0,l.jsx)(n.strong,{children:"SepBN"})," ",(0,l.jsx)(n.strong,{children:"head"})]}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"52.32"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"80.23"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"2.44"})}),(0,l.jsx)(n.td,{children:(0,l.jsx)(n.strong,{children:"51.3"})})]})]})]}),"\n",(0,l.jsxs)(n.p,{children:["\u540c\u65f6\uff0cRTMDet \u4e5f\u5ef6\u7eed\u4e86\u4f5c\u8005\u4e4b\u524d\u5728 ",(0,l.jsx)(n.a,{href:"https://zhuanlan.zhihu.com/p/306530300",children:"NanoDet"})," \u4e2d\u7684\u601d\u60f3\uff0c\u4f7f\u7528 ",(0,l.jsx)(n.a,{href:"https://arxiv.org/abs/2011.12885",children:"Quality Focal Loss"})," \uff0c\u5e76\u53bb\u6389 Objectness \u5206\u652f\uff0c\u8fdb\u4e00\u6b65\u5c06 Head \u8f7b\u91cf\u5316\u3002"]}),"\n",(0,l.jsxs)(n.p,{children:["\u5982\u679c\u60f3\u9605\u8bfb Head \u4e2d ",(0,l.jsx)(n.code,{children:"RTMDetSepBNHeadModule"})," \u7684\u6e90\u7801\uff0c\u53ef\u4ee5",(0,l.jsx)(n.a,{href:"https://github.com/open-mmlab/mmyolo/blob/main/mmyolo/models/dense_heads/rtmdet_head.py#L24-L189",children:(0,l.jsx)(n.strong,{children:"\u70b9\u6b64"})})," \u8df3\u8f6c\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-{note}",children:"\u6ce8\uff1aMMYOLO \u548c MMDetection \u4e2d Neck \u548c Head \u7684\u5177\u4f53\u5b9e\u73b0\u7a0d\u6709\u4e0d\u540c\u3002\n"})}),"\n",(0,l.jsx)(n.h3,{id:"13-\u6b63\u8d1f\u6837\u672c\u5339\u914d\u7b56\u7565",children:"1.3 \u6b63\u8d1f\u6837\u672c\u5339\u914d\u7b56\u7565"}),"\n",(0,l.jsxs)(n.p,{children:["\u6b63\u8d1f\u6837\u672c\u5339\u914d\u7b56\u7565\u6216\u8005\u79f0\u4e3a\u6807\u7b7e\u5339\u914d\u7b56\u7565 ",(0,l.jsx)(n.code,{children:"Label Assignment"})," \u662f\u76ee\u6807\u68c0\u6d4b\u6a21\u578b\u8bad\u7ec3\u4e2d\u6700\u6838\u5fc3\u7684\u95ee\u9898\u4e4b\u4e00, \u66f4\u597d\u7684\u6807\u7b7e\u5339\u914d\u7b56\u7565\u5f80\u5f80\u80fd\u591f\u4f7f\u5f97\u7f51\u7edc\u66f4\u597d\u5b66\u4e60\u5230\u7269\u4f53\u7684\u7279\u5f81\u4ee5\u63d0\u9ad8\u68c0\u6d4b\u80fd\u529b\u3002"]}),"\n",(0,l.jsxs)(n.p,{children:["\u65e9\u671f\u7684\u6837\u672c\u6807\u7b7e\u5339\u914d\u7b56\u7565\u4e00\u822c\u90fd\u662f\u57fa\u4e8e ",(0,l.jsx)(n.code,{children:"\u7a7a\u95f4\u4ee5\u53ca\u5c3a\u5ea6\u4fe1\u606f\u7684\u5148\u9a8c"})," \u6765\u51b3\u5b9a\u6837\u672c\u7684\u9009\u53d6\u3002 \u5178\u578b\u6848\u4f8b\u5982\u4e0b\uff1a"]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"FCOS"})," \u4e2d\u5148\u9650\u5b9a\u7f51\u683c\u4e2d\u5fc3\u70b9\u5728 ",(0,l.jsx)(n.code,{children:"GT"})," \u5185\u7b5b\u9009\u540e\u7136\u540e\u518d\u901a\u8fc7\u4e0d\u540c\u7279\u5f81\u5c42\u9650\u5236\u5c3a\u5bf8\u6765\u51b3\u5b9a\u6b63\u8d1f\u6837\u672c"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"RetinaNet"})," \u5219\u662f\u901a\u8fc7 ",(0,l.jsx)(n.code,{children:"Anchor"})," \u4e0e ",(0,l.jsx)(n.code,{children:"GT"})," \u7684\u6700\u5927 ",(0,l.jsx)(n.code,{children:"IOU"})," \u5339\u914d\u6765\u5212\u5206\u6b63\u8d1f\u6837\u672c"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"YOLOV5"})," \u7684\u6b63\u8d1f\u6837\u672c\u5219\u662f\u901a\u8fc7\u6837\u672c\u7684\u5bbd\u9ad8\u6bd4\u5148\u7b5b\u9009\u4e00\u90e8\u5206, \u7136\u540e\u901a\u8fc7\u4f4d\u7f6e\u4fe1\u606f\u9009\u53d6 ",(0,l.jsx)(n.code,{children:"GT"})," \u4e2d\u5fc3\u843d\u5728\u7684 ",(0,l.jsx)(n.code,{children:"Grid"})," \u4ee5\u53ca\u4e34\u8fd1\u7684\u4e24\u4e2a\u4f5c\u4e3a\u6b63\u6837\u672c"]}),"\n"]}),"\n",(0,l.jsxs)(n.p,{children:["\u4f46\u662f\u4e0a\u8ff0\u65b9\u6cd5\u90fd\u662f\u5c5e\u4e8e\u57fa\u4e8e ",(0,l.jsx)(n.code,{children:"\u5148\u9a8c"})," \u7684\u9759\u6001\u5339\u914d\u7b56\u7565, \u5c31\u662f\u6837\u672c\u7684\u9009\u53d6\u65b9\u5f0f\u662f\u6839\u636e\u4eba\u7684\u7ecf\u9a8c\u89c4\u5b9a\u7684\u3002 \u4e0d\u4f1a\u968f\u7740\u7f51\u7edc\u7684\u4f18\u5316\u800c\u8fdb\u884c\u81ea\u52a8\u4f18\u5316\u9009\u53d6\u5230\u66f4\u597d\u7684\u6837\u672c, \u8fd1\u4e9b\u5e74\u6d8c\u73b0\u4e86\u8bb8\u591a\u4f18\u79c0\u7684\u52a8\u6001\u6807\u7b7e\u5339\u914d\u7b56\u7565\uff1a"]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"OTA"})," \u63d0\u51fa\u4f7f\u7528 ",(0,l.jsx)(n.code,{children:"Sinkhorn"})," \u8fed\u4ee3\u6c42\u89e3\u5339\u914d\u4e2d\u7684\u6700\u4f18\u4f20\u8f93\u95ee\u9898"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"YOLOX"})," \u4e2d\u4f7f\u7528 ",(0,l.jsx)(n.code,{children:"OTA"})," \u7684\u8fd1\u4f3c\u7b97\u6cd5 ",(0,l.jsx)(n.code,{children:"SimOTA"})," , ",(0,l.jsx)(n.code,{children:"TOOD"})," \u5c06\u5206\u7c7b\u5206\u6570\u4ee5\u53ca ",(0,l.jsx)(n.code,{children:"IOU"})," \u76f8\u4e58\u8ba1\u7b97 ",(0,l.jsx)(n.code,{children:"Cost"})," \u77e9\u9635\u8fdb\u884c\u6807\u7b7e\u5339\u914d\u7b49\u7b49"]}),"\n"]}),"\n",(0,l.jsxs)(n.p,{children:["\u8fd9\u4e9b\u7b97\u6cd5\u5c06 ",(0,l.jsx)(n.code,{children:"\u9884\u6d4b\u7684 Bboxes \u4e0e GT \u7684 IOU "})," \u548c ",(0,l.jsx)(n.code,{children:"\u5206\u7c7b\u5206\u6570"})," \u6216\u8005\u662f\u5bf9\u5e94 ",(0,l.jsx)(n.code,{children:"\u5206\u7c7b Loss"})," \u548c ",(0,l.jsx)(n.code,{children:"\u56de\u5f52 Loss"})," \u62ff\u6765\u8ba1\u7b97 ",(0,l.jsx)(n.code,{children:"Matching Cost"})," \u77e9\u9635\u518d\u901a\u8fc7 ",(0,l.jsx)(n.code,{children:"top-k"})," \u7684\u65b9\u5f0f\u52a8\u6001\u51b3\u5b9a\u6837\u672c\u9009\u53d6\u4ee5\u53ca\u6837\u672c\u4e2a\u6570\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f,\n\u5728\u7f51\u7edc\u4f18\u5316\u7684\u8fc7\u7a0b\u4e2d\u4f1a\u81ea\u52a8\u9009\u53d6\u5bf9\u5206\u7c7b\u6216\u8005\u56de\u5f52\u66f4\u52a0\u654f\u611f\u6709\u6548\u7684\u4f4d\u7f6e\u7684\u6837\u672c, \u5b83\u4e0d\u518d\u53ea\u4f9d\u8d56\u5148\u9a8c\u7684\u9759\u6001\u7684\u4fe1\u606f, \u800c\u662f\u4f7f\u7528\u5f53\u524d\u7684\u9884\u6d4b\u7ed3\u679c\u53bb\u52a8\u6001\u5bfb\u627e\u6700\u4f18\u7684\u5339\u914d, \u53ea\u8981\u6a21\u578b\u7684\u9884\u6d4b\u8d8a\u51c6\u786e, \u5339\u914d\u7b97\u6cd5\u6c42\u5f97\u7684\u7ed3\u679c\u4e5f\u4f1a\u66f4\u4f18\u79c0\u3002\u4f46\u662f\u5728\u7f51\u7edc\u8bad\u7ec3\u7684\u521d\u671f, \u7f51\u7edc\u7684\u5206\u7c7b\u4ee5\u53ca\u56de\u5f52\u662f\u968f\u673a\u521d\u59cb\u5316, \u8fd9\u4e2a\u65f6\u5019\u8fd8\u662f\u9700\u8981 ",(0,l.jsx)(n.code,{children:"\u5148\u9a8c"})," \u6765\u7ea6\u675f, \u4ee5\u8fbe\u5230 ",(0,l.jsx)(n.code,{children:"\u51b7\u542f\u52a8"})," \u7684\u6548\u679c\u3002"]}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"RTMDet"})," \u4f5c\u8005\u4e5f\u662f\u91c7\u7528\u4e86\u52a8\u6001\u7684 ",(0,l.jsx)(n.code,{children:"SimOTA"})," \u505a\u6cd5\uff0c\u4e0d\u8fc7\u5176\u5bf9\u52a8\u6001\u7684\u6b63\u8d1f\u6837\u672c\u5206\u914d\u7b56\u7565\u8fdb\u884c\u4e86\u6539\u8fdb\u3002 \u4e4b\u524d\u7684\u52a8\u6001\u5339\u914d\u7b56\u7565\uff08 ",(0,l.jsx)(n.code,{children:"HungarianAssigner"})," \u3001",(0,l.jsx)(n.code,{children:"OTA"})," \uff09\u5f80\u5f80\u4f7f\u7528\u4e0e ",(0,l.jsx)(n.code,{children:"Loss"})," \u5b8c\u5168\u4e00\u81f4\u7684\u4ee3\u4ef7\u51fd\u6570\u4f5c\u4e3a\u5339\u914d\u7684\u4f9d\u636e\uff0c\u4f46\u6211\u4eec\u7ecf\u8fc7\u5b9e\u9a8c\u53d1\u73b0\u8fd9\u5e76\u4e0d\u4e00\u5b9a\u65f6\u6700\u4f18\u7684\u3002 \u4f7f\u7528\u66f4\u591a ",(0,l.jsx)(n.code,{children:"Soften"})," \u7684 ",(0,l.jsx)(n.code,{children:"Cost"})," \u4ee5\u53ca\u5148\u9a8c\uff0c\u80fd\u591f\u63d0\u5347\u6027\u80fd\u3002"]}),"\n",(0,l.jsx)(n.h4,{id:"131-bbox-\u7f16\u89e3\u7801\u8fc7\u7a0b",children:"1.3.1 Bbox \u7f16\u89e3\u7801\u8fc7\u7a0b"}),"\n",(0,l.jsxs)(n.p,{children:["RTMDet \u7684 BBox Coder \u91c7\u7528\u7684\u662f ",(0,l.jsx)(n.code,{children:"mmdet.DistancePointBBoxCoder"}),"\u3002"]}),"\n",(0,l.jsxs)(n.p,{children:["\u8be5\u7c7b\u7684 docstring \u4e3a ",(0,l.jsx)(n.code,{children:"This coder encodes gt bboxes (x1, y1, x2, y2) into (top, bottom, left, right) and decode it back to the original."})]}),"\n",(0,l.jsx)(n.p,{children:"\u7f16\u7801\u5668\u5c06 gt bboxes (x1, y1, x2, y2) \u7f16\u7801\u4e3a (top, bottom, left, right)\uff0c\u5e76\u4e14\u89e3\u7801\u81f3\u539f\u56fe\u50cf\u4e0a\u3002"}),"\n",(0,l.jsx)(n.p,{children:"MMDet \u7f16\u7801\u7684\u6838\u5fc3\u6e90\u7801\uff1a"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-python",children:'def bbox2distance(points: Tensor, bbox: Tensor, ...) -> Tensor:\n """\n points (Tensor): \u76f8\u5f53\u4e8e scale \u503c stride \uff0c\u4e14\u6bcf\u4e2a\u9884\u6d4b\u70b9\u4ec5\u4e3a\u4e00\u4e2a\u6b63\u65b9\u5f62 anchor \u7684 anchor point [x, y]\uff0cShape (n, 2) or (b, n, 2).\n bbox (Tensor): Bbox \u4e3a\u4e58\u4e0a stride \u7684\u7f51\u7edc\u9884\u6d4b\u503c\uff0c\u683c\u5f0f\u4e3a xyxy\uff0cShape (n, 4) or (b, n, 4).\n """\n # \u8ba1\u7b97\u70b9\u8ddd\u79bb\u56db\u8fb9\u7684\u8ddd\u79bb\n left = points[..., 0] - bbox[..., 0]\n top = points[..., 1] - bbox[..., 1]\n right = bbox[..., 2] - points[..., 0]\n bottom = bbox[..., 3] - points[..., 1]\n\n ...\n\n return torch.stack([left, top, right, bottom], -1)\n'})}),"\n",(0,l.jsx)(n.p,{children:"MMDetection \u89e3\u7801\u7684\u6838\u5fc3\u6e90\u7801\uff1a"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-python",children:'def distance2bbox(points: Tensor, distance: Tensor, ...) -> Tensor:\n """\n \u901a\u8fc7\u8ddd\u79bb\u53cd\u7b97 bbox \u7684 xyxy\n points (Tensor): \u6b63\u65b9\u5f62\u7684\u9884\u6d4b anchor \u7684 anchor point [x, y]\uff0cShape (B, N, 2) or (N, 2).\n distance (Tensor): \u8ddd\u79bb\u56db\u8fb9\u7684\u8ddd\u79bb\u3002(left, top, right, bottom). Shape (B, N, 4) or (N, 4)\n """\n\n # \u53cd\u7b97 bbox xyxy\n x1 = points[..., 0] - distance[..., 0]\n y1 = points[..., 1] - distance[..., 1]\n x2 = points[..., 0] + distance[..., 2]\n y2 = points[..., 1] + distance[..., 3]\n\n bboxes = torch.stack([x1, y1, x2, y2], -1)\n\n ...\n\n return bboxes\n'})}),"\n",(0,l.jsx)(n.h4,{id:"132-\u5339\u914d\u7b56\u7565",children:"1.3.2 \u5339\u914d\u7b56\u7565"}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"RTMDet"})," \u63d0\u51fa\u4e86 ",(0,l.jsx)(n.code,{children:"Dynamic Soft Label Assigner"})," \u6765\u5b9e\u73b0\u6807\u7b7e\u7684\u52a8\u6001\u5339\u914d\u7b56\u7565, \u8be5\u65b9\u6cd5\u4e3b\u8981\u5305\u62ec\u4f7f\u7528 ",(0,l.jsx)(n.strong,{children:"\u4f4d\u7f6e\u5148\u9a8c\u4fe1\u606f\u635f\u5931"})," , ",(0,l.jsx)(n.strong,{children:"\u6837\u672c\u56de\u5f52\u635f\u5931"})," , ",(0,l.jsx)(n.strong,{children:"\u6837\u672c\u5206\u7c7b\u635f\u5931"})," , \u540c\u65f6\u5bf9\u4e09\u4e2a\u635f\u5931\u8fdb\u884c\u4e86 ",(0,l.jsx)(n.code,{children:"Soft"})," \u5904\u7406\u8fdb\u884c\u53c2\u6570\u8c03\u4f18, \u4ee5\u8fbe\u5230\u6700\u4f73\u7684\u52a8\u6001\u5339\u914d\u6548\u679c\u3002"]}),"\n",(0,l.jsx)(n.p,{children:"\u8be5\u65b9\u6cd5 Matching Cost \u77e9\u9635\u7531\u5982\u4e0b\u635f\u5931\u6784\u6210\uff1a"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-python",children:"cost_matrix = soft_cls_cost + iou_cost + soft_center_prior\n"})}),"\n",(0,l.jsxs)(n.ol,{children:["\n",(0,l.jsx)(n.li,{children:"Soft_Center_Prior"}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-{math}",children:"C\\_{center} = \\\\alpha^{|x\\_{pred}-x\\_{gt}|-\\\\beta}\n"})}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-python",children:"# valid_prior Tensor[N,4] \u8868\u793aanchor point\n# 4\u5206\u522b\u8868\u793a x, y, \u4ee5\u53ca\u5bf9\u5e94\u7684\u7279\u5f81\u5c42\u7684 stride, stride\ngt_center = (gt_bboxes[:, :2] + gt_bboxes[:, 2:]) / 2.0\nvalid_prior = priors[valid_mask]\nstrides = valid_prior[:, 2]\n# \u8ba1\u7b97gt\u4e0eanchor point\u7684\u4e2d\u5fc3\u8ddd\u79bb\u5e76\u8f6c\u6362\u5230\u7279\u5f81\u56fe\u5c3a\u5ea6\ndistance = (valid_prior[:, None, :2] - gt_center[None, :, :]\n ).pow(2).sum(-1).sqrt() / strides[:, None]\n# \u4ee510\u4e3a\u5e95\u8ba1\u7b97\u4f4d\u7f6e\u7684\u8f6f\u5316\u635f\u5931,\u9650\u5b9a\u5728gt\u76846\u4e2a\u5355\u5143\u683c\u4ee5\u5185\nsoft_center_prior = torch.pow(10, distance - 3)\n"})}),"\n",(0,l.jsxs)(n.ol,{start:"2",children:["\n",(0,l.jsx)(n.li,{children:"IOU_Cost"}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-{math}",children:"C\\_{reg} = -log(IOU)\n"})}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-python",children:"# \u8ba1\u7b97\u56de\u5f52 bboxes \u548c gts \u7684 iou\npairwise_ious = self.iou_calculator(valid_decoded_bbox, gt_bboxes)\n# \u5c06 iou \u4f7f\u7528 log \u8fdb\u884c soft , iou \u8d8a\u5c0f cost \u66f4\u5c0f\niou_cost = -torch.log(pairwise_ious + EPS) * 3\n"})}),"\n",(0,l.jsxs)(n.ol,{start:"3",children:["\n",(0,l.jsx)(n.li,{children:"Soft_Cls_Cost"}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-{math}",children:"C\\_{cls} = CE(P,Y\\_{soft}) \\*(Y\\_{soft}-P)^2\n"})}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-python",children:"# \u751f\u6210\u5206\u7c7b\u6807\u7b7e\n gt_onehot_label = (\n F.one_hot(gt_labels.to(torch.int64),\n pred_scores.shape[-1]).float().unsqueeze(0).repeat(\n num_valid, 1, 1))\nvalid_pred_scores = valid_pred_scores.unsqueeze(1).repeat(1, num_gt, 1)\n# \u4e0d\u5355\u5355\u5c06\u5206\u7c7b\u6807\u7b7e\u4e3a01,\u800c\u662f\u6362\u6210\u4e0e gt \u7684 iou\nsoft_label = gt_onehot_label * pairwise_ious[..., None]\n# \u4f7f\u7528 quality focal loss \u8ba1\u7b97\u5206\u7c7b\u635f\u5931 cost ,\u4e0e\u5b9e\u9645\u7684\u5206\u7c7b\u635f\u5931\u8ba1\u7b97\u4fdd\u6301\u4e00\u81f4\nscale_factor = soft_label - valid_pred_scores.sigmoid()\nsoft_cls_cost = F.binary_cross_entropy_with_logits(\n valid_pred_scores, soft_label,\n reduction='none') * scale_factor.abs().pow(2.0)\nsoft_cls_cost = soft_cls_cost.sum(dim=-1)\n"})}),"\n",(0,l.jsxs)(n.p,{children:["\u901a\u8fc7\u8ba1\u7b97\u4e0a\u8ff0\u4e09\u4e2a\u635f\u5931\u7684\u548c\u5f97\u5230\u6700\u7ec8\u7684 ",(0,l.jsx)(n.code,{children:"cost_matrix"})," \u540e, \u518d\u4f7f\u7528 ",(0,l.jsx)(n.code,{children:"SimOTA"})," \u51b3\u5b9a\u6bcf\u4e00\u4e2a ",(0,l.jsx)(n.code,{children:"GT"})," \u5339\u914d\u7684\u6837\u672c\u7684\u4e2a\u6570\u5e76\u51b3\u5b9a\u6700\u7ec8\u7684\u6837\u672c\u3002\u5177\u4f53\u64cd\u4f5c\u5982\u4e0b\u6240\u793a\uff1a"]}),"\n",(0,l.jsxs)(n.ol,{children:["\n",(0,l.jsxs)(n.li,{children:["\u9996\u5148\u901a\u8fc7\u81ea\u9002\u5e94\u8ba1\u7b97\u6bcf\u4e00\u4e2a ",(0,l.jsx)(n.code,{children:"gt"})," \u8981\u9009\u53d6\u7684\u6837\u672c\u6570\u91cf\uff1a \u53d6\u6bcf\u4e00\u4e2a ",(0,l.jsx)(n.code,{children:"gt"})," \u4e0e\u6240\u6709 ",(0,l.jsx)(n.code,{children:"bboxes"})," \u524d ",(0,l.jsx)(n.code,{children:"13"})," \u5927\u7684 ",(0,l.jsx)(n.code,{children:"iou"}),", \u5f97\u5230\u5b83\u4eec\u7684\u548c\u53d6\u6574\u540e\u4f5c\u4e3a\u8fd9\u4e2a ",(0,l.jsx)(n.code,{children:"gt"})," \u7684 ",(0,l.jsx)(n.code,{children:"\u6837\u672c\u6570\u76ee"})," , \u6700\u5c11\u4e3a ",(0,l.jsx)(n.code,{children:"1"})," \u4e2a, \u8bb0\u4e3a ",(0,l.jsx)(n.code,{children:"dynamic_ks"}),"\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:["\u5bf9\u4e8e\u6bcf\u4e00\u4e2a ",(0,l.jsx)(n.code,{children:"gt"})," , \u5c06\u5176 ",(0,l.jsx)(n.code,{children:"cost_matrix"})," \u77e9\u9635\u524d ",(0,l.jsx)(n.code,{children:"dynamic_ks"})," \u5c0f\u7684\u4f4d\u7f6e\u4f5c\u4e3a\u8be5 ",(0,l.jsx)(n.code,{children:"gt"})," \u7684\u6b63\u6837\u672c\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:["\u5bf9\u4e8e\u67d0\u4e00\u4e2a ",(0,l.jsx)(n.code,{children:"bbox"}),", \u5982\u679c\u88ab\u5339\u914d\u5230\u591a\u4e2a ",(0,l.jsx)(n.code,{children:"gt"})," \u5c31\u5c06\u4e0e\u8fd9\u4e9b ",(0,l.jsx)(n.code,{children:"gts"})," \u7684 ",(0,l.jsx)(n.code,{children:"cost_marix"})," \u4e2d\u6700\u5c0f\u7684\u90a3\u4e2a\u4f5c\u4e3a\u5176 ",(0,l.jsx)(n.code,{children:"label"}),"\u3002"]}),"\n"]}),"\n",(0,l.jsxs)(n.p,{children:["\u5728\u7f51\u7edc\u8bad\u7ec3\u521d\u671f\uff0c\u56e0\u53c2\u6570\u521d\u59cb\u5316\uff0c\u56de\u5f52\u548c\u5206\u7c7b\u7684\u635f\u5931\u503c ",(0,l.jsx)(n.code,{children:"Cost"})," \u5f80\u5f80\u8f83\u5927, \u8fd9\u65f6\u5019 ",(0,l.jsx)(n.code,{children:"IOU"})," \u6bd4\u8f83\u5c0f\uff0c \u9009\u53d6\u7684\u6837\u672c\u8f83\u5c11\uff0c\u4e3b\u8981\u8d77\u4f5c\u7528\u7684\u662f ",(0,l.jsx)(n.code,{children:"Soft_center_prior"})," \u4e5f\u5c31\u662f\u4f4d\u7f6e\u4fe1\u606f\uff0c\u4f18\u5148\u9009\u53d6\u4f4d\u7f6e\u8ddd\u79bb ",(0,l.jsx)(n.code,{children:"GT"})," \u6bd4\u8f83\u8fd1\u7684\u6837\u672c\u4f5c\u4e3a\u6b63\u6837\u672c\uff0c\u8fd9\u4e5f\u7b26\u5408\u4eba\u4eec\u7684\u7406\u89e3\uff0c\u5728\u7f51\u7edc\u524d\u671f\u7ed9\u5c11\u91cf\u5e76\u4e14\u6709\u8db3\u591f\u8d28\u91cf\u7684\u6837\u672c\uff0c\u4ee5\u8fbe\u5230\u51b7\u542f\u52a8\u3002\n\u5f53\u7f51\u7edc\u8fdb\u884c\u8bad\u7ec3\u4e00\u6bb5\u65f6\u95f4\u8fc7\u540e\uff0c\u5206\u7c7b\u5206\u652f\u548c\u56de\u5f52\u5206\u652f\u90fd\u8fdb\u884c\u4e86\u4e00\u5b9a\u7684\u4f18\u5316\u540e\uff0c\u8fd9\u65f6 ",(0,l.jsx)(n.code,{children:"IOU"})," \u53d8\u5927\uff0c \u9009\u53d6\u7684\u6837\u672c\u4e5f\u9010\u6e10\u589e\u591a\uff0c\u8fd9\u65f6\u7f51\u7edc\u4e5f\u6709\u80fd\u529b\u5b66\u4e60\u5230\u66f4\u591a\u7684\u6837\u672c\uff0c\u540c\u65f6\u56e0\u4e3a ",(0,l.jsx)(n.code,{children:"IOU_Cost"})," \u4ee5\u53ca ",(0,l.jsx)(n.code,{children:"Soft_Cls_Cost"})," \u53d8\u5c0f\uff0c\u7f51\u7edc\u4e5f\u4f1a\u52a8\u6001\u7684\u627e\u5230\u66f4\u6709\u5229\u4f18\u5316\u5206\u7c7b\u4ee5\u53ca\u56de\u5f52\u7684\u6837\u672c\u70b9\u3002"]}),"\n",(0,l.jsxs)(n.p,{children:["\u5728 ",(0,l.jsx)(n.code,{children:"Resnet50-1x"})," \u7684\u4e09\u79cd\u635f\u5931\u7684\u6d88\u878d\u5b9e\u9a8c\uff1a"]}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{style:{textAlign:"left"},children:"Soft_cls_cost"}),(0,l.jsx)(n.th,{style:{textAlign:"left"},children:"Soft_center_prior"}),(0,l.jsx)(n.th,{style:{textAlign:"left"},children:"Log_IoU_cost"}),(0,l.jsx)(n.th,{style:{textAlign:"left"},children:"mAP"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"\xd7"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"\xd7"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"\xd7"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"39.9"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"\u221a"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"\xd7"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"\xd7"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"40.3"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"\u221a"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"\u221a"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"\xd7"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"40.8"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"\u221a"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"\u221a"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"\u221a"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"41.3"})]})]})]}),"\n",(0,l.jsxs)(n.p,{children:["\u4e0e\u5176\u4ed6\u4e3b\u6d41 ",(0,l.jsx)(n.code,{children:"Assign"})," \u65b9\u6cd5\u5728 ",(0,l.jsx)(n.code,{children:"Resnet50-1x"})," \u7684\u5bf9\u6bd4\u5b9e\u9a8c\uff1a"]}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{style:{textAlign:"center"},children:"method"}),(0,l.jsx)(n.th,{style:{textAlign:"left"},children:"mAP"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{style:{textAlign:"center"},children:"ATSS"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"39.2"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{style:{textAlign:"center"},children:"PAA"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"40.4"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{style:{textAlign:"center"},children:"OTA"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"40.7"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{style:{textAlign:"center"},children:"TOOD(w/o TAH)"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"40.7"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{style:{textAlign:"center"},children:"Ours"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"41.3"})]})]})]}),"\n",(0,l.jsxs)(n.p,{children:["\u65e0\u8bba\u662f ",(0,l.jsx)(n.code,{children:"Resnet50-1x"})," \u8fd8\u662f\u6807\u51c6\u7684\u8bbe\u7f6e\u4e0b\uff0c\u8fd8\u662f\u5728",(0,l.jsx)(n.code,{children:"300epoch"})," + ",(0,l.jsx)(n.code,{children:"havy augmentation"}),", \u76f8\u6bd4\u4e8e ",(0,l.jsx)(n.code,{children:"SimOTA"})," \u3001 ",(0,l.jsx)(n.code,{children:"OTA"})," \u4ee5\u53ca ",(0,l.jsx)(n.code,{children:"TOOD"})," \u4e2d\u7684 ",(0,l.jsx)(n.code,{children:"TAL"})," \u5747\u6709\u63d0\u5347\u3002"]}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,l.jsxs)(n.table,{children:[(0,l.jsx)(n.thead,{children:(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.th,{style:{textAlign:"left"},children:"300e + Mosaic & MixUP"}),(0,l.jsx)(n.th,{style:{textAlign:"left"},children:"mAP"})]})}),(0,l.jsxs)(n.tbody,{children:[(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"RTMDet-s + SimOTA"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"43.2"})]}),(0,l.jsxs)(n.tr,{children:[(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"RTMDet-s + DSLA"}),(0,l.jsx)(n.td,{style:{textAlign:"left"},children:"44.5"})]})]})]}),"\n",(0,l.jsx)(n.h3,{id:"14-loss-\u8bbe\u8ba1",children:"1.4 Loss \u8bbe\u8ba1"}),"\n",(0,l.jsxs)(n.p,{children:["\u53c2\u4e0e Loss \u8ba1\u7b97\u7684\u5171\u6709\u4e24\u4e2a\u503c\uff1a",(0,l.jsx)(n.code,{children:"loss_cls"})," \u548c ",(0,l.jsx)(n.code,{children:"loss_bbox"}),"\uff0c\u5176\u5404\u81ea\u4f7f\u7528\u7684 Loss \u65b9\u6cd5\u5982\u4e0b\uff1a"]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"loss_cls"}),"\uff1a",(0,l.jsx)(n.code,{children:"mmdet.QualityFocalLoss"})]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"loss_bbox"}),"\uff1a",(0,l.jsx)(n.code,{children:"mmdet.GIoULoss"})]}),"\n"]}),"\n",(0,l.jsxs)(n.p,{children:["\u6743\u91cd\u6bd4\u4f8b\u662f\uff1a",(0,l.jsx)(n.code,{children:"loss_cls"})," : ",(0,l.jsx)(n.code,{children:"loss_bbox"})," = ",(0,l.jsx)(n.code,{children:"1 : 2"})]}),"\n",(0,l.jsx)(n.h4,{id:"qualityfocalloss",children:"QualityFocalLoss"}),"\n",(0,l.jsxs)(n.p,{children:["Quality Focal Loss (QFL) \u662f ",(0,l.jsx)(n.a,{href:"https://arxiv.org/abs/2006.04388",children:"Generalized Focal Loss: Learning Qualified and Distributed Bounding Boxes for Dense Object Detection"})," \u7684\u4e00\u90e8\u5206\u3002"]}),"\n",(0,l.jsxs)(n.div,{align:"center",children:["\n",(0,l.jsx)(n.img,{src:"https://user-images.githubusercontent.com/25873202/192767279-4e69f935-1685-4089-82a3-0add201f98cc.png",alt:"image"}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:"\u666e\u901a\u7684 Focal Loss \u516c\u5f0f\uff1a"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-{math}",children:"{FL}(p) = -(1-p_t)^\\gamma\\log(p_t),p_t = \\begin{cases}\np, & {when} \\ y = 1 \\\\\n1 - p, & {when} \\ y = 0\n\\end{cases}\n"})}),"\n",(0,l.jsxs)(n.p,{children:["\u5176\u4e2d {math}",(0,l.jsx)(n.code,{children:"y\\in{1,0}"})," \u6307\u5b9a\u771f\u5b9e\u7c7b\uff0c{math}",(0,l.jsx)(n.code,{children:"p\\in[0,1]"})," \u8868\u793a\u6807\u7b7e {math}",(0,l.jsx)(n.code,{children:"y = 1"})," \u7684\u7c7b\u4f30\u8ba1\u6982\u7387\u3002{math}",(0,l.jsx)(n.code,{children:"\\gamma"})," \u662f\u53ef\u8c03\u805a\u7126\u53c2\u6570\u3002\u5177\u4f53\u6765\u8bf4\uff0cFL \u7531\u6807\u51c6\u4ea4\u53c9\u71b5\u90e8\u5206 {math}",(0,l.jsx)(n.code,{children:"-\\log(p_t)"})," \u548c\u52a8\u6001\u6bd4\u4f8b\u56e0\u5b50\u90e8\u5206 {math}",(0,l.jsx)(n.code,{children:"-(1-p_t)^\\gamma"})," \u7ec4\u6210\uff0c\u5176\u4e2d\u6bd4\u4f8b\u56e0\u5b50 {math}",(0,l.jsx)(n.code,{children:"-(1-p_t)^\\gamma"})," \u5728\u8bad\u7ec3\u671f\u95f4\u81ea\u52a8\u964d\u4f4e\u7b80\u5355\u7c7b\u5bf9\u4e8e loss \u7684\u6bd4\u91cd\uff0c\u5e76\u4e14\u8fc5\u901f\u5c06\u6a21\u578b\u96c6\u4e2d\u5728\u56f0\u96be\u7c7b\u4e0a\u3002"]}),"\n",(0,l.jsxs)(n.p,{children:["\u9996\u5148 {math}",(0,l.jsx)(n.code,{children:"y = 0"})," \u8868\u793a\u8d28\u91cf\u5f97\u5206\u4e3a 0 \u7684\u8d1f\u6837\u672c\uff0c{math}",(0,l.jsx)(n.code,{children:"0 < y \\leq 1"})," \u8868\u793a\u76ee\u6807 IoU \u5f97\u5206\u4e3a y \u7684\u6b63\u6837\u672c\u3002\u4e3a\u4e86\u9488\u5bf9\u8fde\u7eed\u7684\u6807\u7b7e\uff0c\u6269\u5c55 FL \u7684\u4e24\u4e2a\u90e8\u5206\uff1a"]}),"\n",(0,l.jsxs)(n.ol,{children:["\n",(0,l.jsxs)(n.li,{children:["\u4ea4\u53c9\u71b5\u90e8\u5206 {math}",(0,l.jsx)(n.code,{children:"-\\log(p_t)"})," \u6269\u5c55\u4e3a\u5b8c\u6574\u7248\u672c {math}",(0,l.jsx)(n.code,{children:"-((1-y)\\log(1-\\sigma)+y\\log(\\sigma))"})]}),"\n",(0,l.jsxs)(n.li,{children:["\u6bd4\u4f8b\u56e0\u5b50\u90e8\u5206 {math}",(0,l.jsx)(n.code,{children:"-(1-p_t)^\\gamma"})," \u88ab\u6cdb\u5316\u4e3a\u4f30\u8ba1 {math}",(0,l.jsx)(n.code,{children:"\\gamma"})," \u4e0e\u5176\u8fde\u7eed\u6807\u7b7e {math}",(0,l.jsx)(n.code,{children:"y"})," \u7684\u7edd\u5bf9\u8ddd\u79bb\uff0c\u5373 {math}",(0,l.jsx)(n.code,{children:"|y-\\sigma|^\\beta (\\beta \\geq 0)"})," \u3002"]}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:"\u7ed3\u5408\u4e0a\u9762\u4e24\u4e2a\u90e8\u5206\u4e4b\u540e\uff0c\u6211\u4eec\u5f97\u51fa QFL \u7684\u516c\u5f0f\uff1a"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-{math}",children:"{QFL}(\\sigma) = -|y-\\sigma|^\\beta((1-y)\\log(1-\\sigma)+y\\log(\\sigma))\n"})}),"\n",(0,l.jsxs)(n.p,{children:["\u5177\u4f53\u4f5c\u7528\u662f\uff1a\u53ef\u4ee5\u5c06\u79bb\u6563\u6807\u7b7e\u7684 ",(0,l.jsx)(n.code,{children:"focal loss"})," \u6cdb\u5316\u5230\u8fde\u7eed\u6807\u7b7e\u4e0a\uff0c\u5c06 bboxes \u4e0e gt \u7684 IoU \u7684\u4f5c\u4e3a\u5206\u7c7b\u5206\u6570\u7684\u6807\u7b7e\uff0c\u4f7f\u5f97\u5206\u7c7b\u5206\u6570\u4e3a\u8868\u5f81\u56de\u5f52\u8d28\u91cf\u7684\u5206\u6570\u3002"]}),"\n",(0,l.jsx)(n.p,{children:"MMDetection \u5b9e\u73b0\u6e90\u7801\u7684\u6838\u5fc3\u90e8\u5206\uff1a"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-python",children:'@weighted_loss\ndef quality_focal_loss(pred, target, beta=2.0):\n """\n pred (torch.Tensor): \u7528\u5f62\u72b6\uff08N\uff0cC\uff09\u8054\u5408\u8868\u793a\u9884\u6d4b\u5206\u7c7b\u548c\u8d28\u91cf\uff08IoU\uff09\uff0cC\u662f\u7c7b\u7684\u6570\u91cf\u3002\n target (tuple([torch.Tensor])): \u76ee\u6807\u7c7b\u522b\u6807\u7b7e\u7684\u5f62\u72b6\u4e3a\uff08N\uff0c\uff09\uff0c\u76ee\u6807\u8d28\u91cf\u6807\u7b7e\u7684\u5f62\u72b6\u662f\uff08N\uff0c\uff0c\uff09\u3002\n beta (float): \u8ba1\u7b97\u6bd4\u4f8b\u56e0\u5b50\u7684 \u03b2 \u53c2\u6570.\n """\n ...\n\n # label\u8868\u793a\u7c7b\u522bid\uff0cscore\u8868\u793a\u8d28\u91cf\u5206\u6570\n label, score = target\n\n # \u8d1f\u6837\u672c\u8d28\u91cf\u5206\u65700\u6765\u8fdb\u884c\u76d1\u7763\n pred_sigmoid = pred.sigmoid()\n scale_factor = pred_sigmoid\n zerolabel = scale_factor.new_zeros(pred.shape)\n\n # \u8ba1\u7b97\u4ea4\u53c9\u71b5\u90e8\u5206\u7684\u503c\n loss = F.binary_cross_entropy_with_logits(\n pred, zerolabel, reduction=\'none\') * scale_factor.pow(beta)\n\n # \u5f97\u51fa IoU \u5728\u533a\u95f4 (0,1] \u7684 bbox\n # FG cat_id: [0, num_classes -1], BG cat_id: num_classes\n bg_class_ind = pred.size(1)\n pos = ((label >= 0) & (label < bg_class_ind)).nonzero().squeeze(1)\n pos_label = label[pos].long()\n\n # \u6b63\u6837\u672c\u7531 IoU \u8303\u56f4\u5728 (0,1] \u7684 bbox \u6765\u76d1\u7763\n # \u8ba1\u7b97\u52a8\u6001\u6bd4\u4f8b\u56e0\u5b50\n scale_factor = score[pos] - pred_sigmoid[pos, pos_label]\n\n # \u8ba1\u7b97\u4e24\u90e8\u5206\u7684 loss\n loss[pos, pos_label] = F.binary_cross_entropy_with_logits(\n pred[pos, pos_label], score[pos],\n reduction=\'none\') * scale_factor.abs().pow(beta)\n\n # \u5f97\u51fa\u6700\u7ec8 loss\n loss = loss.sum(dim=1, keepdim=False)\n return loss\n'})}),"\n",(0,l.jsx)(n.h4,{id:"giouloss",children:"GIoULoss"}),"\n",(0,l.jsxs)(n.p,{children:["\u8bba\u6587\uff1a",(0,l.jsx)(n.a,{href:"https://arxiv.org/abs/1902.09630",children:"Generalized Intersection over Union: A Metric and A Loss for Bounding Box Regression"})]}),"\n",(0,l.jsx)(n.p,{children:"GIoU Loss \u7528\u4e8e\u8ba1\u7b97\u4e24\u4e2a\u6846\u91cd\u53e0\u533a\u57df\u7684\u5173\u7cfb\uff0c\u91cd\u53e0\u533a\u57df\u8d8a\u5927\uff0c\u635f\u5931\u8d8a\u5c0f\uff0c\u53cd\u4e4b\u8d8a\u5927\u3002\u800c\u4e14 GIoU \u662f\u5728 [0,2] \u4e4b\u95f4\uff0c\u56e0\u4e3a\u5176\u503c\u88ab\u9650\u5236\u5728\u4e86\u4e00\u4e2a\u8f83\u5c0f\u7684\u8303\u56f4\u5185\uff0c\u6240\u4ee5\u7f51\u7edc\u4e0d\u4f1a\u51fa\u73b0\u5267\u70c8\u7684\u6ce2\u52a8\uff0c\u8bc1\u660e\u4e86\u5176\u5177\u6709\u6bd4\u8f83\u597d\u7684\u7a33\u5b9a\u6027\u3002"}),"\n",(0,l.jsx)(n.p,{children:"\u4e0b\u56fe\u662f\u57fa\u672c\u7684\u5b9e\u73b0\u6d41\u7a0b\u56fe\uff1a"}),"\n",(0,l.jsxs)(n.div,{align:"center",children:["\n",(0,l.jsx)(n.img,{src:"https://user-images.githubusercontent.com/25873202/192568784-3884b677-d8e1-439c-8bd2-20943fcedd93.png",alt:"image"}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:"MMDetection \u5b9e\u73b0\u6e90\u7801\u7684\u6838\u5fc3\u90e8\u5206\uff1a"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-python",children:"def bbox_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False, eps=1e-6):\n ...\n\n # \u6c42\u4e24\u4e2a\u533a\u57df\u7684\u9762\u79ef\n area1 = (bboxes1[..., 2] - bboxes1[..., 0]) * (\n bboxes1[..., 3] - bboxes1[..., 1])\n area2 = (bboxes2[..., 2] - bboxes2[..., 0]) * (\n bboxes2[..., 3] - bboxes2[..., 1])\n\n if is_aligned:\n # \u5f97\u51fa\u4e24\u4e2a bbox \u91cd\u5408\u7684\u5de6\u4e0a\u89d2 lt \u548c\u53f3\u4e0b\u89d2 rb\n lt = torch.max(bboxes1[..., :2], bboxes2[..., :2]) # [B, rows, 2]\n rb = torch.min(bboxes1[..., 2:], bboxes2[..., 2:]) # [B, rows, 2]\n\n # \u6c42\u91cd\u5408\u9762\u79ef\n wh = fp16_clamp(rb - lt, min=0)\n overlap = wh[..., 0] * wh[..., 1]\n\n if mode in ['iou', 'giou']:\n ...\n else:\n union = area1\n if mode == 'giou':\n # \u5f97\u51fa\u4e24\u4e2a bbox \u6700\u5c0f\u51f8\u95ed\u5408\u6846\u7684\u5de6\u4e0a\u89d2 lt \u548c\u53f3\u4e0b\u89d2 rb\n enclosed_lt = torch.min(bboxes1[..., :2], bboxes2[..., :2])\n enclosed_rb = torch.max(bboxes1[..., 2:], bboxes2[..., 2:])\n else:\n ...\n\n # \u6c42\u91cd\u5408\u9762\u79ef / gt bbox \u9762\u79ef \u7684\u6bd4\u7387\uff0c\u5373 IoU\n eps = union.new_tensor([eps])\n union = torch.max(union, eps)\n ious = overlap / union\n\n ...\n\n # \u6c42\u6700\u5c0f\u51f8\u95ed\u5408\u6846\u9762\u79ef\n enclose_wh = fp16_clamp(enclosed_rb - enclosed_lt, min=0)\n enclose_area = enclose_wh[..., 0] * enclose_wh[..., 1]\n enclose_area = torch.max(enclose_area, eps)\n\n # \u8ba1\u7b97 giou\n gious = ious - (enclose_area - union) / enclose_area\n return gious\n\n@weighted_loss\ndef giou_loss(pred, target, eps=1e-7):\n gious = bbox_overlaps(pred, target, mode='giou', is_aligned=True, eps=eps)\n loss = 1 - gious\n return loss\n"})}),"\n",(0,l.jsx)(n.h3,{id:"15-\u4f18\u5316\u7b56\u7565\u548c\u8bad\u7ec3\u8fc7\u7a0b",children:"1.5 \u4f18\u5316\u7b56\u7565\u548c\u8bad\u7ec3\u8fc7\u7a0b"}),"\n",(0,l.jsxs)(n.div,{align:"center",children:["\n",(0,l.jsx)(n.img,{src:"https://user-images.githubusercontent.com/89863442/192943607-74952731-4eb7-45f5-b86d-2dad46732614.png",width:"800"}),"\n"]}),"\n",(0,l.jsx)(n.h3,{id:"16-\u63a8\u7406\u548c\u540e\u5904\u7406\u8fc7\u7a0b",children:"1.6 \u63a8\u7406\u548c\u540e\u5904\u7406\u8fc7\u7a0b"}),"\n",(0,l.jsxs)(n.div,{align:"center",children:["\n",(0,l.jsx)(n.img,{src:"https://user-images.githubusercontent.com/89863442/192943600-98c3a8f9-e42c-47ea-8e12-d20f686e9318.png",width:"800"}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"(1) \u7279\u5f81\u56fe\u8f93\u5165"})}),"\n",(0,l.jsxs)(n.p,{children:["\u9884\u6d4b\u7684\u56fe\u7247\u8f93\u5165\u5927\u5c0f\u4e3a 640 x 640, \u901a\u9053\u6570\u4e3a 3 ,\u7ecf\u8fc7 CSPNeXt, CSPNeXtPAFPN \u5c42\u7684 8 \u500d\u300116 \u500d\u300132 \u500d\u4e0b\u91c7\u6837\u5f97\u5230 80 x 80, 40 x 40, 20 x 20 \u4e09\u4e2a\u5c3a\u5bf8\u7684\u7279\u5f81\u56fe\u3002\u4ee5 rtmdet-l \u6a21\u578b\u4e3a\u4f8b\uff0c\u6b64\u65f6\u4e09\u5c42\u901a\u9053\u6570\u90fd\u4e3a 256\uff0c\u7ecf\u8fc7 ",(0,l.jsx)(n.code,{children:"bbox_head"})," \u5c42\u5f97\u5230\u4e24\u4e2a\u5206\u652f\uff0c\u5206\u522b\u4e3a ",(0,l.jsx)(n.code,{children:"rtm_cls"})," \u7c7b\u522b\u9884\u6d4b\u5206\u652f\uff0c\u5c06\u901a\u9053\u6570\u4ece 256 \u53d8\u4e3a 80\uff0c80 \u5bf9\u5e94\u6240\u6709\u7c7b\u522b\u6570\u91cf; ",(0,l.jsx)(n.code,{children:"rtm_reg"})," \u8fb9\u6846\u56de\u5f52\u5206\u652f\u5c06\u901a\u9053\u6570\u4ece 256 \u53d8\u4e3a 4\uff0c4 \u4ee3\u8868\u6846\u7684\u5750\u6807\u3002"]}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"(2) \u521d\u59cb\u5316\u7f51\u683c"})}),"\n",(0,l.jsx)(n.p,{children:"\u6839\u636e\u7279\u5f81\u56fe\u5c3a\u5bf8\u521d\u59cb\u5316\u4e09\u4e2a\u7f51\u683c\uff0c\u5927\u5c0f\u5206\u522b\u4e3a 6400 (80 x 80)\u30011600 (40 x 40)\u3001400 (20 x 20)\uff0c\u5982\u7b2c\u4e00\u4e2a\u5c42 shape \u4e3a torch.Size([ 6400, 2 ])\uff0c\u6700\u540e\u4e00\u4e2a\u7ef4\u5ea6\u662f 2\uff0c\u4e3a\u7f51\u683c\u70b9\u7684\u6a2a\u7eb5\u5750\u6807\uff0c\u800c 6400 \u8868\u793a\u5f53\u524d\u7279\u5f81\u5c42\u7684\u7f51\u683c\u70b9\u6570\u91cf\u3002"}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"(3) \u7ef4\u5ea6\u53d8\u6362"})}),"\n",(0,l.jsxs)(n.p,{children:["\u7ecf\u8fc7 ",(0,l.jsx)(n.code,{children:"_predict_by_feat_single"})," \u51fd\u6570\uff0c\u5c06\u4ece head \u63d0\u53d6\u7684\u5355\u4e00\u56fe\u50cf\u7684\u7279\u5f81\u8f6c\u6362\u4e3a bbox \u7ed3\u679c\u8f93\u5165\uff0c\u5f97\u5230\u4e09\u4e2a\u5217\u8868 ",(0,l.jsx)(n.code,{children:"cls_score_list"}),"\uff0c",(0,l.jsx)(n.code,{children:"bbox_pred_list"}),"\uff0c",(0,l.jsx)(n.code,{children:"mlvl_priors"}),"\uff0c\u8be6\u7ec6\u5927\u5c0f\u5982\u56fe\u6240\u793a\u3002\u4e4b\u540e\u5206\u522b\u904d\u5386\u4e09\u4e2a\u7279\u5f81\u5c42\uff0c\u5206\u522b\u5bf9 class \u7c7b\u522b\u9884\u6d4b\u5206\u652f\u3001bbox \u56de\u5f52\u5206\u652f\u8fdb\u884c\u5904\u7406\u3002\u4ee5\u7b2c\u4e00\u5c42\u4e3a\u4f8b\uff0c\u5bf9 bbox \u9884\u6d4b\u5206\u652f [ 4\uff0c80\uff0c80 ] \u7ef4\u5ea6\u53d8\u6362\u4e3a [ 6400\uff0c4 ]\uff0c\u5bf9\u7c7b\u522b\u9884\u6d4b\u5206\u652f [ 80\uff0c80\uff0c80 ] \u53d8\u5316\u4e3a [ 6400\uff0c80 ]\uff0c\u5e76\u5bf9\u5176\u505a\u5f52\u4e00\u5316\uff0c\u786e\u4fdd\u7c7b\u522b\u7f6e\u4fe1\u5ea6\u5728 0 - 1 \u4e4b\u95f4\u3002"]}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"(4) \u9608\u503c\u8fc7\u6ee4"})}),"\n",(0,l.jsxs)(n.p,{children:["\u5148\u4f7f\u7528\u4e00\u4e2a ",(0,l.jsx)(n.code,{children:"nms_pre"})," \u64cd\u4f5c\uff0c\u5148\u8fc7\u6ee4\u5927\u90e8\u5206\u7f6e\u4fe1\u5ea6\u6bd4\u8f83\u4f4e\u7684\u9884\u6d4b\u7ed3\u679c\uff08\u6bd4\u5982 ",(0,l.jsx)(n.code,{children:"score_thr"})," \u9608\u503c\u8bbe\u7f6e\u4e3a 0.05\uff0c\u5219\u53bb\u9664\u5f53\u524d\u9884\u6d4b\u7f6e\u4fe1\u5ea6\u4f4e\u4e8e 0.05 \u7684\u7ed3\u679c\uff09\uff0c\u7136\u540e\u5f97\u5230 bbox \u5750\u6807\u3001\u6240\u5728\u7f51\u683c\u7684\u5750\u6807\u3001\u7f6e\u4fe1\u5ea6\u3001\u6807\u7b7e\u7684\u4fe1\u606f\u3002\u7ecf\u8fc7\u4e09\u4e2a\u7279\u5f81\u5c42\u904d\u5386\u4e4b\u540e\uff0c\u5206\u522b\u6574\u5408\u8fd9\u4e09\u4e2a\u5c42\u5f97\u5230\u7684\u7684\u56db\u4e2a\u4fe1\u606f\u653e\u5165 results \u5217\u8868\u4e2d\u3002"]}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"(5) \u8fd8\u539f\u5230\u539f\u56fe\u5c3a\u5ea6"})}),"\n",(0,l.jsx)(n.p,{children:"\u6700\u540e\u5c06\u7f51\u7edc\u7684\u9884\u6d4b\u7ed3\u679c\u6620\u5c04\u5230\u6574\u56fe\u5f53\u4e2d\uff0c\u5f97\u5230 bbox \u5728\u6574\u56fe\u4e2d\u7684\u5750\u6807\u503c"}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"(6) NMS"})}),"\n",(0,l.jsx)(n.p,{children:"\u8fdb\u884c nms \u64cd\u4f5c\uff0c\u6700\u7ec8\u9884\u6d4b\u5f97\u5230\u7684\u8fd4\u56de\u503c\u4e3a\u7ecf\u8fc7\u540e\u5904\u7406\u7684\u6bcf\u5f20\u56fe\u7247\u7684\u68c0\u6d4b\u7ed3\u679c\uff0c\u5305\u542b\u5206\u7c7b\u7f6e\u4fe1\u5ea6\uff0c\u6846\u7684 labels\uff0c\u6846\u7684\u56db\u4e2a\u5750\u6807"}),"\n",(0,l.jsx)(n.h2,{id:"2-\u603b\u7ed3",children:"2 \u603b\u7ed3"}),"\n",(0,l.jsx)(n.p,{children:"\u672c\u6587\u5bf9 RTMDet \u539f\u7406\u548c\u5728 MMYOLO \u5b9e\u73b0\u8fdb\u884c\u4e86\u8be6\u7ec6\u89e3\u6790\uff0c\u5e0c\u671b\u80fd\u5e2e\u52a9\u7528\u6237\u7406\u89e3\u7b97\u6cd5\u5b9e\u73b0\u8fc7\u7a0b\u3002\u540c\u65f6\u8bf7\u6ce8\u610f\uff1a\u7531\u4e8e RTMDet \u672c\u8eab\u4e5f\u5728\u4e0d\u65ad\u66f4\u65b0\uff0c\n\u672c\u5f00\u6e90\u5e93\u4e5f\u4f1a\u4e0d\u65ad\u8fed\u4ee3\uff0c\u8bf7\u53ca\u65f6\u9605\u8bfb\u548c\u540c\u6b65\u6700\u65b0\u7248\u672c\u3002"})]})}function x(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(o,{...e})}):o(e)}}}]);