본문 바로가기
Python with AI

Download Error Solution for tfds.load on Tensorflow Dataset | 텐서플로우 데이타셋 다운로드 에러 해결방안

by Oliver J 2023. 6. 28.
반응형

텐서플로우는 다양한 dataset을 제공하지만, 간혹 다운로드가 안 되는 경우가 발생한다.(직접 해당 dataset URL에서 받아서 활용할 수도 있지만 여기서는 dataset URL을 변경하는 방법을 설명한다.)

Tensorflow provides various datasets. However, you may face a download error message. 

(You can also download directly from the URL)

 

여기서는 cats_vs_dogs dataset의 URL문제 해결방법을 설명합니다.

(간단하게 패키지를 타고 들어가서 _URL을 수정해 주면 됩니다.  tensorflow_datasets > image_classification > CatsVsDogs > change _URL parameter )

 

In that case, here's the URL solution for cats_vs_dogs dataset. 

(Long story short, tensorflow_datasets > image_classification > CatsVsDogs > change _URL parameter)

 

텐서플로우 dataset 패키지로 들어가세요~

Go into the tensorflow_datasets package 

import tensorflow_datasets as tfds

그러면 아래와 같이 다양한 dataset 패키지들이 보입니다~(목적에 따라 에러가 나는 패키지로 들어가세요~)

You can find the blow datasets packages(you can follow the below package by purpose)

# Imports for registration
from tensorflow_datasets import audio
from tensorflow_datasets import graphs
from tensorflow_datasets import image
from tensorflow_datasets import image_classification
from tensorflow_datasets import object_detection
from tensorflow_datasets import question_answering
from tensorflow_datasets import d4rl
from tensorflow_datasets import structured
from tensorflow_datasets import summarization
from tensorflow_datasets import text
from tensorflow_datasets import translate
from tensorflow_datasets import video
from tensorflow_datasets import vision_language

 

여기 포스팅은 cats_vs_dogs패키지 URL수정하는 방법을 설명합니다.

(This posting would modify "cats_vs_dogs" dataset URL.)

 

Thus, go into the image_classification and then CatsVsDogs

from tensorflow_datasets import image_classification
"""Image Classification datasets."""

from tensorflow_datasets.image_classification.beans import Beans
from tensorflow_datasets.image_classification.bigearthnet import Bigearthnet
from tensorflow_datasets.image_classification.binary_alpha_digits import BinaryAlphaDigits
from tensorflow_datasets.image_classification.caltech import Caltech101
from tensorflow_datasets.image_classification.caltech_birds import CaltechBirds2010
from tensorflow_datasets.image_classification.cars196 import Cars196
from tensorflow_datasets.image_classification.cassava import Cassava
from tensorflow_datasets.image_classification.cats_vs_dogs import CatsVsDogs

Change _URL parameter like below. (Microsoft seems to change the URL)

# _URL = ("https://download.microsoft.com/download/3/E/1/3E1C3F21-"
#         "ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_3367a.zip")
_URL = ("https://download.microsoft.com/download/3/E/1/3E1C3F21-"
"ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_5340.zip")
반응형

텐서플로우 dataset은 해당 데이타를 특정 주소에서부터 다운로드하는 방식이므로 원천 dataset 제공자의 의도나 목적에 따라 dataset 소스의 주소는 쉽게 변경될 수 있지만 텐서플로우팀에서 내부 패키지를 수정하는 데에는 시간이 오래 걸릴 수 있다. 따라서 해당 패키지의 내부 주소를 변경하거나 직접 해당 주소에서 받아서 활용하는 방법이 해결책이 될 수 있다. 

According to the policy or other reasons, the dataset's location can change to the providers' purpose. Therefore, this can be one of the solutions until TensorflowTeam modifies the package.

 

 

Voila~Yay!

728x90
반응형