I can’t seem to get to 63% accuracy on my model no matter how I tweak the metaparameters.

Also, I get an error calling plotImages() that I can’t figure out how to fix. Anybody out there give me a clue here?

```
model = Sequential()
model.add(tf.keras.Input(shape=(IMG_HEIGHT, IMG_WIDTH, 3)))
#model.add(tf.keras.layers.Conv2D(128, (3,3), strides = (2,2), activation='relu'))
model.add(tf.keras.layers.Conv2D(64, (2,2), strides = (2,2), activation='relu'))
model.add(tf.keras.layers.MaxPooling2D(4,(2,2)))
model.add(tf.keras.layers.Conv2D(32, (2,2), strides = (2,2), activation='relu'))
model.add(tf.keras.layers.MaxPooling2D(8,(2,2)))
model.add(tf.keras.layers.Conv2D(16, (2,2), strides = (2,2), activation='relu'))
model.add(tf.keras.layers.MaxPooling2D(2,2))
model.add(Flatten())
model.add(tf.keras.layers.Dense(2, activation='relu'))
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
model.summary()
probability_model = tf.keras.Sequential([model, tf.keras.layers.Softmax()])
#print(type(probability_model))
predictions = probability_model.predict(test_data_gen)#predictions is numpy.ndarray
probabilities = []#type=array
for p in predictions:
p =(np.round(p))
probabilities.append((p))
#print(predictions)
#print(probabilities[0])
get_one = []
for a in probabilities:
#print(a[0])
if a[0] > 0.5:
get_one.append(1)
else:
get_one.append(0)
print(get_one)
#print(test_data_gen)
plotImages(test_data_gen, get_one)
[0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1]
/usr/local/lib/python3.7/dist-packages/matplotlib/cbook/__init__.py:706: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
x = np.array(x, subok=True, copy=copy)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-36-8876e0f18596> in <module>()
18 #print(test_data_gen)
19
---> 20 plotImages(test_data_gen, get_one)
6 frames
/usr/local/lib/python3.7/dist-packages/matplotlib/cbook/__init__.py in safe_masked_invalid(x, copy)
704
705 def safe_masked_invalid(x, copy=False):
--> 706 x = np.array(x, subok=True, copy=copy)
707 if not x.dtype.isnative:
708 # Note that the argument to `byteswap` is 'inplace',
ValueError: could not broadcast input array from shape (150,150,3) into shape (1,)
```