7

While trying to download the "Cats_vs_Dogs" TensorFlow dataset using the tfds module, I get the following error

DownloadError                             Traceback (most recent call last)
<ipython-input-2-244305a07c33> in <module>()
      7     split=['train[:80%]', 'train[80%:90%]', 'train[90%:]'],
      8     with_info=True,
----> 9     as_supervised=True,
     10 )

21 frames
/usr/local/lib/python3.7/dist-packages/tensorflow_datasets/core/download/downloader.py in _assert_status(response)
    257   if response.status_code != 200:
    258     raise DownloadError('Failed to get url {}. HTTP code: {}.'.format(
--> 259         response.url, response.status_code))

DownloadError: Failed to get url https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_3367a.zip. HTTP code: 404.

The code I have used is

import tensorflow_datasets as tfds
tfds.disable_progress_bar()

# split the data manually into 80% training, 10% testing, 10% validation
(raw_train, raw_validation, raw_test), metadata = tfds.load(
    'cats_vs_dogs',
    split=['train[:80%]', 'train[80%:90%]', 'train[90%:]'],
    with_info=True,
    as_supervised=True,
)

It worked yesterday but suddenly gave an error today.......

IHackmer19
  • 71
  • 1
  • 5

4 Answers4

12

You can add this before loading to set the new URL :

setattr(tfds.image_classification.cats_vs_dogs, '_URL',"https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_5340.zip")
u2gilles
  • 6,888
  • 7
  • 51
  • 75
1

Here is a temporary solution that worked for me, Add below line with url

    #Added code
    
        setattr(tfds.image_classification.cats_vs_dogs, '_URL',"https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_5340.zip")
        
   
#Initial code that failed with the error
        
        (train_examples, validation_examples), info = tfds.load(
            'cats_vs_dogs',
            split=['train[:80%]', 'train[80%:]'],
            with_info=True,
            as_supervised=True,
        )

#Complete code together

setattr(tfds.image_classification.cats_vs_dogs, '_URL',"https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_5340.zip")
(train_examples, validation_examples), info = tfds.load(
    'cats_vs_dogs',
    split=['train[:80%]', 'train[80%:]'],
    with_info=True,
    as_supervised=True,
)
Magige Daniel
  • 1,024
  • 1
  • 10
  • 10
  • 2
    Do I need a different workaround for the version of TFDS I'm using in a Udacity workspace? `module 'tensorflow_datasets' has no attribute 'image_classification'` This seems to work on my version: ``` # fix dataset url setattr(tfds.image.cats_vs_dogs, '_URL',"https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_5340.zip") ``` But ... then I get a checksum error. – Geoffrey Wiseman Aug 13 '22 at 01:32
0

It's failing since yesterday

https://github.com/tensorflow/datasets/issues/3918

It seems that they changed the url and forgot about tensorflow datasets :-(

  • But can we manually give a link...... If possible – IHackmer19 May 12 '22 at 04:38
  • New url seems to be https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kkagglecatsanddogs_5340.zip. Not sure if it's exactly the same datasets, but I seems so. – moarra May 24 '22 at 13:10
-1

It is indicated That 'DownloadError'. It is probably about your internet connection or you had reached the limit of download of a day on Google Colab.

Nephes Dr
  • 21
  • 1
  • 5