결론:
모바일넷obileNet)과 같은 CNN 계열 모델에서는 특정 소수 클래스(예: 햄버거)만 과도하게 재학습시킬 경우 해당 클래스의 재현율(recall)은 높아지지만, 전체 모델의 균형 있는 일반화 성능은 저하될 수 있다. 즉, 소수 클래스 성능 향상과 다수 클래스(또는 다른 클래스) 성능 저하 사이에 트레이드오프가 존재하므로, 단일 클래스만 무작정 오버샘플링하는 것은 권장되지 않는다.
1. 단일 클래스 오버샘플링의 효과
- 소수 클래스 성능 향상
- 소수 샘플(햄버거 이미지)을 다량으로 추가하면 해당 클래스에 대한 특징 표현이 풍부해져 재현율(recall) 및 F1-score가 유의미하게 개선된다1.
- 다수 클래스 및 전체 성능 저하
- 반면, 전체 데이터 분포가 더욱 왜곡되면서 다수 클래스(예: 햄버거 외의 모든 음식) 성능이 떨어지고, 전체 정확도(accuracy) 및 ROC AUC와 같은 지표가 하락하는 경향이 있다1.
- 과도한 오버샘플링으로 인한 모델의 편향(bias)이 발생하여, 오버샘플된 클래스에 지나치게 특화된 결정을 내리고 다른 클래스의 구분력이 저하될 수 있다.
2. CNN에서 오버샘플링의 일반적 권장 방안
- 전체 소수 클래스(모든 under-represented 클래스)를 균등하게 오버샘플링하여 클래스 간 불균형을 완전히 해소하는 것이 다중 클래스 ROC AUC 측면에서 최적 성능을 보인다2.
- 특정 클래스만 선택적으로 오버샘플링할 경우, 오히려 전체 성능이 저하될 수 있으므로 주의가 필요하다2.
- 다수 클래스 성능 저하를 막으려면,
3. 대안 및 권장 전략
- 클래스 가중치(Class Weight)
- 로스(loss)에 햄버거 클래스의 비중을 높여 소수 클래스도 충분히 학습되도록 하면서, 데이터 분포 자체는 건드리지 않는다.
- 과도한 오버샘플링 없이도 소수 클래스 성능 향상을 꾀할 수 있다.
- 소수 클래스 대상 데이터 증강(Targeted Augmentation)
- GAN, Mixup, CutMix 등 생성적 기법을 활용해 햄버거 이미지를 다양화하되 원본 분포를 왜곡하지 않는다4.
- 이는 모델이 소수 클래스의 다양한 변형을 학습하도록 돕는다.
- 전체 불균형 해소(Oversampling All Minorities)
- 햄버거뿐 아니라 소수인 모든 음식 클래스를 대상으 로 오버샘플링해 클래스 간 균형을 맞춘다2.
- 이렇게 하면 특정 클래스만 편향되는 현상을 막을 수 있다.
요약:
특정 클래스(햄버거)만 대량으로 학습시키면, 해당 클래스에 대해서는 성능이 올라가지만 모델 전반의 균형 있는 성능이 떨어진다. 따라서 소수 클래스만 단독 오버샘플링하기보다는, 클래스 가중치 조정이나 targeted augmentation, 또는 모든 소수 클래스에 대한 균등 오버샘플링 전략을 병행하는 것이 좋다.
1 Augmentation strategies for an imbalanced learning problem on a medical dataset (Class-specific augmentations improve minority recall but degrade majority performance)
3 CNN – imbalanced classes, class weights vs data augmentation (StackExchange)
2 Buda et al., “A systematic study of the class imbalance problem in convolutional neural networks,” Neural Networks, 2018.
- https://www.nature.com/articles/s41598-023-45532-2
- https://pubmed.ncbi.nlm.nih.gov/30092410/
- https://datascience.stackexchange.com/questions/47423/cnn-imbalanced-classes-class-weights-vs-data-augmentation
- https://arxiv.org/pdf/2207.06080.pdf
- https://pmc.ncbi.nlm.nih.gov/articles/PMC4929860/
- https://arxiv.org/html/2502.06878v1
- https://arxiv.org/html/2409.16223v1
- https://www.tensorflow.org/tutorials/structured_data/imbalanced_data
- https://machinelearningmastery.com/random-oversampling-and-undersampling-for-imbalanced-classification/
- https://openreview.net/pdf?id=BJxpbREKvB
- https://www.sciencedirect.com/science/article/abs/pii/S095219762200611X
- http://www.arxiv.org/pdf/2502.06878.pdf
- https://arxiv.org/pdf/2102.03983.pdf
- http://arxiv.org/pdf/1711.00837.pdf
- https://arxiv.org/pdf/1704.07515.pdf
- https://aaai.org/papers/09594-partial-is-better-than-all-revisiting-fine-tuning-strategy-for-few-shot-learning/
- https://imbalanced-learn.org/stable/over_sampling.html
- https://ar5iv.labs.arxiv.org/html/2202.03579
- https://stats.stackexchange.com/questions/402493/how-to-tune-the-hyperparameters-for-oneclass-svm-while-doing-unsupervised-learni
- https://stackoverflow.com/questions/65741222/is-it-possible-to-oversample-just-one-class-out-of-13
- https://arxiv.org/abs/2502.06878
- https://aclanthology.org/2024.findings-eacl.157/
- https://academic.oup.com/jcde/advance-article/doi/10.1093/jcde/qwaf068/8211044?searchresult=1
- https://www.sciencedirect.com/science/article/abs/pii/S1568494624014510
- http://www.diva-portal.org/smash/get/diva2:811111/FULLTEXT01.pdf%EF%BC%89
- https://arxiv.org/html/2402.13016v1
- https://arxiv.org/abs/2209.00653
- https://stats.stackexchange.com/questions/361173/data-augmentation-or-weighted-loss-function-for-imbalanced-classes
- https://openreview.net/pdf?id=CPDtGLmXEfy
- https://www.sciencedirect.com/science/article/pii/S1877750322000412
- https://proceedings.neurips.cc/paper_files/paper/2023/file/6ea69f8116b7c01e3c3e43b62e6868fc-Paper-Conference.pdf
- https://www.sciencedirect.com/science/article/abs/pii/S0893608018302107
- https://arxiv.org/abs/2207.06080
- https://openaccess.thecvf.com/content/CVPR2022/papers/Yu_A_Re-Balancing_Strategy_for_Class-Imbalanced_Classification_Based_on_Instance_Difficulty_CVPR_2022_paper.pdf
- http://arxiv.org/pdf/1710.05381.pdf
- https://www.themoonlight.io/en/review/understanding-the-effects-of-language-specific-class-imbalance-in-multilingual-fine-tuning
- https://www.sciencedirect.com/science/article/abs/pii/S0010482520301177
- https://www.newline.co/@zaoyang/fine-tuning-llms-on-imbalanced-customer-support-data–e3301065
- https://pmc.ncbi.nlm.nih.gov/articles/PMC11109211/
답글 남기기