JSP's Deep learning

[CARLA Simulator] Instance Segmentation Sensor 사용법 본문

Etc/CARLA Simulator

[CARLA Simulator] Instance Segmentation Sensor 사용법

_JSP_ 2023. 3. 21. 22:54
* Instance Segmentation Sensor은 Carla 0.9.14 버전 이후로 사용가능하다.
* Instance Segmentation이란, 기존 Segmentation과 달리 각 객체마다 고유의 RGB 색상을 가지고 있기 때문에 각 객체를 구분할 수 있다.

 

1. CARLA Instance Segmentation 이미지

 

2. CARLA Instance Segmentation 사용

CARLA에서는 Instance Segmentation은 제공하지만 생성되는 객체에 대한 RGB 정보는 제공하지 않는다. 따라서 CARLA Unreal의 코드 수정을 통해서 RGB 정보를 얻고 객체를 구분할 수 있다.

 

1) Instance Segmentation RGB 구성 코드

# 코드 경로
carla/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/Tagger.cpp

  • 다음의 코드를 통해서 [R,G,B] = [Semantic tag, (id & 0x00ff) >> 0, (id & 0xff00) >> 8]로 구성되는 것을 알 수 있다.
  • 기존의 코드를 살펴보면 객체의 RGB를 생성할 때 사용되는 ID와 실제 부여되는 ID가 다른 것을 확인할 수 있다.
  • 따라서 RGB의 값을 계산하기 위해서는 두 ID가 동일하게 사용되도록 코드를 수정할 필요가 있다.

 

2) Instance Segmentation Actor ID 할당 코드 수정

# 코드 경로
carla/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/ActorRegistry.cpp

  • 다음과 같이 IdType Id = ++FActorRefistry::ID_COUNTER;` -> `IdType Id = Actor.GetUniqueID();로 수정한다.
Comments