<p dir="auto">I use cifar10 model training my dataset,which is made by tf.python_io.TFRecordWriter() .<br>
I am sure labels in dataset are right,because it's running ok on Ubuntu PC but  get Error Invalid argument: Received a label value of 255 which is outside the valid range of [0, 10)  on Mac and GPU Server.</p>
<p dir="auto">W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: Received a label value of 255 which is outside the valid range of [0, 10).  Label values: 65 229 184 161 102 117 112 160 66 93 107 117 131 122 129 132 113 163 149 130 75 52 109 84 161 165 99 203 82 42 57 179 155 63 126 49 172 50 144 224 152 220 164 82 195 169 171 125 107 127 70 60 93 115 165 143 78 116 60 153 113 62 89 175 125 90 85 178 167 200 133 168 125 92 62 93 166 141 98 172 102 103 72 179 138 108 49 176 46 70 55 101 141 144 107 126 60 146 108 77 125 59 58 109 171 107 63 151 55 93 172 131 52 128 75 167 255 97 108 171 113 130 77 166 150 132 62 196<br>
Traceback (most recent call last):<br>
File "/Users/yangk/cifar10/cifar10_train.py", line 137, in <br>
tf.app.run()<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/platform/app.py", line 43, in run<br>
sys.exit(main(sys.argv[:1] + flags_passthrough))<br>
File "/Users/yangk/cifar10/cifar10_train.py", line 133, in main<br>
train()<br>
File "/Users/yangk/cifar10/cifar10_train.py", line 103, in train<br>
_, loss_value = sess.run([train_op, loss])<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/client/session.py", line 766, in run<br>
run_metadata_ptr)<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/client/session.py", line 964, in _run<br>
feed_dict_string, options, run_metadata)<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/client/session.py", line 1014, in _do_run<br>
target_list, options, run_metadata)<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/client/session.py", line 1034, in _do_call<br>
raise type(e)(node_def, op, message)<br>
tensorflow.python.framework.errors_impl.InvalidArgumentError: Received a label value of 255 which is outside the valid range of [0, 10).  Label values: 65 229 184 161 102 117 112 160 66 93 107 117 131 122 129 132 113 163 149 130 75 52 109 84 161 165 99 203 82 42 57 179 155 63 126 49 172 50 144 224 152 220 164 82 195 169 171 125 107 127 70 60 93 115 165 143 78 116 60 153 113 62 89 175 125 90 85 178 167 200 133 168 125 92 62 93 166 141 98 172 102 103 72 179 138 108 49 176 46 70 55 101 141 144 107 126 60 146 108 77 125 59 58 109 171 107 63 151 55 93 172 131 52 128 75 167 255 97 108 171 113 130 77 166 150 132 62 196<br>
[[Node: cross_entropy_per_example/cross_entropy_per_example = SparseSoftmaxCrossEntropyWithLogits[T=DT_FLOAT, Tlabels=DT_INT64, _device="/job:localhost/replica:0/task:0/cpu:0"](softmax_linear/softmax_linear, Cast_4)]]</p>
<p dir="auto">Caused by op u'cross_entropy_per_example/cross_entropy_per_example', defined at:<br>
File "/Users/yangk/cifar10/cifar10_train.py", line 137, in <br>
tf.app.run()<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/platform/app.py", line 43, in run<br>
sys.exit(main(sys.argv[:1] + flags_passthrough))<br>
File "/Users/yangk/cifar10/cifar10_train.py", line 133, in main<br>
train()<br>
File "/Users/yangk/cifar10/cifar10_train.py", line 76, in train<br>
loss = cifar10.loss(logits, labels)<br>
File "/Users/yangk/cifar10/cifar10.py", line 289, in loss<br>
logits, labels, name='cross_entropy_per_example')<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/ops/nn_ops.py", line 1537, in sparse_softmax_cross_entropy_with_logits<br>
precise_logits, labels, name=name)<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 2378, in _sparse_softmax_cross_entropy_with_logits<br>
features=features, labels=labels, name=name)<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op<br>
op_def=op_def)<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/framework/ops.py", line 2371, in create_op<br>
original_op=self._default_original_op, op_def=op_def)<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/framework/ops.py", line 1258, in <strong>init</strong><br>
self._traceback = _extract_stack()</p>
<p dir="auto">InvalidArgumentError (see above for traceback): Received a label value of 255 which is outside the valid range of [0, 10).  Label values: 65 229 184 161 102 117 112 160 66 93 107 117 131 122 129 132 113 163 149 130 75 52 109 84 161 165 99 203 82 42 57 179 155 63 126 49 172 50 144 224 152 220 164 82 195 169 171 125 107 127 70 60 93 115 165 143 78 116 60 153 113 62 89 175 125 90 85 178 167 200 133 168 125 92 62 93 166 141 98 172 102 103 72 179 138 108 49 176 46 70 55 101 141 144 107 126 60 146 108 77 125 59 58 109 171 107 63 151 55 93 172 131 52 128 75 167 255 97 108 171 113 130 77 166 150 132 62 196<br>
[[Node: cross_entropy_per_example/cross_entropy_per_example = SparseSoftmaxCrossEntropyWithLogits[T=DT_FLOAT, Tlabels=DT_INT64, _device="/job:localhost/replica:0/task:0/cpu:0"](softmax_linear/softmax_linear, Cast_4)]]</p>
<p dir="auto">I use the cifar10 model train my own TFRecord dataset ,it's running on Ubuntu 14.4 without error,but getting these errors when I run it on Mac or GPU server。And I am sure the labels of my dataset are right ,I don't know why get labels bigger than 10 ,I just have 10 classifications。</p>
<p dir="auto">I use this code write images and labels in binfile:</p>
<p dir="auto">image_raw = image.tostring()<br>
example = tf.train.Example(features=tf.train.Features(feature={<br>
'image_raw' : _bytes_feature(image_raw),<br>
'height' : _int64_feature(image.shape[0]),<br>
'width' : _int64_feature(image.shape[1]),<br>
'deepth' : _int64_feature(image.shape[2]),<br>
'label' : _int64_feature(label)<br>
}))<br>
writer.write(example.SerializeToString())<br>
writer.close()</p>
<p dir="auto">The errors:</p>
<p dir="auto">W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: Received a label value of 245 which is outside the valid range of [0, 10).  Label values: 180 96 226 166 162 179 147 115 162 141 150 136 129 118 162 141 78 154 133 155 89 184 116 179 176 70 209 177 65 177 89 36 80 139 117 187 115 182 106 42 203 120 48 72 96 126 74 123 134 115 112 154 128 163 64 113 35 140 198 193 189 67 164 110 117 61 215 186 189 84 95 206 163 82 122 160 37 179 236 157 140 181 178 128 67 114 43 211 143 70 0 91 184 142 172 127 80 160 127 90 62 151 158 23 180 192 21 97 125 94 98 136 125 190 158 128 119 30 198 111 206 66 137 126 245 210 158 188<br>
Traceback (most recent call last):<br>
File "/Users/yangk/cifar10/cifar10_train.py", line 137, in <br>
tf.app.run()<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/platform/app.py", line 43, in run<br>
sys.exit(main(sys.argv[:1] + flags_passthrough))<br>
File "/Users/yangk/cifar10/cifar10_train.py", line 133, in main<br>
train()<br>
File "/Users/yangk/cifar10/cifar10_train.py", line 103, in train<br>
_, loss_value = sess.run([train_op, loss])<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/client/session.py", line 766, in run<br>
run_metadata_ptr)<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/client/session.py", line 964, in _run<br>
feed_dict_string, options, run_metadata)<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/client/session.py", line 1014, in _do_run<br>
target_list, options, run_metadata)<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/client/session.py", line 1034, in _do_call<br>
raise type(e)(node_def, op, message)<br>
tensorflow.python.framework.errors_impl.InvalidArgumentError: Received a label value of 245 which is outside the valid range of [0, 10).  Label values: 180 96 226 166 162 179 147 115 162 141 150 136 129 118 162 141 78 154 133 155 89 184 116 179 176 70 209 177 65 177 89 36 80 139 117 187 115 182 106 42 203 120 48 72 96 126 74 123 134 115 112 154 128 163 64 113 35 140 198 193 189 67 164 110 117 61 215 186 189 84 95 206 163 82 122 160 37 179 236 157 140 181 178 128 67 114 43 211 143 70 0 91 184 142 172 127 80 160 127 90 62 151 158 23 180 192 21 97 125 94 98 136 125 190 158 128 119 30 198 111 206 66 137 126 245 210 158 188<br>
[[Node: cross_entropy_per_example/cross_entropy_per_example = SparseSoftmaxCrossEntropyWithLogits[T=DT_FLOAT, Tlabels=DT_INT64, _device="/job:localhost/replica:0/task:0/cpu:0"](softmax_linear/softmax_linear, Cast_4)]]</p>
<p dir="auto">Caused by op u'cross_entropy_per_example/cross_entropy_per_example', defined at:<br>
File "/Users/yangk/cifar10/cifar10_train.py", line 137, in <br>
tf.app.run()<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/platform/app.py", line 43, in run<br>
sys.exit(main(sys.argv[:1] + flags_passthrough))<br>
File "/Users/yangk/cifar10/cifar10_train.py", line 133, in main<br>
train()<br>
File "/Users/yangk/cifar10/cifar10_train.py", line 76, in train<br>
loss = cifar10.loss(logits, labels)<br>
File "/Users/yangk/cifar10/cifar10.py", line 289, in loss<br>
logits, labels, name='cross_entropy_per_example')<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/ops/nn_ops.py", line 1537, in sparse_softmax_cross_entropy_with_logits<br>
precise_logits, labels, name=name)<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 2378, in _sparse_softmax_cross_entropy_with_logits<br>
features=features, labels=labels, name=name)<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op<br>
op_def=op_def)<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/framework/ops.py", line 2371, in create_op<br>
original_op=self._default_original_op, op_def=op_def)<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/framework/ops.py", line 1258, in <strong>init</strong><br>
self._traceback = _extract_stack()</p>
<p dir="auto">InvalidArgumentError (see above for traceback): Received a label value of 245 which is outside the valid range of [0, 10).  Label values: 180 96 226 166 162 179 147 115 162 141 150 136 129 118 162 141 78 154 133 155 89 184 116 179 176 70 209 177 65 177 89 36 80 139 117 187 115 182 106 42 203 120 48 72 96 126 74 123 134 115 112 154 128 163 64 113 35 140 198 193 189 67 164 110 117 61 215 186 189 84 95 206 163 82 122 160 37 179 236 157 140 181 178 128 67 114 43 211 143 70 0 91 184 142 172 127 80 160 127 90 62 151 158 23 180 192 21 97 125 94 98 136 125 190 158 128 119 30 198 111 206 66 137 126 245 210 158 188<br>
[[Node: cross_entropy_per_example/cross_entropy_per_example = SparseSoftmaxCrossEntropyWithLogits[T=DT_FLOAT, Tlabels=DT_INT64, _device="/job:localhost/replica:0/task:0/cpu:0"](softmax_linear/softmax_linear, Cast_4)]]</p>