Understand the SA-1B Dataset JSON format
mainThe SA-1B dataset saves masks per image as a JSON file. When loaded as a dictionary in Python, it follows this structure:
image: Containsimage_id(int),width(int),height(int), andfile_name(str).annotations: A list of annotation objects, each containing:id: Annotation ID.segmentation: Mask saved in COCO RLE format.bbox: Box around the mask in[x, y, w, h](XYWH) format.area: Area in pixels.predicted_iou: Model's prediction of mask quality.stability_score: Measure of mask quality.crop_box: The crop used for generation in[x, y, w, h](XYWH) format.point_coords: Input point coordinates[[x, y]]used to generate the mask.
{
"image" : image_info,
"annotations" : [annotation],
}
image_info {
"image_id" : int,
"width" : int,
"height" : int,
"file_name" : str,
}
annotation {
"id" : int,
"segmentation" : dict, # COCO RLE format
"bbox" : [x, y, w, h],
"area" : int,
"predicted_iou" : float,
"stability_score" : float,
"crop_box" : [x, y, w, h],
"point_coords" : [[x, y]],
}