학부연구생/Papers

논문 리뷰 | Masked Autoencoders for Point Cloud Self-supervised Learning

noweahct 2024. 12. 25. 16:02

리뷰 날짜: 2024.09.24

March 2022
Yatian Pang, Wenxiao Wang, Francis E.H. Tay, Wei Liu, Yonghong Tian, Li Yuan
https://arxiv.org/abs/2203.06604
https://github.com/Pang-Yatian/Point-MAE

Prerequisite

Point Cloud

  • 3차원 공간에 퍼져있는 여러 point의 집합
  • 3D 모델을 구성하는 기본 단위
  • sparse한 성질을 가짐 -> data의 크기에 비해 얻을 수 있는 정보가 적음

Self-supervised Learning

  • unlabeled data에서 latent feature를 학습하는 방식
  • data 자체에서 supervision label을 생성하고, 모델이 data의 일부를 다른 부분으로부터 예측함
  • labeled data에 덜 의존하기 때문에, NLP와 CV에서 상당한 발전을 이룸
  • Point Cloud에서의 SSL
    • DepthContrast: input point cloud의 2가지 augmented version에 대해 instacnce 구별 작업을 설정함
    • OcCO: 카메라 뷰에서 가려진 point cloud를 복원하려고 시도
    • IAE: augmented된 입력으로부터 implicit feature를 reconstruction하기 위해 autoencoder 사용
    • Point-BERT: mask된 input token을 예측하는 BERT식으로, dVAE의 도움을 받음

Autoencoders

  • 입력이 들어왔을 때, 해당 입력 데이터를 최대한 압축시킨 후, 데이터의 특징을 추출하여 다시 본래의 입력 형태로 복원시키는 신경망
  • encoder, decoder로 구성됨
  • encoder: input을 high-level의 latent feature로 encoding
  • decoder: latent feature를 decoding해서 input을 reconstruction
  • 논문에서 사용한 방법: denoising autoencoder
    input layer에서 hidden layer로 갈 때, input noise를 넣어서 모델을 더 robust하게 하는 것

Ablation Study

  • machine learning system의 building blocks을 제거해서 전체 성능에 미치는 효과에 대한 insight를 얻기 위한 과학적 실험
  • building blocks: dataset의 feature 또는 model components
  • Ablation Study가 필요한 경우
    • 복잡한 모델 구조를 사용하는 경우: 어떤 요소가 성능에 가장 큰 영향을 미치는지 불분명할 때
    • 많은 hyperparameter 사용하는 경우: 모델 성능에 영향을 미치는 핵심적인 hyperparameter 가 무엇인지 알기 어려울 때
    • 기존 연구와 다른 접근법을 사용하는 경우: 새로운 접근법이 기존 연구와 어떤 점이 다르고 성능에 어떤 영향을 미치는지 파악하기 위해

Positional Embedding

    • transformer 구조 내 핵심 기능 중 하나
      • 초창기에는 token에 position 정보를 넣어주기 위해 sinusoidal function을 이용한 positional encoding을 사용했음
      • 이제는 learnable 형태로 넣는 positional embedding이 더 효과적이라는 것이 밝혀짐 - 학습 데이터를 기반으로 모델이 적응할 수 있어 더 유연하기 때문
    • positional embedding이 필요한 이유
      • Multi-Layer Perceptron으로 시작하기 때문에 문장의 단어들을 transformer network에 넣어줄 때 feature가 서로 섞이게 됨
      • 같은 단어로 구성된 문장이 여러 개 있을 때 feature 상에서 이에 대한 구분력이 낮아지게 됨
      • e.g., “The cat chased the dog”, “The dog chased the cat”
      • position이 다르다는 것을 network에게 인지시키는 과정이 필요함

Positional Embedding 종류

1. Absolute Position Embedding

    • 절대적으로 문장 내의 순서를 표현하는 feature 하나를 정의한 후, 이를 input feature에 더해주는 방식
    • sinusoidal function으로 만드는 positional encoding도 position embedding에 속한다고 볼 수 있음
    • Maximum Sequence length를 고정해놓고 해당 개수 만큼의 trainable vector set으로 정의하여 모델 pretrain 시 같이 학습함
    • 단점
      • 절대적 순서를 feature로 표현하기 때문에 문장의 최대 길이(Maximum Sequence length)를 알아야 하고, 이 범위를 넘으면 정의되지 않은 값이라서 대응할 수 없음
      • positional embedding끼리 independent하고, 상대적인 거리를 가늠할 수 없음

2. Relative Position Embedding

    • 문장 길이에 제한을 받지 않도록 하는 방식
    • 절대적 위치가 아니라 단어의 pair 단위로 상대 거리를 embedding
    • 단점: 연산량이 많고 속도가 느림

3. Roatary Position Embedding

    • APE와 RPE를 합쳐서 보완한 버전
    • 단어 feature를 회전시키는 방식으로 positional information을 부여

Permutation Invariance

    • input data의 순서를 변경하더라도, output이 동일하게 유지되는 성질
    • point cloud는 순서가 중요하지 않은 데이터이므로, 이 성질을 따라야 함

Max Pooling

    • 합성곱 연산을 통해 추출된 feature map의 feature map을 만드는 것
    • pooling 할 값에 따라 max/minimum/average pooling이라고 함

PointNet

  • Point Cloud 데이터를 처리하며, permutation invariance를 구현하기 위해 max pooling을 사용하는 모델
  • MLP는 각 point를 independent하게 처리해서 순서를 고려하지 않고, max pooling은 point set을 permutation invariance를 만족하도록 요약

Chamfer Distance

    • 서로 다른 Point Cloud 2개가 존재할 때, 둘의 차이를 측정하는 방법
    • Point Cloud S1과 S2가 주어졌을 때,
      • 1. S1의 각 point에 대해서, S2에서 가장 가까운 point와의 거리를 L2 loss로 계산하고, S1 개수로 나눠준다
      • 2. S2의 각 point에 대해서, S1에서 가장 가까운 point와의 거리를 L2 loss로 계산하고, S2 개수로 나눠준다
      • 3. 두 값을 더한다

mIoU

    • IoU(Intersection over Union)(Mean Intersection over Union): 교집합 / 합집합

    • mIoU (Mean Intersection over Union): 여러 개의 IoU 값들의 평균

1. Ground Truth Matrix와 Segmentation Prediction Matrix가 있을 때, 각 클래스 별 빈도수를 구하고, 각 Matrix를 1D vector로 변환한다

2. (클래스 개수) * GT 값 + P값을 계산한다

    • e.g.,
      • GT = 0, P = 0 일 때 C = 5 * 0 + 0 = 0  
      • GT = 1, P = 0 일 때 C = 5 * 1 + 0 = 5
      • GT = 1, P = 2 일 때 C = 5 * 1 + 2 = 7  
      • GT = 2, P = 2 일 때 C = 5 * 2 + 2 = 12

3. matrix C 원소 값의 빈도수를 나타내는 category matrix를 구한다

 

4. category matrix를 정사각 행렬로 변환해서 Confusion Matrix를 생성한다

    • 대각행렬은 GT와 P가 일치하는 부분이 된다

5. 대각행렬 원소를 탐색하며 IoU를 계산하고, IoU의 평균을 구한다

=> MIoU = (0 + 2/7 + 3/8 + 3/5 + 1) / 5 =  약 0.4521

Masked Autoencoder

    • random하게 input data의 일부를 mask하고, explicit features (e.g., pixels)나 implicit features (e.g., discrete tokens)를 reconstruction하기 위해 autoencoder를 사용함 (corresponding to the original masked content)
    • mask된 부분은 data information을 제공하지 않기 때문에, reconstruction task는 autoencoder가 high-level latent features를 mask되지 않은 부분으로부터 학습할 수 있도록 함
    • Transformers architectures를 사용하는 자신의 autoencoder의 backbone에 credit을 줌
    • e.g., BERT, MAE 모두 masked autoencoding과 standard Transformer Architecture를 autoencoder의 backbone으로 사용함

  • data의 일부분을 mask함
  • mask된 부분을 reconstruction 하려고 input data를 학습함
  • autoencoder의 encoder는 high-level latent features를 mask되지 않은 부분으로부터 학습함

Transformer

  • input의 global dependencies를 self-attention mechanism으로 모델링함
    • global dependency: input sequence 내의 모든 요소들이 서로의 관계를 반영하여 학습되는 것
    • self-attention mechanism: input sequence의 각 요소가 다른 요소들과의 연관성을 학습해서, 더 효율적인 표현을 만드는 기법
  • PCT (Point Cloud Transformer): Transformer layer에서 self-attention mechanism을 조절해서 Point Cloud 같은 3D data의 특성을 잘 반영할 수 있도록 조절
  • 논문에서는 standard Transformer에 기반한 architecture를 사용함

Abstract

  • Masked Autoencoders for Point Cloud Self-supervised Learning
  • 목적: location information leakage와 uneven information density를 포함한 point cloud의 문제를 해결하기 위함
  • input point cloud를 irregular point patches로 나눔 → high ratio로 randomly mask함 → asymmetric design과 shifting mask tokens operation을 사용하는 standard transformer를 기반으로 한 autoencoder를 통해 unmasked point patches에서 high-level latent features를 학습함
  • 실험을 통해 이 방법이 pre-training에서 효율적이고, 다양한 downstream tasks에서 좋은 성능을 보여주는 것을 확인함
  • 특히 pre-trained model은 ScanObjectNN에서 85.18%, ModelNet40에서 94.04%의 정확도를 달성함 (다른 self-supervised learning methods보다 뛰어남)
  • 이 방식을 쓰면 단순 구조의 standard transformer가 supervised learning로 설계된 dedicated(전용?) transformer model보다 뛰어남
  • 언어와 이미지에 사용되는 unified architecture를 point cloud에 적용할 수 있음을 시사함

 

Introduction

  • Masked Autoencoder for point cloud self-supervised learning
  • Masked autoencoding을 point cloud self-supervised learning에 적용할 수 있음
  • point cloud는 본질적으로 공통된 property를 language와 image 모두와 공유하기 때문
  • point subsets을 token으로 embedding하고, point cloud는 언어, 이미지와 유사하게 처리할 수 있음
  • point cloud의 datasets은 상대적으로 작기 때문에, self-supervised learning으로써 masked autoencoding은 Transformer architecture의 large data 요구를 해결할 수 있음
  • Point-BERT가 masked autoencoding과 비슷한 scheme을 시도했음; point cloud의 input tokens를 mask하고, mask된 tokens의 discrete tokens를 예측하기 위해 Transformer architecture를 사용한 BERT-style의 pretraining 전략
  • input의 mask된 token이 pre-training 과정에서 Transformer의 input으로 처리되면서, location information의 이른 leakage가 발생하고 많은 computing resources들이 소모됨

Main 3 challenges

1.  통합된 Transformer Architecture의 부재

  • 잠재적인 통합 architecture로 사용할 수 있는 standard transformer만으로 autoencoder의 backbone을 구축하는 게 목표

2.  mask tokens에 대한 positional embedding이 location information의 leakage를 유발

  • masked autoencoder에서 mask된 부분들은 각각 share-weighted learnable mask token으로 대체되고, 모든 mask tokens는 position embeddings를 통해 input data에 location information과 함께 제공되고, autoencoder가 처리한 후에 각각의 mask token은 해당 mask된 부분을 reconstruction하는 데 사용됨
  • 언어와 이미지는 location information을 포함하지 않기 때문에 이를 제공하는 것이 문제가 되지 않는데, point cloud는 data 자체에 location information을 포함하고 있어서, mask token에 location information이 노출되면 autoencoder가 latent features 학습하는 데 악영향을 줄 수 있음
  • 논문에서는 이 문제를 mask token을 (autoencoder의) encoder의 input에서 (autoencoder의) decoder의 input으로 옮겨서 해결하고자 함
  • location information의 leakage를 지연시키고, encoder가 mask되지 않은 부분에서 feature를 학습할 수 있게 함

3. point cloud의 정보 밀도는 상대적으로 고르지 않음

  • 중요한 local feature를 구성할수록 높은 밀도의 정보를 가짐 → mask되면 높은 밀도의 정보를 포함하는 점들은 reconstruction이 어려움
  • Fig. 2. reconstruction examples on ShapeNet validation set (masking ratio = 60%)
  • mask된 책상 왼쪽 표면은 쉽게 reconstruction할 수 있지만, mask된 오토바이의 오른쪽 바퀴는 reconstruction이 잘 되지 않았음
  • point cloud가 고르지 않은 정보 밀도를 가져도, random하게 60~80% 비율로 masking하는 것이 효과적이라는 것을 발견; point cloud가 정보의 밀도 측면에서 언어보다는 이미지와 유사하다는 것을 의미

Point-MAE (Masked AutoEncoders)

  • point cloud를 위한 새로운 self-supervised learning framework인 Point-MAE를 제안
  • 주로 point cloud masking과 embedding module, autoencoder로 구성됨
  • 과정
    • 불규칙한 point patches로 input point cloud를 나눔
    • 데이터 중복을 감소시키기 위해 높은 비율로 random하게 mask
    • asymmetric design과 shifting mask tokens operation을 사용하는 standard transformer를 기반으로 한 autoencoder는 mask되지 않은 point patch에서 high-level latent features를 학습
    • coordinate space(좌표 공간)에서 mask된 point patch를 reconstruction

Point-MAE

Structure

1.  입력된 point cloud는 먼저 masking 및 embedding module에 의해 처리됨

2.  standard Transformer 기반의 autoencoder를 사용해 간단한 prediction head를 포함하고, input point cloud의 masking된 부분을 reconstruction함

    • embedding process
      • input cloud를 random하게 mask되고 embedding된 point patches로 나눔
    • pre-training
      • encoder는 visible tokens만 처리함
      • masked point patches를 reconstruction하기 위해 mask tokens는 decoder의 input sequence에 추가됨
    • decoding process
      • encoding된 token과 mask token을 input으로 받아서 가벼운 decoder가 단순한 prediction head와 함께 mask된 point patch를 reconstruction함

1. Point Cloud Masking and Embedding

1.1 Point Patches Generation

1.2 Masking

1.3 Embedding

2. Autoencoder's Backbone

2.1 Encoder-Decoder

2.2 Prediction Head

2.3 Reconstruction Target


Experiments

1.  ShapeNet training set로 pre-train

2.  pre-trained model을 다양한 downstream tasks, including object classification, few-shot learning, part segmentation으로 평가함

3.  다양한 masking 전략을 연구해서 shifting mask tokens의 효과를 확인함

    • input cloud의 resolution에 따라 다른 개수의 patches로 linear하게 나눔
      • typical input with p = 1024 points is divided into n = 64 point patches
    • KNN algorithm에서 k=32로 설정해서 각 patch 내의 point의 개수를 일정하게 함
    • autoencoder의 backbone에서 encoder는 12개의 Transformer blocks, decoder는 4개의 Transformer blocks를 가지고 있음
    • 각 Transformer blocks는 384개의 hidden dimensions와 6개의 head를 가지고 있고, block 내의 MLP ration는 4로 설정함

Pre-trained Setup

    • ShapeNet에는 51,300개의 3D model이 포함되어 있음
      • 55개의 common object categories
    • dataset을 training과 validation set으로 나누고, training set에서만 pre-training함
    • 각 instance에 대해 FPS를 사용해서 1024개의 point를 sampling하여 input point cloud로 사용
    • pre-training
      • standard random scaling과 random translation을 data augmentation에 적용
      • AdamW optimizer, Cosine learning rate decay, initial learning rate = 0.001, weight decay = 0.05, pre-training for 300 epochs, batch size = 128

    • (Fig. 4. Reconstruction results on ShapeNet validation set)
    • 60%의 masking ratio로 pre-train
    • input을 복원할 때 다른 masking ratio도 가능함 - 40%, 60%, 80%의 결과 확인
      • 이 연구의 모델이 high-level latent features를 잘 학습했다는 것을 의미
    • Point-BERT와 비교했을 때 1.7배 빠른 속도로 pre-training했음

Experiments - Downstream Tasks

Objection Classification on Real-World Dataset

    • point cloud를 위한 SSL에서 ‘high generalization capability를 가진 model을 설계하는 것’이 중요함
    • 일반적으로 사용되는 pre-training dataset인 ShapeNex은 scene context (e.g., backgrounds) 없이 clean object model만 포함하고 있음
    • 이를 보완하기 위해, 현실 세계 dataset인 ScanObjectNN에서 pre-trained model을 평가했음
      • ScanObjectNN
      • 15,000 objects, 15 categories
      • 복잡한 background의 실내 scene data에서 scan된 data

    • Point-MAE 결과 (Transformer과 비교) 10.16%, 7.74%, 7.94%씩 baseline을 증가시킴
    • 가장 어려운 variant인 PB-T50-RS에 대해서도 Point-BERT보다 2.11% 높은 accuracy가 나타남
      Point-MAE가 현실 세계의 datageneralization해서, 강한 generalization capability 보이는 것을 알 수 있음

Objection Classification on Clean Object Dataset

  • ModelNet40에서 pre-trained model을 평가
  • ModelNet40
    • 12,311개의 clean 3D CAD models로 구성
    • 40 object categories
  • standard protocol에 따라 9,843개의 training set과 2,468개의 test instance로 나눔
  • training 중에 data augmentation에 standard random scaling과 random translation을 적용
  • standard voting method로 공정하게 비교함
  • coordinate information만 포함하고, normal information은 포함하지 않는 1024개의 points를 input으로 받음

    • 처음부터 학습한 경우 (Transformer: 91.4%)에 비해 accuracy 2.4% 향상됨
    • 다른 SSL 방법들과 비교해도 성능이 가장 좋음
    • 복잡한 Point-BERT보다 0.6% 높은 accuracy
    • ModelNet40이 상대적으로 작은 dataset이라는 점을 고려하면, 다른 모델들보다 accuracy가 향상된 것이 의미 있음
    • supervised learning의 dedicated Transformers models보다도 accuracy가 높음
    • 추가적으로 input으로 8192개의 point을 제공했을 때, Point-MAE는 94.04%의 정확도를 달성함

 Few-shot Learning

    • Few-shot Learning: 적은 수의 label이 지정된 sample에 대해 학습하여 정확한 prediction을 수행하는 방법을 학습하는 ML framework
    • 선행 연구를 따라 ModelNet40에 few-shot learning experiments 수행함
      • n-way (n: random하게 선택한 class 개수) , m-shot setting (m: 각 class에서 random하게 sampling한 object 개수)
      • n x m objects를 training에 사용함
      • testing할 때 evaluation을 위해 unseen objects 20개를 random하게 sampling함
      • n ∈ {5, 10} and m ∈ {10, 20}
    • standard protocol을 따라 10개의 independent experiments를 각 setting에 대해 수행하고, mean accuracy를 standard deviation과 함께 계산함

    • Point-MAE가 4가지 setting에서 state-of-the-art accuracy를 1.5%-2.3% 향상시키고, 더 작은 standard deviation을 보임

Part Segmentation

    • ShapeNetPart dataset에 대해 Point-MAE의 representing learning capability를 평가함
    • ShapeNetPart
      • 16,881 objects, 16 categories
    • 선행 연구를 따라 각 object에 대해 2048개의 point로 input을 sampling해서 128개의 point patches로 나눔
    • segmentation head는 추가적인 propagating operation이나 DGCNN을 사용하지 않고 간단함
    • 공정한 비교를 위해 segmentation head에 Point-BERT와 유사한 weight을 줌
    • Transformer block의 4, 8, 12번째 layer에서 학습한 features를 사용함
    • 3 levels의 features를 결합해서, average pooling과 max pooling을 각각 적용해서 global features를 얻음
      • 연결된 features는 128개의 center points에 대한 features를 나타내고, 2048개의 input point로 up-sampling해서 각 point에 대한 feature를 얻음
      • 각 point의 feature를 2개의 global feature과 결합해서 MLP를 사용해 각 point에 대한 label을 예측함
    • testing에 voting methods나 data augmentation을 사용하지 않음

  • 모든 instance에 대한 mean IoU (mIoU)와 각 카테고리에 대한 IoU (예측한 영역과 정답 영역이 겹치는 정도)
  • Point-MAE는 1% 향상된 86.1%의 mIoU를 보임
  • DGCNN과 Point-BERT보다도 높은 mIoU를 보임

Ablation Study

1. Masking Strategy

    • 2개의 다른 masking ratio를 가진 masking types를 비교함
    • testing에 voting methods 사용하지 않음
    • Block Masking
      • 인접한 point patch를 masking해서 block으로 masking된 영역을 만듦
      • reconstruction이 어렵지만, 중간 정도의 masking ratio를 사용하면 좋은 성능을 보임
    • Random Masking
      • random하게 point patch를 masking
      • 높은 masking ratio (60%-80%)에서 가장 좋은 성능을 보임
      • masking ratio가 너무 높으면 성능이 약간 저하되고, 낮으면 성능이 크게 저하됨

2. Effect of shifting mask tokens

  • 공정한 비교를 위해 autoencoder의 backbone은 동일한 encoder와 prediction head를 사용하지만, decoder는 사용하지 않아서 fine-tune tasks에서 동일한 모델을 생성함
  • masking ratio 60%으로 random masking
  • 결과
    • pre-training 후에 Point-MAE(2.60)에 비해 더 작은 reconstruction loss가 관찰됨
    • 그러나 ModelNet40에서의 fine-tuning 성능은 92.14%로, Point-MAE(93.19%)보다 낮음
  • 원인: encoder의 input에서는 mask token을 포함한 모든 token에 location information이 제공되어야 하는데, 이는 mask token이 coordinate space에서 point patch를 reconstruction하는 과정에서 location information이 노출되기 때문에 발생함. location information이 노출되며 reconstruction이 덜 어려워지고, latent feature를 잘 학습하지 못해 fine-tuning 성능이 저하됨

Structure 요약


References

https://modulabs.co.kr/blog/ablation-study/

https://cumulu-s.tistory.com/8

https://devocean.sk.com/blog/techBoardDetail.do?ID=166264&boardType=techBlog

https://www.youtube.com/watch?v=o29P0Kpobz0

https://hsyaloe.tistory.com/39

https://wikidocs.net/202612

https://mozenworld.tistory.com/entry/%EB%A8%B8%EC%8B%A0%EB%9F%AC%EB%8B%9D-%EB%AA%A8%EB%8D%B8-%EC%86%8C%EA%B0%9C-6-%EB%8B%A4%EC%B8%B5-%ED%8D%BC%EC%85%89%ED%8A%B8%EB%A1%A0-Multilayer-Perceptron

https://velog.io/@nochesita/%EB%A0%88%EC%9D%B4%EC%96%B4-%EC%9D%B4%ED%95%B4%ED%95%98%EA%B8%B0-3-Pooling

https://mr-waguwagu.tistory.com/40

https://xoft.tistory.com/28

https://velog.io/@jochedda/딥러닝-Autoencoder-개념-및-종류

https://23min.tistory.com/8

https://kimjy99.github.io/논문리뷰/mae/

https://chan-lab.tistory.com/31


Q&A

  • FPS
    • 우선 하나 선택하고, 가장 먼 점 찾아서 돌아다니는 방식!
    • 랜덤 샘플링은 point cloud의 모든 영역에서 점들을 충분히 가져왔다는 보장이 없는 반면, FPS는 결과적으론 대부분의 영역을 꽤 균등하게 돌아다닌 결과
  • KNN을 point cloud랑 center 두 개를 같이 보고 하는건지
    • 맞다!
  • Masked patch에서 token embedding 할때 masked, visible, encoded 랜덤으로 뽑는지
    • 여기서 embedding은 unmasked된 patch만 하기 때문에 랜덤하게 선택하는 건 아니다
  • input으로 visible token만 사용하는 이유
    • mask tokens를 encoder의 input에서 처리하지 않고, lightweight decoder로 shifting함
    • benefits (input으로 visible token만 사용하는 이유)
      • high masking ratios를 사용해서 shifting하면 encoder의 input tokens의 수를 줄일 수 있음 → computational resources를 아낄 수 있음
      • encoder로 location information이 leakage되는 것을 막을 수 있음 → encoder가 latent features를 더 잘 학습할 수 있도록 함
    • Visible Token은 Encoder 단계에서 이미 처리되어 유용한 Latent Representation (Te)로 변환되었고, Decoder에서 다시 Visible Token을 출력할 필요가 없으며, Mask Token만 복원하면 모델의 최종 학습 목표를 달성하는 것이기 때문
  • location information을 제공하면 성능이 떨어진다고 하는데, 그 직관적인 이유
    • “location information이 노출되며 reconstruction이 덜 어려워지고, latent feature를 잘 학습하지 못해 fine-tuning 성능이 저하됨” (effect of shifting mask tokens 부분 내용 참고)