question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when checking target: ValueError: expected regression to have shape (None, None, 4)

See original GitHub issue

I’m trying to train with my own dataset in a csv but I get this: Epoch 1/20 Traceback (most recent call last):

File "examples/train_csv.py", line 117, in <module>
  keras.callbacks.ReduceLROnPlateau(monitor='loss', factor=0.1, patience=2, verbose=1, mode='auto', epsilon=0.0001, cooldown=0, min_lr=0),
File "/home/Team09/Desktop/SOEN321/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 87, in wrapper
  return func(*args, **kwargs)
File "/home/Team09/Desktop/SOEN321/lib/python3.6/site-packages/keras/engine/training.py", line 2114, in fit_generator
  class_weight=class_weight)
File "/home/Team09/Desktop/SOEN321/lib/python3.6/site-packages/keras/engine/training.py", line 1826, in train_on_batch
  check_batch_axis=True)
File "/home/Team09/Desktop/SOEN321/lib/python3.6/site-packages/keras/engine/training.py", line 1411, in _standardize_user_data
  exception_prefix='target')
File "/home/Team09/Desktop/SOEN321/lib/python3.6/site-packages/keras/engine/training.py", line 153, in _standardize_input_data
  str(array.shape))
ValueError: Error when checking target: expected regression to have shape (None, None, 4) but got array with shape (32, 67995, 5)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
hgaisercommented, Nov 21, 2017

That is a bug in the latest version of Keras. Try using Keras 2.0.9.

Side note: could you leave this issue open? There are a lot of people experiencing this problem. Will help them to find it.

0reactions
hgaisercommented, Dec 3, 2017

This should be fixed with keras 2.1.2, closing this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when checking target: expected dense_2 to have shape ...
My data is not of images (yet) but they are sequences I've turned in to data frames. model = Sequential() model.add(Dense(30, input_dim=16, ...
Read more >
ValueError: Error when checking target: expected dense_14 to ...
My understanding of the structure is that my input of (928,4,4,512) which sets the input shape to the flatten_9 layer at (none, ...
Read more >
valueerror: the target 'y' needs to have more than 1 class. got 1 class ...
I'm having trouble with the RandomOverSampler throwing an error on the number of classes in the y input. When I use the below...
Read more >
'Error when checking model input: expected no data, but got ...
I'm trying to build an inception and resnet model with my own image data. The dataset is 8000 images in total and has...
Read more >
Shaping and reshaping NumPy and pandas objects to avoid ...
If our data were stored in a 1D NumPy array, then we could do what the error message suggests and turn it into...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found