ITADN

Enhance file search to include subdirectories using glob [Update fid_score.py]

#113Pull RequestXavierJiezou 创建于 2024-07-03
X
XavierJiezoucommented
This PR enhances the file search functionality to include subdirectories by using `glob.glob` with the `recursive=True` parameter. This change ensures that all image files within the specified directory and its subdirectories are found, improving the flexibility and robustness of the file search. ## Fixed issue - Replaced `pathlib.Path.glob` with `glob.glob` to enable recursive search. - Ensured compatibility with existing code by maintaining the use of standard libraries. ## Details ```python # Before files = sorted( [file for ext in IMAGE_EXTENSIONS for file in path.glob("*.{}".format(ext))] ) # After import glob files = sorted([file for ext in IMAGE_EXTENSIONS for file in glob.glob(os.path.join(path, '**/*.{}'.format(ext)), recursive=True)]) ```
合并状态:未合并 0 条评论