Category File Tools Notes

Category names of an image-set or data-set are written in plain text, separated by a new line and stored in a file categories.txt. The order of the category names is important and reflects the index of the result vector from the model for easy mapping.

read_categories[source]

read_categories(categories_file=None, dataset_type=<DatasetType.IMAGE_CLASSIFICATION: 'image_classification'>)

Reads the categories from a categories file. If the dataset type is image segmentation or object detection, a background class at index 0 is prepend. If the optional categories_file is not given, the file name categories.txt is used by default categories_file: the categories file name, if not the default dataset_type: the type of the data-set to create the categories for return: a list of the category names

write_categories[source]

write_categories(categories, categories_file=None)

Write the categories to a categories file. If the dataset type is image segmentation or object detection, a background class at index 0 is prepend. If the optional categories_file is not given, the file name categories.txt is used by default categories: a list of the category names to write categories_file: the categories file name

Helper Methods

configure_logging[source]

configure_logging(logging_level=20)

Configures logging for the system.

:param logging_level: The logging level to use.

Run from command line

To run the data-set builder from command line, use the following command: python -m mlcore.category_tools [parameters]

The following parameters are supported:

  • [categories]: The path to the categories file. (e.g.: categories.txt)