Datasets:
Tasks:
Image Classification
Sub-tasks:
multi-class-image-classification
Languages:
English
Size:
1K<n<10K
Tags:
biology
License:
import os | |
from kaggle.api.kaggle_api_extended import KaggleApi | |
import shutil | |
import tarfile | |
data_dir = 'data/' | |
kaggle_api = KaggleApi() | |
kaggle_api.authenticate() | |
kaggle_api.dataset_download_files('gpiosenka/100-bird-species', path=data_dir, unzip=True) | |
# There is a bug in the dataset, where one of the folders is named "PARAKETT AUKLET" instead of "PARAKETT AUKLET" | |
# We fix it by adding a space to the valid folder, because train and test are wrong and also the names in the labels file | |
# Fixing the path | |
fault_path = os.path.join(data_dir, 'valid', 'PARAKETT AUKLET') | |
correct_path = os.path.join(data_dir, 'valid', 'PARAKETT AUKLET') | |
shutil.rmtree(correct_path, ignore_errors=True) | |
shutil.move(fault_path, correct_path) | |
# Compressing the train directory | |
with tarfile.open(os.path.join(data_dir, 'train.tar.gz'), 'w:gz') as tar: | |
tar.add(os.path.join(data_dir, 'train'), arcname=os.path.basename(os.path.join(data_dir, 'train'))) | |
# Compressing the test directory | |
with tarfile.open(os.path.join(data_dir, 'test.tar.gz'), 'w:gz') as tar: | |
tar.add(os.path.join(data_dir, 'test'), arcname=os.path.basename(os.path.join(data_dir, 'test'))) | |
# Compressing the valid directory | |
with tarfile.open(os.path.join(data_dir, 'valid.tar.gz'), 'w:gz') as tar: | |
tar.add(os.path.join(data_dir, 'valid'), arcname=os.path.basename(os.path.join(data_dir, 'valid'))) | |
os.remove(os.path.join(data_dir, 'EfficientNetB0-525-(224 X 224)- 98.97.h5')) | |