Subset annotated images

This Python script processes annotated images stored in a folder, where each image has corresponding VOC XML annotation files. The script divides each image into smaller tiles while ensuring that the annotations remain correctly mapped to their respective regions. This approach is particularly useful for machine learning applications in object detection, as it helps generate a larger and more diverse training dataset from existing labeled images. The tiling technique enhances model performance by exposing it to varied object scales and positions, making it valuable for remote sensing, medical imaging, and other computer vision tasks requiring precise annotation handling. Users’ inputs are input directories (input_image_dir, input_xml_dir) and output directories (output_image_dir, output_xml_dir) and the tile size. Code can be downloaded from here.