This repository contains utility functions for the Stereo Instance on Surfaces (STOIS) dataset, most importantly:
- Visualization
- Camera parameters
- Annotation generation
If you haven't already, please download the dataset from the project website.
To use this code it is suggested to create a new anaconda environment:
conda env create -f environment.yaml
This creates a new environment named stios_utils. All following steps assume this as the active environment.
Run python visualize.py --root </path/to/stios> [--sensor SENSOR(S)] [--surface SURFACE(S)].
Run python visualize.py --help for further information.
For a list of sensors see the SENSORS definition in utils/utils.py.
For a list of surfaces see the SURFACES definition in utils/utils.py.
Camera parameters are saved as yaml files in params/rc_visard.yaml and params/zed.yaml, respectively.
You can directly load them using get_params(sensor) defined in utils/utils.py.
In STIOS masks are saved as 8-bit png images, whereby the grayscale value denotes the instance class.
This is possible since objects only appear once per image.
To derive corresponding bounding boxes and class names use get_bboxes(mask) with mask being a np.array:
import cv2
from utils.utils import get_bboxes
mask = cv2.imread('/path/to/mask.png', cv2.IMREAD_GRAYSCALE)
bboxes = get_bboxes(mask) # returns a list of dicts with keys 'class' and 'bbox' for each detected instance