Landsat-Classification-Using-Neural-Network icon indicating copy to clipboard operation
Landsat-Classification-Using-Neural-Network copied to clipboard

Error Run the model

Open diouck opened this issue 4 years ago • 1 comments

Hello, I followed your tutorial, it's perfect for discovering tensorflow. But I have a question. Or an error performing this

Run the model

model.fit(xTrain, yTrain, epochs=2)

Do you have an idea to solve it? Thank you

diouck avatar Apr 05 '21 20:04 diouck

`Epoch 1/2 1/78720 [..............................] - ETA: 18:23:18 - loss: 0.7172 - accuracy: 0.0938

InvalidArgumentError Traceback (most recent call last) in 1 # Run the model ----> 2 model.fit(xTrain, yTrain, epochs=2)

~/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq, max_queue_size, workers, use_multiprocessing) 1098 _r=1): 1099 callbacks.on_train_batch_begin(step) -> 1100 tmp_logs = self.train_function(iterator) 1101 if data_handler.should_sync: 1102 context.async_wait()

~/.local/lib/python3.6/site-packages/tensorflow/python/eager/def_function.py in call(self, *args, **kwds) 826 tracing_count = self.experimental_get_tracing_count() 827 with trace.Trace(self._name) as tm: --> 828 result = self._call(*args, **kwds) 829 compiler = "xla" if self._experimental_compile else "nonXla" 830 new_tracing_count = self.experimental_get_tracing_count()

~/.local/lib/python3.6/site-packages/tensorflow/python/eager/def_function.py in _call(self, *args, **kwds) 853 # In this case we have created variables on the first call, so we run the 854 # defunned version which is guaranteed to never create variables. --> 855 return self._stateless_fn(*args, **kwds) # pylint: disable=not-callable 856 elif self._stateful_fn is not None: 857 # Release the lock early so that multiple threads can perform the call

~/.local/lib/python3.6/site-packages/tensorflow/python/eager/function.py in call(self, *args, **kwargs) 2941 filtered_flat_args) = self._maybe_define_function(args, kwargs) 2942 return graph_function._call_flat( -> 2943 filtered_flat_args, captured_inputs=graph_function.captured_inputs) # pylint: disable=protected-access 2944 2945 @property

~/.local/lib/python3.6/site-packages/tensorflow/python/eager/function.py in _call_flat(self, args, captured_inputs, cancellation_manager) 1917 # No tape is watching; skip to running the function. 1918 return self._build_call_outputs(self._inference_function.call( -> 1919 ctx, args, cancellation_manager=cancellation_manager)) 1920 forward_backward = self._select_forward_and_backward_functions( 1921 args,

~/.local/lib/python3.6/site-packages/tensorflow/python/eager/function.py in call(self, ctx, args, cancellation_manager) 558 inputs=args, 559 attrs=attrs, --> 560 ctx=ctx) 561 else: 562 outputs = execute.execute_with_cancellation(

~/.local/lib/python3.6/site-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name) 58 ctx.ensure_initialized() 59 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, ---> 60 inputs, attrs, num_outputs) 61 except core._NotOkStatusException as e: 62 if name is not None:

InvalidArgumentError: Received a label value of -9223372036854775808 which is outside the valid range of [0, 2). Label values: 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -9223372036854775808 0 0 1 0 0 0 [[node sparse_categorical_crossentropy/SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits (defined at :2) ]] [Op:__inference_train_function_2577]

Function call stack: train_function`

diouck avatar Apr 05 '21 20:04 diouck