Checks if a file is an image. Args: filename (string): path to a file Returns: bool: True if the filename ends with a known image extension
(filename)
| 8 | |
| 9 | |
| 10 | def is_image_file(filename): |
| 11 | """Checks if a file is an image. |
| 12 | |
| 13 | Args: |
| 14 | filename (string): path to a file |
| 15 | |
| 16 | Returns: |
| 17 | bool: True if the filename ends with a known image extension |
| 18 | """ |
| 19 | filename_lower = filename.lower() |
| 20 | return any(filename_lower.endswith(ext) for ext in IMG_EXTENSIONS) |
| 21 | |
| 22 | |
| 23 | def find_classes(dir, classes_idx=None): |