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

File read error. #9

Open
xiehuanyi opened this issue Nov 24, 2022 · 1 comment
Open

File read error. #9

xiehuanyi opened this issue Nov 24, 2022 · 1 comment

Comments

@xiehuanyi
Copy link

I used numpy.fromfile api to read given data, but got wrong data. code are as follow:

import numpy as np
a = np.fromfile('data/train-images-idx3-ubyte', dtype=np.float32)
b = np.fromfile('data/train-labels-idx1-ubyte', dtype=np.uint8)
l_a = a.shape[0]
l_b = b.shape[0]
print(f"{l_a // (28*28)} images found")
print(f"{l_b} labels found")

and the output is this:

15000 images found
60008 labels found

It seems not all right. What's wrong with this solution and what can I do to run it properly?

@xiehuanyi
Copy link
Author

and I unzipped the data by the way

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

1 participant