前提・実現したいこと
Dogs vs. Cats Redux: Kernels Edition
https://www.kaggle.com/c/dogs-vs-cats-redux-kernels-edition/overview
を勉強中です。
google Colaboratoryを利用中。
発生している問題・エラーメッセージ
error: OpenCV(3.4.3) /io/opencv/modules/imgproc/src/resize.cpp:4044: error: (-215:Assertion failed) !ssize.empty() in function 'resize'
該当のソースコード
python
1def read_image(file_path): 2 img = cv2.imread(file_path, cv2.IMREAD_COLOR) #cv2.IMREAD_GRAYSCALE 3 return cv2.resize(img, (ROWS, COLS), interpolation=cv2.INTER_CUBIC) 4 5 6def prep_data(images): 7 count = len(images) 8 data = np.ndarray((count, CHANNELS, ROWS, COLS), dtype=np.uint8) 9 10 for i, image_file in enumerate(images): 11 image = read_image(image_file) 12 data[i] = image.T 13 if i%250 == 0: print('Processed {} of {}'.format(i, count)) 14 15 return data 16 17train = prep_data(train_images) 18test = prep_data(test_images)
試したこと
画像の読み込み・フォルダは
from google.colab import drive drive.mount('/content/drive') TRAIN_DIR = '/content/drive/My Drive/Colab Notebooks/doogscats/train' TEST_DIR = '/content/drive/My Drive/Colab Notebooks/doogscats/test'
で指定しました。
len(train_images)
で格納枚数25000枚も確認できています。
train = prep_data(train_images) test = prep_data(test_images)
でどうしても詰まってしまいます。
よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/06/26 06:28