Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File_type is case sensitive, creates problems during prediction generation #50

Open
andrebriggs opened this issue Nov 28, 2018 · 1 comment

Comments

@andrebriggs
Copy link

If you have a file_type defined in the config.ini such "*.jpg" and have images that are *.JPG then during prediction creation you will have zero files and the TF Detector code will fail the script. Root cause seems to be the way code is handled here for instance. Why wait all the way up until Create Predictions for this to surface? Do we need to be case sensitive here?

Just logging this as a bug. I will probably fix

@andrebriggs andrebriggs changed the title Filetype is case sensitive File_type is case sensitive, creates problems during prediction generation Nov 28, 2018
@yashpande
Copy link
Collaborator

This issue also occurs with .jpeg extensions not being recognized as .jpg, which is probably also not ideal. The more robust way would be to use something like imghdr to get the actual type of all files, and take only the ones that are of the desired type (which would then be narrowed down to either 'jpeg' or 'png'). Even replacing the linked code with something like this would probably work:

# all_image_files = list(basedir.rglob(filetype))
# replace this with:
import imghdr
all_image_files = [image_file for image_file in subdir.iterdir() 
                             if image_file.is_file() and imghdr.what(image_file)=='jpeg']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants