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

Why labels printed are always 1? #29

Open
opoooo opened this issue Aug 14, 2019 · 2 comments
Open

Why labels printed are always 1? #29

opoooo opened this issue Aug 14, 2019 · 2 comments

Comments

@opoooo
Copy link

opoooo commented Aug 14, 2019

from tensorflow.examples.tutorials.mnist import input_data
data_sets = input_data.read_data_sets('.', False)
images, labels = data_sets.train.next_batch(50)
print(labels)

when i use the code above to show the labels, they are always [1,1,1,1,......,1,1,1]. Can anyone help me?

@Lighthouse-Yang
Copy link

I think you can inspect your code.Because my labels are right, But I have a new problem, how to make a two-classify

@RasmusAndreassen
Copy link

RasmusAndreassen commented Nov 17, 2021

Idk if this is even relevant to you anymore, but jic. anyone else has this problem; if you're using the provided test dataset, or another one with only two labels, then it might be because of line 15 in the python file
for dirname in os.listdir(name[0])[1:]: # [1:] Excludes .DS_Store from Mac OS
this removes the first result from the list, regardless of the name.

I suggest replacing it with

for dirname in os.listdir(name[0]):
	if dirname == '.DS_Store': # Mac OS stuff
		continue

or just removing the slicing operation ([1:]) altogether, since it's not important on a unix/linux system.

I'm mostly just writing this for anyone else who might want to use this repo, but encounters the same error

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

3 participants