def load_sunrgbd_instances(name: str, dirname: str, split: str, class_names: Union[List[str], Tuple[str, ...]]):
    """
    Load SUN-RGBD detection annotations to Detectron2 format.

    Args:
        dirname: Contain "Annotations", "ImageSets", "JPEGImages"
        split (str): one of "train", "test", "val", "trainval"
        class_names: list or tuple of class names
    """
    if split == 'val':
        split = 'test'
        
    # Needs to read many small annotation files. Makes sense at local
    image_pths = sorted(glob.glob(os.path.join(dirname, 'image', split, '*.jpg')))
    semseg_pths = sorted(glob.glob(os.path.join(dirname, 'label37', split, '*.png')))
    
    assert len(image_pths) == len(semseg_pths)
    
    dicts = []
    for image_dir, semseg_dir in zip(image_pths, semseg_pths):
        r = {
            "file_name": image_dir,
            "sem_seg_file_name": semseg_dir,
            "image_id": semseg_dir.split('/')[-1].split('.')[0],
        }
        dicts.append(r)
    return dicts

    Load SUN-RGBD detection annotations to Detectron2 format.

    Args:
        dirname: Contain "Annotations", "ImageSets", "JPEGImages"
        split (str): one of "train", "test", "val", "trainval"
        class_names: list or tuple of class names
    
datasets/registration/register_sunrgbd_semseg.py