def load_scannet_instances(name: str, dirname: str, split: str, class_names: Union[List[str], Tuple[str, ...]]):
    """
    Load ScanNet 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
    """
    with PathManager.open(os.path.join(dirname, "meta", split + ".txt")) as f:
        fileids = np.loadtxt(f, dtype=np.str)
        
    dicts = []
    for field in fileids:
        image_dir = os.path.join(dirname, 'images', field[0])
        semseg_dir = image_dir.replace('color', name2folder[name]).replace('jpg', 'png')
        r = {
            "file_name": image_dir,
            "sem_seg_file_name": semseg_dir,
            "image_id": semseg_dir.split('/')[-3] + semseg_dir.split('/')[-1].split('.')[0],
        }
        dicts.append(r)
    return dicts

    Load ScanNet 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_scannet_semseg.py