Support prediction on a folder
Refs #34 (closed)
The current teklia-dan predict
only support prediction on an image through --image
. We'd like to be able to process a whole folder.
Add new arguments to the parser:
-
--image-dirs
, type=Path
, in a mutually exclusive group with--image
, which is no longer required, (example), no default, path to a directory with images -
--image-extension
, type=str
, the extension of the images in the folder, defaults tojpg
Refactor the code of the current run function to be able to do something like
def run(...):
if image:
process_image(
image,
...
)
else:
for image_name in image_dir.rglob("*.jpg"):
process_image(
image_name,
...
)
Please do not load the model multiple times.