Help us understand the problem. What is going on with this article?

画像取り込み時、ValueError

More than 1 year has passed since last update.

初投稿。
Kerasにて、画像分類を行う途中で発生した恥ずかしいエラーをメモ的に残す。

test.py
Using TensorFlow backend.
data/train/xxxxx/001.jpg
(3, 120, 120)
data/train/xxxxx/002.jpg
(3, 120, 120)
data/train/xxxxx/003.jpg
(4, 120, 120)
data/train/xxxxx/004.jpg
(3, 120, 120)
data/train/xxxxx/005.jpg
(3, 120, 120)
data/train/xxxxx/006.jpg
(3, 120, 120)
data/train/xxxxx/007.jpg
(3, 120, 120)
data/train/xxxxx/008.jpg
(3, 120, 120)
data/train/xxxxx/009.jpg
(3, 120, 120)
###################################
Traceback (most recent call last):
  File "test.py", line 74, in <module>
    history = model.fit(images_list, Y, epochs=5, batch_size=10, validation_split=0.1)
  File "/usr/lib64/python3.6/site-packages/keras/models.py", line 870, in fit
    initial_epoch=initial_epoch)
  File "/usr/lib64/python3.6/site-packages/keras/engine/training.py", line 1435, in fit
    batch_size=batch_size)
  File "/usr/lib64/python3.6/site-packages/keras/engine/training.py", line 1311, in _standardize_user_data
    exception_prefix='input')
  File "/usr/lib64/python3.6/site-packages/keras/engine/training.py", line 127, in _standardize_input_data
    str(array.shape))
ValueError: Error when checking input: expected conv2d_1_input to have 4 dimensions, but got array with shape (36, 1)

RGBの3次元を扱う想定が、4次元になっているのがいた模様。
そういえば、png→jpgにした画像あったなと、恥ずか悲しいエラー。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした