davisinteractive.dataset

Davis

Davis(self, davis_root=None)
DAVIS class to encapsulate some information about the dataset.

This class only needs to have the root path specified. Some atributes can be accessible like the sequence list for every subset, or specific information for every sequence like the number of frames, the number of objects or the image size for every sequence. For more information about the sequence attributes available, check this file.

Arguments

  • davis_root: String. Path to the DAVIS dataset. This argument can be left as None and specify it as an environtmental variable DATASET_DAVIS. This usage is useful in the case a group of people is working with the same code and every one has a different path where the DAVIS dataset is stored. The folder name where all DAVIS dataset is stored must be names DAVIS.

Attributes

  • ANNOTATIONS_SUBDIR: Relative path with respect to the root path where the ground truth masks are stored. (Annotations)
  • SCRIBBLES_SUBDIR: Relative path with respect to the root path where the scribbles are stored. (Scribbles)
  • RESOLUTION: Resolution of the dataset used to perform all the evaluation. (480p)
  • sets: Dictionary. The keys are all the DAVIS dataset subsets and the values are the list of sequences belonging to that subset.
  • dataset: Dictionary. Contains all the information for the entire dataset. The key is the sequence name and the value is a dictionary of informations such as number of frames, number of objects, etc.
  • years: List. List with all the versions available from the dataset.

Raises

  • ValueError: if neither davis_root or environmental variable DATASET_DAVIS are specified.

check_files

Davis.check_files(sequences)
Check if the required files are found on DAVIS root.

Check if all the annotations and scribbles files, required to do the evaluation are found on davis_root. If the scribbles files are not found, it downloads them from the internet.

Arguments

  • sequences: List. List of sequences you want to check.

Raises

  • FileNotFoundError: if any required files is not found.

load_images

Davis.load_images(sequence, dtype=uint8)
Load the images of the specified sequence.

Arguments

  • sequence: String. Sequence name.
  • dtype: Numpy Data Type. Data type to return the images. Default value is np.uint8.

Returns

Numpy Array: Array with all images of the given sequence. The shape of the array will be (nb_frames x H x W x 3) and the value will be the pixel's value with range: [0, 255].

load_annotations

Davis.load_annotations(sequence, dtype=int)
Load the annotations of the specified sequence.

Arguments

  • sequence: String. Sequence name.
  • dtype: Numpy Data Type. Data type to return the annotations. Default value is np.int.

Returns

Numpy Array: Array with the annotations of the given sequence. The shape of the array will be (nb_frames x H x W) and the value will be the index of the objects, being 0 the background.

load_scribble

Davis.load_scribble(sequence, scribble_idx)
Load the scribble from given sequence specifying its index.

Arguments

  • sequence: String. Sequence name.
  • scribble_idx: Integer. Index of the scribble to load.

Returns

Dictionary: Scribble data stored in a dictionary with its default format.