Skip to content

Instantly share code, notes, and snippets.

View takahish's full-sized avatar

Takahiro Ishikawa takahish

View GitHub Profile
@takahish
takahish / transfer_learning_import_datasets_1.py
Created December 1, 2018 05:21
we import a dataset of dog images. We populate a few variables through the use of the load_files function from the scikit-learn library.
from sklearn.datasets import load_files
from keras.utils import np_utils
import numpy as np
from glob import glob
# define function to load train, test, and validation datasets
def load_dataset(path):
data = load_files(path)
dog_files = np.array(data['filenames'])
dog_targets = np_utils.to_categorical(np.array(data['target']), 133)