尝试创建图像数据集时出现KeyError 250000

时间:2020-03-16 00:29:21

标签: python deep-learning computer-vision google-colaboratory resnet

我正在尝试在Colab上创建图像数据集,但出现以下错误:

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

这是我的代码:

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)  

错误指向我的response = google_images_download.googleimagesdownload()行。我尝试查找错误,但找不到任何有关此错误的信息。这是我第一次遇到此错误,因此我真的不知道为什么我的代码会导致此错误。

1 个答案:

答案 0 :(得分:1)

我在github的代码结束处看到的是size参数不使用整数。它采用此page

中描述的分类值

可能的值:

大,中,图标,> 400 * 300,> 640 * 480,> 800 * 600、1024 * 768,> 2MP,> 4MP,> 6MP,> 8MP,> 10MP,> 12MP,> 15MP,> 20MP,> 40MP,> 70MP