데이터셋 (SA-1B 구성과 포맷)
데이터셋 (SA-1B 구성과 포맷)
SAM은 1,100만 개의 이미지와 11억 개의 마스크로 구성된 SA-1B 데이터셋으로 훈련됐어요. 이 데이터셋은 Segment Anything 데이터 엔진을 통해 만들어진 고품질 세그멘테이션 어노테이션이에요.
데이터 구성
- 이미지 1,100만 개, 마스크 11억 개
- 마스크는 이미지마다 JSON 파일로 저장됨
- 다운로드 시 SA-1B Dataset Research License에 동의해야 해요
저장 포맷
이미지별 mask는 JSON 파일로 저장되고, 파이썬 사전 형태로 로드돼요.
{
"image" : image_info,
"annotations": [annotation],
}
image_info {
"image_id" : int, # Image id
"width" : int, # Image width
"height" : int, # Image height
"file_name" : str, # Image filename
}
annotation {
"id" : int, # Annotation id
"segmentation" : dict, # Mask saved in COCO RLE format.
"bbox" : [x, y, w, h], # The box around the mask, in XYWH format
"area" : int, # The area in pixels of the mask
"predicted_iou" : float, # The model's own prediction of the mask's quality
"stability_score": float, # A measure of the mask's quality
"crop_box" : [x, y, w, h], # The crop of the image used to generate the mask
"point_coords" : [[x, y]], # The point coordinates input to generate the mask
}
RLE 디코딩
마스크는 COCO RLE 포맷으로 저장돼요. pycocotools로 이진 마스크로 디코딩할 수 있어요.
from pycocotools import mask as mask_utils
mask = mask_utils.decode(annotation["segmentation"])
이미지 id 목록은 sa_images_ids.txt에 들어 있어요.