dataset/pascal_format.py
def main():
    """Main function to format dset."""
    voc_path = os.path.join(args.save_dir, 'data/VOCdevkit/VOC2007/')  #path of voc format
    create_dirs(voc_path)  #creates the pascal directories
    
    #fetches all the image filenames
    fnames = glob.glob(os.path.join(args.image_dir, "*.{}".format(args.ext)))   #gets all file names in img_dir
    assert len(fnames) > 0, "No images matching image directory and provided image extension were found. Try changing the image directory or the file extension (EXT, eg. 'jpg')."
    if args.random:
        random.shuffle(fnames)  #shuffle them in random order to get balanced train and val sets
    else:
        fnames.sort(key=numericalSort)  #otherwise sort them to have consistent trainval splits
    # format dset
    resize_and_save(voc_path, fnames)  #resizes images and annotations (if provided) and saves
    write_train_test(voc_path, fnames)
Main function to format dset.
Main function to format dset.
Main function to format dset .
def main():
    voc_path = os.path.join(args.save_dir, 'data/VOCdevkit/VOC2007/')  
    create_dirs(voc_path)  
    fnames = glob.glob(os.path.join(args.image_dir, "*.{}".format(args.ext)))   
    assert len(fnames) > 0, "No images matching image directory and provided image extension were found. Try changing the image directory or the file extension (EXT, eg. 'jpg')."
    if args.random:
        random.shuffle(fnames)  
    else:
        fnames.sort(key=numericalSort)  
    resize_and_save(voc_path, fnames)  
    write_train_test(voc_path, fnames)
def main ( ) : voc_path = os . path . join ( args . save_dir , 'data/VOCdevkit/VOC2007/' ) create_dirs ( voc_path ) fnames = glob . glob ( os . path . join ( args . image_dir , "*.{}" . format ( args . ext ) ) ) assert len ( fnames ) > 0 , "No images matching image directory and provided image extension were found. Try changing the image directory or the file extension (EXT, eg. 'jpg')." if args . random : random . shuffle ( fnames ) else : fnames . sort ( key = numericalSort ) resize_and_save ( voc_path , fnames ) write_train_test ( voc_path , fnames )
Main function to format dset.
Main function to format dset .
"""Main function to format dset.""" #path of voc format #creates the pascal directories #fetches all the image filenames #gets all file names in img_dir #shuffle them in random order to get balanced train and val sets #otherwise sort them to have consistent trainval splits # format dset #resizes images and annotations (if provided) and saves