본문 바로가기

ML/딥러닝

CenterNet2 리뷰

CenterNet2 리뷰

서론

1학기에 진행하였던 CenterNet2 객체 인식 모델을 연구하는데 있어 모든 기존 팀원이 기가차팀으로 이동하였고, 새로 들어온 팀원도 쉽게 따라올 수 있도록 그리고 추가적으로 본인도 연구에 미흡했었기에 이 점을 보완하고자 1학기 centernet2 연구를 복기해보고자 한다.

CenterNet2 특징

먼저 1-stage detector와 2-stage detector의 차이를 알아보자. 1-stage detector는 region proposal과 classification이 동시에 이루어지기 때문에 빠르지만 정확도가 떨어진다. 2-stage detector는 region proposal을 먼저 수행하고 그 해당 영역에 대해서만 classification을 수행한다. 따라서 속도는 느리지만 정확도가 더 높다.

여기서 region proposal은 객체가 있을 만한 영역을 탐지해내는 것이고, classification은 그 객체가 있을 만한 영역에서 그 객체가 무엇인지 분류하는 것이다.

CenterNet2는 1-stage detector의 장점과 2-stage detector의 장점을 합친 probabilistic 2-stage detector이다. 1-stage detector를 RPN(region proposal network)만으로 사용하여 class-agnostic(객체가 무엇인지 구분하지 않은 상태로)한 region proposal을 생성한 후에 region proposal을 분류하는 detection head를 추가하여 two-stage detector로 이용한다. 1-stage detector에서의 region proposals(H * W)와 2-stage detector에서의 region proposals(K), 그리고 probabilistic 2-stage detector(K')의 region proposals 를 비교하면 K'이 가장 적다.

이는 recall을 최대화 하는 2-stage detector의 RPN보다 likelihood를 최대화하는 1-stage detector를 RPN으로 사용하는 것이 ROI를 적게 생성하여 더 좋은 결과를 이끌어낸다.

2-stage detector의 region proposal이 recall을 최대화 하는 이유는 먼저 region proposal을 하고 classification을 하기 때문에 일단 최대한 많은 ROI를 얻어와야 정확도가 높아지기 때문이다.

1-stage detector의 region proposal은 classification과 동시에 이루어지기 때문에 최대한 ground truth값과 일치하도록 ROI를 얻어와야 하기 때문이다.

CenterNet2를 보기 전 선행적으로 알아둬야 할 Detectron2

CenterNet2는 detectron2 기반으로 개발되었기 때문에 먼저 detectron2에 대해서 알 필요가 있다.

Detectron2는 페이스북 AI 리서치 팀에서 개발한 객체 인식 모델로, Mask R-CNN을 기준으로 개발되었기 때문에 Bounding Box와 Segmentation 모두 제공한다. 이 때문에 학습할 시 YOLO와는 다르게 segmentation 된 정보가 있어야 학습을 할 수 있다.

따라서 Bounding Box 정보만 있는 dataset이 있다면 새롭게 annotation을 해줘야 할 수도 있다.... so sad..

먼저 detectron2를 설치하고 CONE custom dataset을 가지고 학습하여 테스트 해보자.

(페이지 곧 생성할듯.)

위 페이지에서 자세한 Detectron2를 Colab 환경에서 설치부터 custom dataset의 학습, 테스트까지 진행해보았다.

이제 본격적으로 CenterNet2에 대해 진행하자.

CenterNet2

참고문헌

Zhou, Xingyi, Vladlen Koltun, and Philipp Krähenbühl. "Probabilistic two-stage detection." arXiv preprint arXiv:2103.07461 (2021).

https://github.com/xingyizhou/CenterNet2

https://github.com/facebookresearch/detectron2