/go-image-label-for-pytorch

Take a folder full of images and move them into subfolders based on the supplied config in a manner that is easily used by pytorch ImageFolder to be used in multi class image detection models.

Primary LanguageGo

go-image-label

Reads a JSON file and organizes images into subfolders to be easily used with Pytorch ImageFolder

{
    "dataFile": "birds.json",
    "imagePrefix": "images",
    "defaultPrefix": "pr_set",
    "secondaryPrefix": "pr_eggset",
    "secondaryPredicate": "egg",
    "ignorePredicate": "map",
    "outfile": "classes"
}

dataFile is the input file - see birds.json as example format

imagePrefix is the directory that the entire image set is

defaultPrefix is where we place the subfolders and images

secondaryPrefix is where we place the subfolders and images of any data that matches our secondaryPredicate

secondaryPredicate is a string that is checked if it's contained in the image name and if so it will use the secondaryPrefix instead of the default

ignorePredicate is a string that is checked if it's contained in the image name and if so it will be discarded

outfile is the file with the unique classes listed out as a json file