hydra_feeder
This file formats existing images and directories to desired properties by connecting to the server and using a parser. The resized files are stored for hydra_predict to reference, and the original files are deleted.
find_files
This method returns all files in a given directory through the use of a generator.
def find_files(root):
for d, dirs, files in os.walk(root):
for f in files:
yield os.path.join(d, f)
Parameter
root: A directory from which the files need to be retrieved
Example Usage
walkfiles=find_files(args["img"])
ResizeAndSave
This method formats existing images to the desired properties based on a model and stores them in an output location.
# Extended code available on Github
def ResizeAndSave(orig_img,model_to_use,force_x,force_y,outputloc):
Parameters
orig_img: A string representing the path to the file original imagemodel_to_use: A string representing a model ID or enter “AUTO” to use the databse settingsforce_x: A string representing the width of the resized imageforce_y: A string representing the height of the resized imageoutputloc: A string representing the location where the output file will be placed
Example Usage
ResizeAndSave(args["img"],args["model"],args["xsize"],args["ysize"],args["output"])