home > kero > Documentation


def tag_rename_clone(this_folder, tag_folder,starting_label,

Description. Cloning folder for image pre-processing. See example usage 1.

Rotation function. When the variable rotate_angle_set is set to a list of float [a1, a2,…] , then each image in the folder will be cloned, and then copies of the image rotated with anglesĀ a1, a2, … will be created in the clone folder and labelled along the sequence of numbers as well.

this_folder String. The name of the folder with images.
tag_folder String. The name of the folder with images. If each image in the tag_folder has a corresponding image of the same name and type, then the image will be cloned into a clone folder and tag clone folder and relabelled accordingly.
starting_label Integer. The sequence of numbers will start with this integer.
order_name String. The clone of this_folder will be relabelled with prefix specified by this string.

Default value =”img”

tag_name String. The clone of tag_folder will be relabelled with prefix specified by this string.

Default value =”imggt”

filetype String. Each image in both clone folders will have file type specified by this string.

Default value =”.png”

clone_name String. The clone folder of this_folder will be named this_folder+clone_name

Default value =”_CLONE”

tag_clone_name String. The clone folder of tag_folder will be named this_folder+tag_clone_name

Default value =”_GT”

dump_folder String. The name of dump folder. Dump folder will be filled with images from this_folder that do not have corresponding images with the same name and type in the tag_folder. If this folder is empty, it will be deleted at the end.

Default value =”this_dump”

check_missing_mode Boolean. If True, cloning process of the folders are not performed. The file names of images in this_folder that do not have the corresponding images in the tag_folder will be printed.

Default value =False

rotate_angle_set List of float. Each float is a value in degree with which an image is rotated.

Default value =None


Example usage 1

Given a folder of images and a tag folder, this function clones both folder and relabel the images in numerical sequence. Consider the folder as shown below (left) and its tag folder (right) which is identical to the folder except each corresponding butterfly object is marked white. Download the example here and put them in the working directory under the folder /bb.

import kero.ImageProcessing.photoBox as kip

this_folder = "bb\\Butterflies"
tag_folder =  "bb\\Butterflies_canvas"

kip.tag_rename_clone(this_folder, tag_folder, 1, check_missing_mode=False)



The cloned and relabelled folders are shown below.


kero version: 0.4.3 and above