vodet.utils module

vodet.utils.discrete_cmap(N, base_cmap=None)

Create an N-bin discrete colormap from the specified input map

vodet.utils.exif_date(in_dir)

Read Exif data of images in a directory and returns a dataframe of file names of images and their shooting date.

Parameters

in_dir (str) – Path for the directory of images.

Returns

df – A dataframe of filename and shooting date.

Return type

pd.DataFrame

vodet.utils.make_patches_labelled(data_dir, out_dir, label_data, step_ratio)

Split source images with labels.

Parameters
  • data_dir (str) – The path for data directory.

  • out_dir (str) – The path for output (patched images) directory.

  • step_ratio (float) – Sliding window step size relative to the size of patches.

vodet.utils.make_patches_unlabelled(data_dir, out_dir, label_data, step_ratio)

Split source images into patches. The patch sizes are determined by label_data.

Parameters
  • data_dir (str) – The path for data directory.

  • out_dir (str) – The path for output (patched images) directory.

  • label_data (pd.DataFrame) – A dataframe of label data. This will be used to determine the sizes of patches.

  • step_ratio (float) – Sliding window step size relative to the size of patches.

vodet.utils.plot_latent(x, y, f, q, y_dim)
vodet.utils.plot_reconstruction(x, y, p, q)
vodet.utils.read_labelme(in_dir)

Read labelme’s json files and convert it into pd.DataFrame

Parameters

in_dir (str) – The directory where json files are stored.

Returns

dataframe

Return type

pd.DataFrame

vodet.utils.set_patches(data_dirs, label_type, step_ratio=1.0)

Making labelled and unlabelled patches from annotated images. The annotation shape must be rectangulars. Only compatible with VoTT (csv export) and labellme.

Parameters
  • data_dirs (dict) – A dictionary with 3 components, “train”, “validation” and “unlabelled” . The “train” and “validation” directory should have - /source: a sub-directory with source images - /labels: a sub-directory with label data. label data should be VoTT csv-export file (.csv) or labelme output file (.json)

  • label_type (str) – The type of label files, “VoTT” and “labelme” are available.

  • step_ratio (float default 1.0) – Sliding window step size relative to the size of patches.