본문 바로가기

Data-science/deep learning

Detection using deep learning study

반응형

  • Object Detection: Identify the object category and locate the position using a bounding box for every known object within an image.
  • Semantic Segmentation: Identify the object category of each pixel for every known object within an image. Labels are class-aware.
  • Instance Segmentation: Identify each object instance of each pixel for every known object within an image. Labels are instance-aware.


차례대로 detection/semantic segmentation/instance segmentation


ref) https://mc.ai/review-sharpmask-instance-segmentation/

ref2) https://www.slideshare.net/TaeohKim4/pr057-mask-rcnn?from_action=save

semantic segmentation은 pixel level의 classification이지만, instance segmentation은 instance level의 classification이다. 



mask r-cnn ?

1. Mask Head on Faster R-CNN

-> Faster R-CNN에서 detect한 각각의 box에 mask를 씌워주는 모델

(Faster R-CNN에 mask를 predict해주는 부분을 추가해준 것.)

- 기존 Faster R-CNN을 Object Detection 역할 하도록 함

- mask : 물체가 bounding box내에 있는 지 나타내 주는 이진화된 mask

 -> 추가적인 mask output은 앞단의 class,box output과는 구분되고, 좀 더 세밀한 공간상의 정보가 포함되어야 하므로 FCN을 이용해서 이 정보를 추출한다.

 - FCN : conv, max-pooling으로 1/32만큼 압축한 후, class를 predict하고 deconv layer로 다시 upsampling 하여 원래 이미지 크기로 리사이징한다.



- 각각의 ROI에 mask segmentation을 해주는 작은 FCN(Fully convolutional network)을 추가

기존 FCN은 Multi instance에서 Per Pixel Softmax 를 적용했지만 Mask R-CNN에서는 Faster R-CNN에서 발생시킨 instance level의 roi에만 적용하면 되므로 하나의 instance에 대해 Sigmoid(Binary)를 적용할 수 있다.

즉, mask prediction과 class prediction이 분리 됨.

- binary mask (sigmoid)의 성능 > multinomial mask (softmax)의 성능 

- Mask branch는 독립적인 class에 어떻게 mask할 지만을 배움



2. Fully Convolutional Mask 표현


Invariance vs Equivariance

- Equivariance : 입력이 변하면 출력도 변한다.

- classification : invariant한 표현를 원함 (label 산출을 위해)

- Instance segmentation : equivariant한 표현을 원함

- translated object -> translated mask

- scaled object -> scaled mask

- 물체가 크든 작든 모두 똑같이 중요함

semantic segmentation은 pixel을 세는 것이기 때문에 이 점에선 다름


- Convolutions : translation-equivariant

- FCN is translation-equivariant

Convnet은 fully-connected나 global pool layer로 인해서 translation-invariant하게 된다.


1. Fully-Conv Features

- equivariant to global (image) translation

2. Fully-Conv on ROI:

- equivariant to translation within ROI


3. ROI-Align

- ROI pooling은 ROI가 소수점 좌표를 갖고 있을 경우 각 좌표를 반올림 한 다음에 Pooling을 해준다. -> 원본 위치 정보가 왜곡되기 때문에 pixel-by-pixel로 classification하는 segmentation에 문제가 발생 -> ROI Align을 사용

- ROI-pooling과 ROI-Align 모두 input은 각 ROI, output은 7x7 pooled Feature, 7x7은 segment하기엔 너무 작아서 정확한 pooled feature가 필요하다. (그냥 반올림 Max Pooling -> 2x2 Subcell Max Pooling)

- ROI-Align Paste Back

Align된 ROI를 다시 앞단에 붙여넣기한다?



4. Network Architecture

- Faster R-CNN + Resnet -> Faster R-CNN + FPN(Feature Pyramid Networks)


Mask R-CNN : Faster R-CNN + binary Mask Prediction + FCN + ROIAlign


 





ref) https://www.slideshare.net/TaeohKim4/pr057-mask-rcnn?from_action=save

https://cdm98.tistory.com/33

https://www.analyticsvidhya.com/blog/2018/07/building-mask-r-cnn-model-detecting-damage-cars-python/

https://www.youtube.com/watch?v=UdZnhZrM2vQ&t=111s

https://engineering.matterport.com/splash-of-color-instance-segmentation-with-mask-r-cnn-and-tensorflow-7c761e238b46

https://people.eecs.berkeley.edu/~jonlong/long_shelhamer_fcn.pdf

반응형