Tensorflow: Tried SVHN by editing label 0-9, still not working
<p>I am trying to classify SVHN data set by following this tutorial: 
    <a href="https://stackoverflow.com/questions/34759227/tensorflow-cifar10-example/34763642">https://www.tensorflow.org/versions/0.6.0/tutorials/deep_cnn/index.html</a></p>

<p>I am using train_32x32.mat file. In order to use it with CNN code (mentioned above), I converted this .mat file to several .bin files using this simple code:</p>

<pre><code>import numpy as np
import scipy.io
from array import array

read_input = scipy.io.loadmat('data/train_32x32.mat')
j=0
output_file = open('data_batch_%d.bin' % j, 'ab')

for i in range(0, 64000):

  # create new bin file
  if i&gt;0 and i % 12800 == 0:
    output_file.close()
    j=j+1
    output_file = open('data_batch_%d.bin' % j, 'ab')

  # Write to bin file
  if read_input['y'][i] == 10:
    read_input['y'][i] = 0
  read_input['y'][i].astype('uint8').tofile(output_file)
  read_input['X'][:,:,:,i].astype('uint32').tofile(output_file)

output_file.close()
</code></pre>

<p>But when I tried to classify SVHN using these customized .bin files I'm getting stuck with error "Invalid argument: Indices are not valid (out of bounds)" listed below:</p>

<pre><code>Filling queue with 20000 CIFAR images before starting to train. This will take a few minutes.
I tensorflow/core/common_runtime/local_device.cc:25] Local device intra op parallelism threads: 4
I tensorflow/core/common_runtime/local_session.cc:45] Local session inter op parallelism threads: 4
W tensorflow/core/common_runtime/executor.cc:1027] 0x1a53160 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)]]
Traceback (most recent call last):
  File "cifar10_train.py", line 138, in &lt;module&gt;
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/default/_app.py", line 11, in run
    sys.exit(main(sys.argv))
  File "cifar10_train.py", line 134, in main
    train()
  File "cifar10_train.py", line 104, in train
    _, loss_value = sess.run([train_op, loss])
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 345, in run
    results = self._do_run(target_list, unique_fetch_targets, feed_dict_string)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 419, in _do_run
    e.code)
tensorflow.python.framework.errors.InvalidArgumentError: 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)]]
Caused by op u'SparseToDense', defined at:
  File "cifar10_train.py", line 138, in &lt;module&gt;
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/default/_app.py", line 11, in run
    sys.exit(main(sys.argv))
  File "cifar10_train.py", line 134, in main
    train()
  File "cifar10_train.py", line 76, in train
    loss = cifar10.loss(logits, labels)
  File "/home/sarah/Documents/SVHN/cifar10.py", line 364, in loss
    dense_labels = tf.sparse_to_dense(concated,[FLAGS.batch_size, NUM_CLASSES],1.0, 0.0)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_sparse_ops.py", line 153, in sparse_to_dense
    default_value=default_value, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/op_def_library.py", line 633, in apply_op
    op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1710, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 988, in __init__
    self._traceback = _extract_stack()
</code></pre>

<p>I found <a href="https://stackoverflow.com/questions/34759227/tensorflow-cifar10-example/34763642">TensorFlow CIFAR10 Example</a> , similar issue in stackoverflow. But even if I change the label, it's still not working.</p>

<p>Please let me know if I did something wrong or not understanding any logic.</p>

<p>Thanks</p>

<p>Sarah</p>