YoloLint is a tool for automatic validation of dataset structure, annotation files, and image sizes in YOLO projects. It helps you catch typical errors in directory structure, YAML files, annotation files, and now also ensures all your images have the correct size before you start model training.
.
βββ yololint/
β βββ clis/
β β βββ structure_validator_cli.py
β β βββ annotation_checker_cli.py
β β βββ sizes_checker_cli.py
β βββ structure_validator.py
β βββ annotation_checker.py
β βββ sizes_checker.py
β βββ utils/
β β βββ compare_validate.py
β β βββ add_file_to_list.py
β βββ constants/
β βββ folders.py
βββ tests/
β βββ test_structure_validator.py
β βββ test_annotation_checker.py
β βββ utils/
β βββ prepare_lib_proccess.py
βββ requirements.txt
βββ setup.py
βββ README.md
After installing the package, you can use the following commands in your terminal:
yololint-structure-v <path_to_your_dataset>yololint-annotation-v <path_to_labels_folder> <number_of_classes>yololint-sizes-v <path_to_your_dataset> <width> <height>from yololint.structure_validator import StructureValidator
dataset_path = "/path/to/your/dataset"
checker = StructureValidator(dataset_path)
result = checker.dataset_validation()
print(result)- Function:
StructureValidator.dataset_validation() - Description: Checks if the folder structure and
data.yamlare correct, and if the number of classes and class names match.
from yololint.annotation_checker import AnnotationChecker
labels_path = "/path/to/your/dataset/labels"
classes_count = 3 # number of classes in your dataset
checker = AnnotationChecker(labels_path, classes_count)
result = checker.annotation_checker()
print(result)- Function:
AnnotationChecker.annotation_checker() - Description: Checks if all
.txtfiles have the correct format (5 values per line, valid class_id) and are not empty.
from yololint.sizes_checker import SizesChecker
sizeX = 640 # expected width
sizeY = 480 # expected height
dataset_path = "/path/to/your/dataset"
checker = SizesChecker(sizeX, sizeY)
checker.check_sizes(dataset_path)- Function:
SizesChecker.check_sizes(path_to_dataset) - Description: Checks if all images in the dataset have the specified size. If an image has a different size, you will be prompted in the terminal to rescale it automatically.
names: ['class1', 'class2', 'class3']
nc: 3- Gabriel WiΕniewski
Project is licensed under the Apache License.