sort.prep_images

sort.prep_images(image_dir, all_image_dir)

Copy all images to a flat directory and save a csv with encounter info.

Some users may have their image directory structured such that each image is in a subfolder by encounter, e.g., original_images/enc1/img1.jpg. The FeatureExtractor in pyseter.extract prefers flat directories. prep_images flattens the original_images directory by copying every image to all_image_dir, then saves a csv with encounter information to the working directory.

Parameters

Name Type Description Default
image_dir str Path to directory containing images. required
all_image_dir str Path to new directory where user wants to copy all their images. required

Returns

Name Type Description
None Saves images to the all_image_dir and the encounter information to the csv in the working_dir.

Examples

For a complete working example with real images, see:

Basic usage pattern::

from pyseter.sort import prep_images

# old directory, structured by encounter
working_dir = 'working_dir'
original_image_dir = working_dir + '/original_images'

# new, flattened directory containing every image
image_dir = working_dir + '/all_images'
prep_images(original_image_dir, all_image_dir=image_dir)