Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeseries classification from scratch's inference result shape is different from what I expected. #1929

Open
pstar0830 opened this issue Sep 13, 2024 · 1 comment
Assignees

Comments

@pstar0830
Copy link

Issue Type

Others

Source

source

Keras Version

3.0.5

Custom Code

Yes

OS Platform and Distribution

Ubuntu 22.04.1

Python version

3.10

GPU model and memory

No response

Current Behavior?

I am following the tutorial below.

The tutorial has training and evaluation code, but not inference code, so I wrote an inference code at the end of the code to test individual inference.

res = model.predict(x_test[0])  # x_test[0].shape : (500, 1)
res.shape # is (500, 2)

I can only use single input for the predict() (not batch input), I guess due to make_model(input_shape=x_train.shape[1:])
what I don't understand is that the res.shape is (500, 2), not (2).

model.input_shape is (None, 500, 1) and model.output_shape is (None, 2)

I used (500, 1) shaped input, but why I got (500, 2) shaped output?
Could someone tell me what I did wrong here?

Thank you in advance.

Standalone code to reproduce the issue or tutorial link

https://keras.io/examples/timeseries/timeseries_classification_from_scratch/

res = model.predict(x_test[0])  # x_test[0].shape : (500, 1)
res.shape # is (500, 2)

Relevant log output

No response

@pstar0830
Copy link
Author

when I use mode(x_test), it works fine.
don't know why predict() doesn't work..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants