Keras Model not allowing me to train on a single data point for Active Learning

149 views Asked by At

I have a Keras Model with the following summary saved to a file.

    Layer (type)                 Output Shape              Param #   
=================================================================
conv2d_1 (Conv2D)            (None, 70, 8, 64)         640       
_________________________________________________________________
dense_1 (Dense)              (None, 70, 8, 720)        46800     
_________________________________________________________________
dense_2 (Dense)              (None, 70, 8, 720)        519120    
_________________________________________________________________
dense_3 (Dense)              (None, 70, 8, 100)        72100     
_________________________________________________________________
conv2d_2 (Conv2D)            (None, 68, 6, 32)         28832     
_________________________________________________________________
flatten_1 (Flatten)          (None, 13056)             0         
_________________________________________________________________
dense_4 (Dense)              (None, 2)                 26114     
=================================================================
Total params: 693,606
Trainable params: 693,606
Non-trainable params: 0
_________________________________________________________________
None

My training and testing data shapes are (120,72,10,1) and (20,72,10,1) respectively. When I try and retrain, the model won't accept anything smaller that (4,72,10,1), when I am trying to train on a single data point (1,72,10,1). The following is the error that I am receiving.

Traceback (most recent call last):
  File "./classifier.py", line 62, in <module>
    classifier.fit(test_point, y_test[i])
  File "/home/jazz/.local/lib/python3.5/site-packages/keras/engine/training.py", line 952, in fit
    batch_size=batch_size)
  File "/home/jazz/.local/lib/python3.5/site-packages/keras/engine/training.py", line 789, in _standardize_user_data
    exception_prefix='target')
  File "/home/jazz/.local/lib/python3.5/site-packages/keras/engine/training_utils.py", line 138, in standardize_input_data
    str(data_shape))
ValueError: Error when checking target: expected dense_4 to have shape (2,) but got array with shape (1,)

I have no idea how to move forward with this, any help is appreciated.

0

There are 0 answers