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

载入图片的代码会使图片载入两次 #6

Open
corberan opened this issue Nov 16, 2017 · 2 comments
Open

载入图片的代码会使图片载入两次 #6

corberan opened this issue Nov 16, 2017 · 2 comments

Comments

@corberan
Copy link

extensions = ['jpg', 'JPG', 'jpeg', 'JPEG', 'png', 'PNG']
# ...
for extension in extensions:
     file_glob = os.path.join(image_dir, '*.' + extension)
     file_list.extend(gfile.Glob(file_glob))

在Windows上,后缀大小写不区分,同一张图片会被载入两次:
image

@eli95
Copy link

eli95 commented Nov 22, 2017

哇, 你真细心!
`file_list = []
for extension in extensions:
file_glob = os.path.join('./tttt', '*.' + extension)
file_list.extend(gfile.Glob(file_glob))

file_list
Out[11]:
['.\tttt\0018_num6235.png',
'.\tttt\0023_num5141.png',
'.\tttt\0023_num8005.png',
'.\tttt\0018_num6235.png',
'.\tttt\0023_num5141.png',
'.\tttt\0023_num8005.png']`

这样可能会解决这个重复的问题:
for file_name in list(set(file_list)):

@PatrickLib
Copy link
Owner

是的,windows下只保留小写或者大写就可以了,用set过滤也不错。不管也可以,不影响训练。

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

3 participants