Search code examples
pythondeep-learningcomputer-visiongoogle-colaboratoryresnet

KeyError 250000 when trying to create an image dataset


I'm trying to create an image dataset on Colab and I'm getting the following error:

Item no.: 1 --> Item name = jaguar
Evaluating...
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-15-9097d8d70946> in <module>()
     19         }   #creating list of arguments
     20 response  = google_images_download.googleimagesdownload()   #class instantiation
---> 21 response.download(arguments)

2 frames
/usr/local/lib/python3.6/dist-packages/google_images_download/google_images_download.py in build_url_parameters(self, arguments)
    405         for key, value in params.items():
    406             if value[0] is not None:
--> 407                 ext_param = value[1][value[0]]
    408                 # counter will tell if it is first param added or not
    409                 if counter == 0:

KeyError: 250000

This is my code:

from google_images_download import google_images_download 

keyws   = "jaguar"
limit   = 1000
chromedriver = chromedriver_path
offset  = None
color_type  = None
size    = 500*500
usage_rights    = 'labeled-for-reuse'

arguments = {
        "keywords" : keyws,
        "limit" :limit,
        "chromedriver":chromedriver,
        "offset" : offset,
        "color_type" : color_type,
        "size" : size,
        "usage_rights" : usage_rights
        }
response  = google_images_download.googleimagesdownload()
response.download(arguments)  

The error is pointing to my response = google_images_download.googleimagesdownload() line. I tried looking up the error but couldn't find anything about it. This is my first time coming across this error so I really don't know why my code is causing it.


Solution

  • What I see in the code for over at github is that the size parameter does not take integers. It takes categorical values described in this page

    Possible values:

    large, medium, icon, >400*300, >640*480, >800*600, 1024*768, >2MP, >4MP, >6MP, >8MP, >10MP, >12MP, >15MP, >20MP, >40MP, >70MP