Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TensorFlow CIFAR10 Example

Tags:

tensorflow

I am trying to run the entire CIFAR10 as is, with data from SVHN.

http://ufldl.stanford.edu/housenumbers/

I formatted the data in the exact format as the bin file from Alex Krizhevsky's website.

http://www.cs.toronto.edu/~kriz/cifar.html

I did not edit the code, other than changing a few variable names to make it work in another directory. It gives me an error now.

W tensorflow/core/common_runtime/executor.cc:1076] 0x218fec0 Compute status: Invalid argument: Indices are not valid (out of bounds).  Shape: dim { size: 128 } dim { size: 10 }
 [[Node: SparseToDense = SparseToDense[T=DT_FLOAT, Tindices=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"](concat, SparseToDense/output_shape, SparseToDense/sparse_values, SparseToDense/default_value)]]

Specifically, the line that fails in cifar.py is:

dense_labels = tf.sparse_to_dense(concated,[FLAGS.batch_size, NUM_CLASSES],1.0, 0.0)

I have checked this solution too, it does not work.

TensorFlow Indices are not valid (out of bounds)

Anyone has any idea on how to make it work?

like image 603
jkschin Avatar asked Sep 20 '26 17:09

jkschin


1 Answers

I realized the mistake. The SVHN dataset gave the number 0 a value of 10, instead of 0. I made this fatal assumption from the start and it wasted a lot of my time.

Given 10 classes, the labels should range from 0-9, inclusive. The error happened because the labels ranged from 1-10.

http://ufldl.stanford.edu/housenumbers/

Do remember to read overviews in future!

like image 101
jkschin Avatar answered Sep 26 '26 05:09

jkschin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!