質問編集履歴

2

文章の修正

2020/07/21 14:15

投稿

_mini
_mini

スコア15

test CHANGED
File without changes
test CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
 
18
18
 
19
- predict.py 文字数のため、変更部分のみ記入(他部分は参照サイトと同じ)
19
+ predict.py
20
20
 
21
21
  ```ここに言語を入力
22
22
 

1

コードの修正

2020/07/21 14:15

投稿

_mini
_mini

スコア15

test CHANGED
File without changes
test CHANGED
@@ -14,201 +14,229 @@
14
14
 
15
15
 
16
16
 
17
+
18
+
17
- sumple_cnn_classification.py
19
+ predict.py 文字数のため、変更部分のみ記入(他部分は参照サイトと同じ)
18
20
 
19
21
  ```ここに言語を入力
20
22
 
21
- from keras.layers import Conv2D, MaxPooling2D
23
+
22
-
23
- from keras.layers import Dense, Dropout, Flatten
24
+
25
+
24
26
 
25
27
  from keras.models import Sequential
26
28
 
27
- import keras
29
+ from keras.layers import Activation, Dense, Dropout
28
-
30
+
29
- from sklearn.model_selection import train_test_split
31
+ from keras.utils.np_utils import to_categorical
32
+
30
-
33
+ from keras.optimizers import Adagrad
34
+
31
- from keras.preprocessing import image
35
+ from keras.optimizers import Adam
32
36
 
33
37
  import numpy as np
34
38
 
35
- import tensorflow as tf
36
-
37
- import random as rn
39
+ from PIL import Image
38
40
 
39
41
  import os
40
42
 
41
- from keras import backend as K
43
+
42
-
44
+
43
- import matplotlib.pyplot as plt
45
+ # 学習用のデータを作る.
44
-
45
-
46
-
47
- os.environ['PYTHONHASHSEED'] = '0'
46
+
48
-
49
- np.random.seed(0)
47
+ image_list = []
50
-
51
- rn.seed(0)
48
+
52
-
53
- session_conf = tf.compat.v1.ConfigProto(
54
-
55
- intra_op_parallelism_threads=1, inter_op_parallelism_threads=1)
56
-
57
- tf.set_random_seed(0)
58
-
59
- sess = tf.Session(graph=tf.get_default_graph(), config=session_conf)
60
-
61
- K.set_session(sess)
62
-
63
- sess = tf.Session(config=tf.ConfigProto(device_count={'GPU': 0}))
64
-
65
-
66
-
67
- input_shape = (224, 224, 3)
68
-
69
- batch_size = 128
49
+ label_list = []
70
-
71
- epochs = 100
50
+
72
-
51
+
52
+
73
- num_classes = 2
53
+ # ./data/train 以下のorange,appleディレクトリ以下の画像を読み込む。
74
-
75
- x = []
54
+
76
-
77
- y = []
78
-
79
- for f in os.listdir("jiro"):
55
+ for dir in os.listdir("data/train"):
80
-
56
+
81
- if f == ".DS_Store":
57
+ if dir == ".DS_Store":
82
58
 
83
59
  continue
84
60
 
61
+
62
+
63
+ dir1 = "data/train/" + dir
64
+
65
+ label = 0
66
+
67
+
68
+
69
+ if dir == "次郎": # appleはラベル0
70
+
71
+ label = 0
72
+
73
+ elif dir == "次郎ではない": # orangeはラベル1
74
+
75
+ label = 1
76
+
77
+
78
+
79
+ for file in os.listdir(dir1):
80
+
81
+ if file != ".DS_Store":
82
+
83
+ # 配列label_listに正解ラベルを追加(りんご:0 オレンジ:1)
84
+
85
+ label_list.append(label)
86
+
87
+ filepath = dir1 + "/" + file
88
+
89
+ # 画像を25x25pixelに変換し、1要素が[R,G,B]3要素を含む配列の25x25の2次元配列として読み込む。
90
+
91
+ # [R,G,B]はそれぞれが0-255の配列。
92
+
93
+ image = np.array(Image.open(filepath).resize((25, 25)))
94
+
95
+ print(filepath)
96
+
97
+ # 配列を変換し、[[Redの配列],[Greenの配列],[Blueの配列]] のような形にする。
98
+
99
+ image = image.transpose(2, 0, 1)
100
+
101
+ # さらにフラットな1次元配列に変換。最初の1/3はRed、次がGreenの、最後がBlueの要素がフラットに並ぶ。
102
+
103
+ image = image.reshape(
104
+
105
+ 1, image.shape[0] * image.shape[1] * image.shape[2]).astype("float32")[0]
106
+
107
+ # 出来上がった配列をimage_listに追加。
108
+
109
+ image_list.append(image / 255.)
110
+
111
+
112
+
113
+ # kerasに渡すためにnumpy配列に変換。
114
+
85
- x.append(image.img_to_array(image.load_img(
115
+ image_list = np.array(image_list)
116
+
117
+
118
+
86
-
119
+ # ラベルの配列を1と0からなるラベル配列に変更
120
+
121
+ # 0 -> [1,0], 1 -> [0,1] という感じ。
122
+
123
+ Y = to_categorical(label_list)
124
+
125
+
126
+
127
+ # モデルを生成してニューラルネットを構築
128
+
129
+ model = Sequential()
130
+
131
+ model.add(Dense(200, input_dim=1875))
132
+
133
+ model.add(Activation("relu"))
134
+
135
+ model.add(Dropout(0.2))
136
+
137
+
138
+
139
+ model.add(Dense(200))
140
+
141
+ model.add(Activation("relu"))
142
+
143
+ model.add(Dropout(0.2))
144
+
145
+
146
+
147
+ model.add(Dense(2))
148
+
149
+ model.add(Activation("softmax"))
150
+
151
+
152
+
153
+ # オプティマイザにAdamを使用
154
+
155
+ opt = Adam(lr=0.001)
156
+
157
+ # モデルをコンパイル
158
+
87
- "jiro/"+f, target_size=input_shape[:2])))
159
+ model.compile(loss="categorical_crossentropy",
160
+
88
-
161
+ optimizer=opt, metrics=["accuracy"])
162
+
163
+ # 学習を実行。10%はテストに使用。
164
+
165
+ model.fit(image_list, Y, nb_epoch=1500, batch_size=100, validation_split=0.1)
166
+
167
+
168
+
169
+ # テスト用ディレクトリ(./data/train/)の画像でチェック。正解率を表示する。
170
+
171
+ total = 0.
172
+
89
- y.append(0)
173
+ ok_count = 0.
90
-
174
+
175
+
176
+
91
- for f in os.listdir("not-jiro"):
177
+ for dir in os.listdir("data/train"):
92
-
178
+
93
- if f == ".DS_Store":
179
+ if dir == ".DS_Store":
94
180
 
95
181
  continue
96
182
 
97
- x.append(image.img_to_array(image.load_img(
98
-
99
- "not-jiro/"+f, target_size=input_shape[:2])))
100
-
101
- y.append(1)
102
-
103
-
104
-
105
- x = np.asarray(x)
106
-
107
- x /= 255
108
-
109
- y = np.asarray(y)
110
-
111
- y = keras.utils.to_categorical(y, num_classes)
112
-
113
- x_train, x_test, y_train, y_test = train_test_split(
114
-
115
- x, y, test_size=0.33, random_state=3)
116
-
117
-
118
-
119
- model = Sequential()
120
-
121
- model.add(Conv2D(32, kernel_size=(3, 3),
122
-
123
- activation='relu',
124
-
125
- input_shape=input_shape))
126
-
127
- model.add(Conv2D(64, (3, 3), activation='relu'))
128
-
129
- model.add(MaxPooling2D(pool_size=(2, 2)))
130
-
131
- model.add(Dropout(0.25))
132
-
133
- model.add(Flatten())
134
-
135
- model.add(Dense(128, activation='relu'))
136
-
137
- model.add(Dropout(0.5))
138
-
139
- model.add(Dense(num_classes, activation='softmax'))
140
-
141
- model.compile(loss=keras.losses.categorical_crossentropy,
142
-
143
- optimizer="SGD",
144
-
145
- metrics=['accuracy'])
146
-
147
- history = model.fit(x_train, y_train,
148
-
149
- batch_size=batch_size,
150
-
151
- epochs=epochs,
152
-
153
- verbose=1,
154
-
155
- validation_data=(x_test, y_test))
156
-
157
- model.save_weights('param.hdfs')
158
-
159
-
160
-
161
- acc = history.history["accuracy"]
162
-
163
- val_acc = history.history["val_accuracy"]
164
-
165
- loss = history.history["loss"]
166
-
167
- val_loss = history.history["val_loss"]
168
-
169
-
170
-
171
- epochs = range(1, len(acc) + 1)
172
-
173
-
174
-
175
- plt.plot(history.history["accuracy"], label="Training Acc")
176
-
177
- plt.plot(history.history["val_accuracy"], label="Validation Acc")
178
-
179
- plt.ylabel('Accuracy')
180
-
181
- plt.xlabel('Epoch')
182
-
183
- plt.grid()
184
-
185
- plt.legend(['Train', 'Validation'], loc = 'upper left')
186
-
187
- plt.savefig('acc.png')
188
-
189
- plt.figure()
190
-
191
-
192
-
193
- plt.plot(history.history["loss"], label="Training Loss")
194
-
195
- plt.plot(history.history["val_loss"], label="Validation Loss")
196
-
197
- plt.ylabel('Loss')
198
-
199
- plt.xlabel('Epoch')
200
-
201
- plt.grid()
202
-
203
- plt.legend(['Train', 'Validation'], loc = 'upper left')
204
-
205
- plt.savefig('loss.png')
206
-
207
- plt.figure()
208
-
209
-
210
-
211
- plt.show()
183
+
184
+
185
+ dir1 = "data/jirou-test/" + dir
186
+
187
+ label = 0
188
+
189
+
190
+
191
+ if dir == "次郎":
192
+
193
+ label = 0
194
+
195
+ elif dir == "次郎ではない":
196
+
197
+ label = 1
198
+
199
+
200
+
201
+ for file in os.listdir(dir1):
202
+
203
+ if file != ".DS_Store":
204
+
205
+ label_list.append(label)
206
+
207
+ filepath = dir1 + "/" + file
208
+
209
+ image = np.array(Image.open(filepath).resize((25, 25)))
210
+
211
+ print(filepath)
212
+
213
+ image = image.transpose(2, 0, 1)
214
+
215
+ image = image.reshape(
216
+
217
+ 1, image.shape[0] * image.shape[1] * image.shape[2]).astype("float32")[0]
218
+
219
+ result = model.predict_classes(np.array([image / 255.]))
220
+
221
+ print("label:", label, "result:", result[0])
222
+
223
+
224
+
225
+ total += 1.
226
+
227
+
228
+
229
+ if label == result[0]:
230
+
231
+ ok_count += 1.
232
+
233
+
234
+
235
+ print("正解率: ", ok_count / total * 100, "%")
236
+
237
+
238
+
239
+
212
240
 
213
241
 
214
242
 
@@ -216,178 +244,98 @@
216
244
 
217
245
 
218
246
 
247
+
248
+
249
+
250
+
219
- predict.py 字数のため、変更部分のみ記入(他部分は参照サイトと同じ)
251
+ エラー
220
252
 
221
253
  ```ここに言語を入力
222
254
 
223
-
224
-
225
-
226
-
227
-
228
-
229
- # ./data/train 以下のorange,appleディレクトリ以下の画像を読み込む。
230
-
231
- for dir in os.listdir("data/train"):
232
-
233
- if dir == ".DS_Store":
234
-
235
- continue
236
-
237
-
238
-
239
- dir1 = "data/train/" + dir
240
-
241
- label = 0
242
-
243
-
244
-
245
- if dir == "次郎": # 次郎はラベル0
246
-
247
- label = 0
248
-
249
- elif dir == "次郎ではない": # not次郎はラベル1
250
-
251
- label = 1
252
-
253
-
254
-
255
-
256
-
257
-
258
-
259
- # テスト用ディレクトリ(./data/train/)の画像でチェック。正解率を表示する。
260
-
261
- total = 0.
262
-
263
- ok_count = 0.
264
-
265
-
266
-
267
- for dir in os.listdir("data/train"):
268
-
269
- if dir == ".DS_Store":
270
-
271
- continue
272
-
273
-
274
-
275
- dir1 = "data/jirou-test/" + dir
276
-
277
- label = 0
278
-
279
-
280
-
281
- if dir == "次郎":
282
-
283
- label = 0
284
-
285
- elif dir == "次郎ではない":
286
-
287
- label = 1
288
-
289
-
290
-
291
-
292
-
293
-
255
+ (base) xxxx@xxxx image-classfication-jiro % /opt/anaconda3/bin/python /Users/xxxx/Downloads/image-classfication-jiro/predict.py
256
+
257
+ Using TensorFlow backend.
258
+
259
+ /opt/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
260
+
261
+ _np_qint8 = np.dtype([("qint8", np.int8, 1)])
262
+
263
+ /opt/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
264
+
265
+ _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
266
+
267
+ /opt/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
268
+
269
+ _np_qint16 = np.dtype([("qint16", np.int16, 1)])
270
+
271
+ /opt/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
272
+
273
+ _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
274
+
275
+ /opt/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
276
+
277
+ _np_qint32 = np.dtype([("qint32", np.int32, 1)])
278
+
279
+ /opt/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
280
+
281
+ np_resource = np.dtype([("resource", np.ubyte, 1)])
282
+
283
+ /opt/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
284
+
285
+ _np_qint8 = np.dtype([("qint8", np.int8, 1)])
286
+
287
+ /opt/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
288
+
289
+ _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
290
+
291
+ /opt/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
292
+
293
+ _np_qint16 = np.dtype([("qint16", np.int16, 1)])
294
+
295
+ /opt/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
296
+
297
+ _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
298
+
299
+ /opt/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
300
+
301
+ _np_qint32 = np.dtype([("qint32", np.int32, 1)])
302
+
303
+ /opt/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
304
+
305
+ np_resource = np.dtype([("resource", np.ubyte, 1)])
306
+
307
+ data/train/not-jiro/images-3.jpeg
308
+
309
+ ・・・・
310
+
311
+ data/train/jiro/hJLxemaOWndtlpzjbdVroI0DTL91CFuP.jpg
312
+
313
+ data/train/jiro/image.jpg
314
+
315
+ data/train/jiro/XHjnENbJCUCB3Xr7skOdOuq9Aoec7mlt.jpg
316
+
317
+ /Users/xxxx/Downloads/image-classfication-jiro/predict.py:70: UserWarning: The `nb_epoch` argument in `fit` has been renamed `epochs`.
318
+
319
+ model.fit(image_list, Y, nb_epoch=1500, batch_size=100, validation_split=0.1)
320
+
321
+ Traceback (most recent call last):
322
+
323
+ File "/Users/xxxxx/Downloads/image-classfication-jiro/predict.py", line 70, in <module>
324
+
325
+ model.fit(image_list, Y, nb_epoch=1500, batch_size=100, validation_split=0.1)
326
+
327
+ File "/opt/anaconda3/lib/python3.7/site-packages/keras/engine/training.py", line 1154, in fit
328
+
329
+ batch_size=batch_size)
330
+
331
+ File "/opt/anaconda3/lib/python3.7/site-packages/keras/engine/training.py", line 621, in _standardize_user_data
332
+
333
+ exception_prefix='target')
334
+
335
+ File "/opt/anaconda3/lib/python3.7/site-packages/keras/engine/training_utils.py", line 145, in standardize_input_data
336
+
337
+ str(data_shape))
338
+
339
+ ValueError: Error when checking target: expected activation_3 to have shape (2,) but got array with shape (1,)
294
340
 
295
341
  ```
296
-
297
-
298
-
299
-
300
-
301
-
302
-
303
- エラー文
304
-
305
- ```ここに言語を入力
306
-
307
- (base) xxxx@xxxx image-classfication-jiro % /opt/anaconda3/bin/python /Users/xxxx/Downloads/image-classfication-jiro/predict.py
308
-
309
- Using TensorFlow backend.
310
-
311
- /opt/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
312
-
313
- _np_qint8 = np.dtype([("qint8", np.int8, 1)])
314
-
315
- /opt/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
316
-
317
- _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
318
-
319
- /opt/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
320
-
321
- _np_qint16 = np.dtype([("qint16", np.int16, 1)])
322
-
323
- /opt/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
324
-
325
- _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
326
-
327
- /opt/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
328
-
329
- _np_qint32 = np.dtype([("qint32", np.int32, 1)])
330
-
331
- /opt/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
332
-
333
- np_resource = np.dtype([("resource", np.ubyte, 1)])
334
-
335
- /opt/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
336
-
337
- _np_qint8 = np.dtype([("qint8", np.int8, 1)])
338
-
339
- /opt/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
340
-
341
- _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
342
-
343
- /opt/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
344
-
345
- _np_qint16 = np.dtype([("qint16", np.int16, 1)])
346
-
347
- /opt/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
348
-
349
- _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
350
-
351
- /opt/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
352
-
353
- _np_qint32 = np.dtype([("qint32", np.int32, 1)])
354
-
355
- /opt/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
356
-
357
- np_resource = np.dtype([("resource", np.ubyte, 1)])
358
-
359
- data/train/not-jiro/images-3.jpeg
360
-
361
- ・・・・
362
-
363
- data/train/jiro/hJLxemaOWndtlpzjbdVroI0DTL91CFuP.jpg
364
-
365
- data/train/jiro/image.jpg
366
-
367
- data/train/jiro/XHjnENbJCUCB3Xr7skOdOuq9Aoec7mlt.jpg
368
-
369
- /Users/xxxx/Downloads/image-classfication-jiro/predict.py:70: UserWarning: The `nb_epoch` argument in `fit` has been renamed `epochs`.
370
-
371
- model.fit(image_list, Y, nb_epoch=1500, batch_size=100, validation_split=0.1)
372
-
373
- Traceback (most recent call last):
374
-
375
- File "/Users/xxxxx/Downloads/image-classfication-jiro/predict.py", line 70, in <module>
376
-
377
- model.fit(image_list, Y, nb_epoch=1500, batch_size=100, validation_split=0.1)
378
-
379
- File "/opt/anaconda3/lib/python3.7/site-packages/keras/engine/training.py", line 1154, in fit
380
-
381
- batch_size=batch_size)
382
-
383
- File "/opt/anaconda3/lib/python3.7/site-packages/keras/engine/training.py", line 621, in _standardize_user_data
384
-
385
- exception_prefix='target')
386
-
387
- File "/opt/anaconda3/lib/python3.7/site-packages/keras/engine/training_utils.py", line 145, in standardize_input_data
388
-
389
- str(data_shape))
390
-
391
- ValueError: Error when checking target: expected activation_3 to have shape (2,) but got array with shape (1,)
392
-
393
- ```