辛普森家庭dataset的問題

心館惜
Join to follow...
Follow/Unfollow Writer: 心館惜
By following, you’ll receive notifications when this author publishes new articles.
Don't wait! Sign up to follow this writer.
WriterShelf is a privacy-oriented writing platform. Unleash the power of your voice. It's free!
Sign up. Join WriterShelf now! Already a member. Login to WriterShelf.
717   0  
·
2019/04/21
·
1 mins read


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


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


Share this article:



Join the discussion now!
Don't wait! Sign up to join the discussion.
WriterShelf is a privacy-oriented writing platform. Unleash the power of your voice. It's free!
Sign up. Join WriterShelf now! Already a member. Login to WriterShelf.