<jupyter_start><jupyter_text>DataSet type> DataSet Type.<jupyter_code># export
class DatasetType(Enum):
    """
    Currently supported Machine Learning Types.
    """
    IMAGE_CLASSIFICATION = 'image_classification'
    IMAGE_SEGMENTATION = 'image_segmentation'
    IMAGE_GENERATION = 'image_generation'
    IMAGE_OBJECT_DETECTION = 'image_object_detection'

    def __str__(self):
        return self.value
# export
def infer_dataset_type(path):
    """
    Try to infer the dataset type from the category file path.
    `path`: the path to infer from
    return: the infered dataset type
    raises: `ValueError` if infer failed
    """
    path_elements = reversed(os.path.normpath(path).split(os.sep))
    for elem in path_elements:
        try:
            return DatasetType(elem)
        except ValueError:
            pass
    raise ValueError("Error, can not infer dataset type from path: {}".format(path))

# hide

# for generating scripts from notebook directly
from nbdev.export import notebook2script
notebook2script()<jupyter_output>Converted annotation-core.ipynb.
Converted annotation-folder_category_adapter.ipynb.
Converted annotation-multi_category_adapter.ipynb.
Converted annotation-via_adapter.ipynb.
Converted annotation-yolo_adapter.ipynb.
Converted annotation_converter.ipynb.
Converted annotation_viewer.ipynb.
Converted category_tools.ipynb.
Converted core.ipynb.
Converted dataset-core.ipynb.
Converted dataset-image_classification.ipynb.
Converted dataset-image_object_detection.ipynb.
Converted dataset-image_segmentation.ipynb.
Converted dataset-type.ipynb.
Converted dataset_generator.ipynb.
Converted evaluation-core.ipynb.
Converted image-color_palette.ipynb.
Converted image-opencv_tools.ipynb.
Converted image-pillow_tools.ipynb.
Converted image-tools.ipynb.
Converted index.ipynb.
Converted io-core.ipynb.
Converted tensorflow-tflite_converter.ipynb.
Converted tensorflow-tflite_metadata.ipynb.
Converted tensorflow-tfrecord_builder.ipynb.
Converted tools-check_double_images.ipynb.
Converted tools-downloader.[...]
{'fraction_non_alphanumeric': 0.08081791626095423, 'fraction_numerical': 0.0009737098344693282, 'mean_word_length': 4.724233983286908, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '55158', 'license': 'Apache-2.0', 'n_tokens_mistral': 664, 'n_tokens_neox': 647, 'n_words': 141, 'path': 'dataset-type.ipynb', 'repo_name': 'AI-Force/aiforce', 'size': '2054'}