辛普森家庭dataset的問題
717
0
·
2019/04/21
·
1 mins read
☕
WriterShelf™ is a unique multiple pen name blogging and forum platform. Protect relationships and your privacy. Take your writing in new directions. ** Join WriterShelf**
WriterShelf™ is an open writing platform. The views, information and opinions in this article are those of the author.
Article info
Categories:
Tags:
Total: 123 words
Like
or Dislike
More to explore
The Simpsons Characters Data — Image dataset of 20 characters from The Simpsons
kaggle.com
在使用這個dataset時, 讀取圖片會遇到以下的問題.
ValueError: Could not find a format to write the specified file in mode 'I'
這是因為在nelson_muntz這個資料夾裡有Mac留下的._.DS_Store和.DS_Store的隱藏檔.
我怎麼發現的, 程式碼如下:
import os, imghdr
files = []
for r, d, f in os.walk("./simpsons_dataset/"):
for fi in f:
files.append(os.path.join(r, fi))
for f in files:
if imghdr.what(f) != "jpeg":
print("%s : %s"%(f, imghdr.what(f)))
最後會發現:
./nelson_muntz/._.DS_Store : None
./nelson_muntz/.DS_Store : None