Split the dataset's train split into a train and test set with the [~datasets.Dataset.train_test_split] method:

ds = ds.train_test_split(test_size=0.2)
train_ds = ds["train"]
test_ds = ds["test"]

Then take a look at an example:

train_ds[0]
{'image': ,
 'annotation': ,
 'scene_category': 368}