# Overcoming Classifier Imbalance for Long-tail Object Detectionwith Balanced Group Softmax 作者:Yu Li, Tao Wang, Bingyi Kang, Sheng Tang, Chunfeng Wang, Jintao Li, Jiashi Feng 論文連結:https://openaccess.thecvf.com/content_CVPR_2020/papers/Li_Overcoming_Classifier_Imbalance_for_Long-Tail_Object_Detection_With_Balanced_Group_CVPR_2020_paper.pdf 整理by: [chewei](https://hackmd.io/@WTuIbJANSB26DiAX-WL4Sg) - - - - - ## 前言:Long-tail問題 在真實世界中常常有些類別的資料集數量是較少的,然而這個較少的類別常常在訓練模型導致一些"Imbalance"的問題,使得訓練結果變差,因此作者想出一個方法:`Balanced Group Softmax`來解決這個問題 ## 1.Balanced Group Softmax(BAGS)簡介 * 把數量相近的class分別框出來,各自作softmax,cross-entropy loss $\rightarrow$ 然而直接這樣做會導致過低多樣性的negative sample,進而導致`False Positives`過高 * 因此BAGS會再而外對每組類增加`others`及`background`的分類 * 實驗表示此方法會在LVIS增加9% – 19%的performance > LVIS爲Long-tail的dataset > 實驗在Faster R-CNN,Cascade R-CNN,Mask R-CNN,ResNet-50-FPN,ResNeXt-101-x64x4d-FPN實行 ![image](https://hackmd.io/_uploads/ry0d3yRAp.png) ![image](https://hackmd.io/_uploads/B1IoeKYyR.png) ## 2.探討long-tail原因及先前研究 ### 分析1:weight norms跟實際訓練的次數(training instances) >we decouple the detection framework into proposal feature extraction stage and proposal classification stage ![image](https://hackmd.io/_uploads/HkcBubiC6.png) * 由上圖可發現,在COCO和LVIS訓練中可發現:weight norms和實際訓練的次數(training instances)是高度正相關的 ### 分析2:討論為什麼weight norms跟實際訓練的次數會相關 >Why would the classifier weights be correlated to the number of training instances per-class? * 由於class較多的類別訓練次數遠多於class較少的類別,class較少的類別的分類,導致訓練後的"weight norms"不平衡 :::success 由以上1.2.就可以得知為什麼"re-sampling method"和"loss re-weighting methods"可以對Long-tail任務有益了 $\rightarrow$他們增加取少樣本的頻率使得"weights"不會與其他類別相差過多 $\rightarrow$然而這些方法雖然好但是容易對低樣本類別overfitting ::: ## 3.Balanced Group Softmax(BAGS)方法 * 由於在先前研究得知一個重要資訊:`"weight norms"跟"training example"正相關` * 因此作者決定將training example數量相當的分組執行"softmax",就可以避免掉2.所提到的問題 $$ s^l_n\le N(j)\lt s^h_n,\,\,n\gt 0 $$ ##### 依據此公式: 1. 總共C個類別類分成N groups 2. N(j)為類別j的bounding boxes的ground-truth 3. $s^l_n及s^h_n$是最小及最大的類別數量(超參數), $l$表示low, $h$表示high 4. 在這裡作者把$s^l_{n+1}訂為s_n^h$ :::info e.g. N=4,代表將總類別數C類分成4類,那麼$s^l_1=0,s^l_2=10,s^l_3=10^2,s^l_4=+\infty$ ::: * 此外作者說要手動讓group 0只包含background這個類別,理由是background可能比其他類別多出10-100倍 * 對於group 0 使用sigmoid cross entropy loss(因為他只有兩類:"是背景","不是背景"要分) * 對於group 1-n用softmax cross entropy loss(至於使用softmax的原因是他比較不會產生大量的false positives) ## 4.Balanced Group Softmax(BAGS)在Test時遇到的問題與校正 ### 問題::question: :::warning 作者發現在Testing時,當模型在預測一個未知的類別時,他會得到"每個"group做softmax出來的高的質,舉例來說分4類就會得到5(4+background)個預測結果,但模型不知道哪個才是對的! ::: ### 解決方法: :::success * 對每個group增加others這個類別,而對於group 0 others就是前景的意思。 * 而具體來講,作者加入$\beta$這個超參數去調整others要是group中一般類別數量的幾倍。 * 經過消融實驗後,作者認為$\beta=8$是個好數字:+1: ::: ## 5.Experiments ### 跟別人比準確率(使用同model) * 結論:主要是$ACC_1$tail部分有顯著提升 ![image](https://hackmd.io/_uploads/Bk5opJRAT.png) ### 用不同模型增加準確率 ![image](https://hackmd.io/_uploads/rJKx0JART.png) ### 跟SOTA比準確率 ![image](https://hackmd.io/_uploads/HyIuAyCAa.png) ### 比較有沒有加b(Background),o(others),以及N(分成幾類) * 結論:分4類且有用Background,others最好 ![image](https://hackmd.io/_uploads/SJ-AC1CA6.png) ### 比較$\beta$大小 * 結論:用8最好 ![image](https://hackmd.io/_uploads/HkqzylCRp.png) # Reference [1] Faster R-CNN