import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
from tqdm import tqdm
import numpy as np
import os
from random import shuffle
import cv2
from google.colab import drive
drive.mount("/content/drive")
train_file="/content/drive/My Drive/Colab Notebooks/fashion/fashion-m
mnist_train.csv.zip"
test_file="/content/drive/My Drive/Colab Notebooks/fashion/fashion-
mnist_test.csv.zip"
import zipfile
with zipfile.ZipFile(train_file,'r')as z:
z.extractall()
with zipfile.ZipFile(test_file,'r')as z:
z.extractall()
1002 *
OP
-> Диск уже смонтирован в / content / drive; чтобы попытаться принудительно перемонтировать, вызовите drive.mount ("/ content / drive", force_remount = True).
ls
op ---> fashion-mnist_test.csv fashion-mnist_train.csv
def create_train_data():
training_data=[]
for img in tqdm(os.listdir(TRAIN_DIR)):
label=label_image(img)
path=os.path.join(TRAIN_DIR,img)
img=cv2.imread(path,cv2.IMREAD_GRAYSCALE)
img=cv2.resize(img,(IMG_SIZE,IMG_SIZE))
training_data.append([np.array(img),np.array(label)])
shuffle(training_data)
np.save('train_data.npy',training_data)
return training_data
train_data= create_train_data()
op-
<ipython-input-115-c7f44547c637> in create_train_data()
3 training_data=[]
4
----> 5 for img in tqdm(os.listdir(TRAIN_DIR)):
6 label=label_image(img)
7 path=os.path.join(TRAIN_DIR,img)
NotADirectoryError: [Errno 20] Not a directory: './fashion-
mnist_train.csv/'