KhomZ / Automatic-Number-Plate-Recognition-with-SMS-Alert

Automatic Nepali Number Plate Recognition with Sms Reporting System x Real Time Machine Learning Approach on Traffic Congestion Prediction System in Internet of Vehicles
MIT License
1 stars 0 forks source link

Invalid Argument Error!!!!! #25

Open KhomZ opened 2 years ago

KhomZ commented 2 years ago

InvalidArgumentError Traceback (most recent call last) Input In [60], in <cell line: 1>() ----> 1 model.predict(t1)

File ~\anaconda3\lib\site-packages\keras\utils\traceback_utils.py:67, in filter_traceback..error_handler(*args, **kwargs) 65 except Exception as e: # pylint: disable=broad-except 66 filtered_tb = _process_traceback_frames(e.traceback) ---> 67 raise e.with_traceback(filtered_tb) from None 68 finally: 69 del filtered_tb

File ~\anaconda3\lib\site-packages\tensorflow\python\eager\execute.py:54, in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name) 52 try: 53 ctx.ensure_initialized() ---> 54 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, 55 inputs, attrs, num_outputs) 56 except core._NotOkStatusException as e: 57 if name is not None:

InvalidArgumentError: Graph execution error:

Detected at node 'model/Conv1_relu/Relu6' defined at (most recent call last): File "C:\Users\ACER\anaconda3\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\ACER\anaconda3\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\ACER\anaconda3\lib\site-packages\ipykernel_launcher.py", line 16, in app.launch_new_instance() File "C:\Users\ACER\anaconda3\lib\site-packages\traitlets\config\application.py", line 846, in launch_instance app.start() File "C:\Users\ACER\anaconda3\lib\site-packages\ipykernel\kernelapp.py", line 677, in start self.io_loop.start() File "C:\Users\ACER\anaconda3\lib\site-packages\tornado\platform\asyncio.py", line 199, in start self.asyncio_loop.run_forever() File "C:\Users\ACER\anaconda3\lib\asyncio\base_events.py", line 596, in run_forever self._run_once() File "C:\Users\ACER\anaconda3\lib\asyncio\base_events.py", line 1890, in _run_once handle._run() File "C:\Users\ACER\anaconda3\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, self._args) File "C:\Users\ACER\anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 471, in dispatch_queue await self.process_one() File "C:\Users\ACER\anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 460, in process_one await dispatch(args) File "C:\Users\ACER\anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 367, in dispatch_shell await result File "C:\Users\ACER\anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 662, in execute_request reply_content = await reply_content File "C:\Users\ACER\anaconda3\lib\site-packages\ipykernel\ipkernel.py", line 360, in do_execute res = shell.run_cell(code, store_history=store_history, silent=silent) File "C:\Users\ACER\anaconda3\lib\site-packages\ipykernel\zmqshell.py", line 532, in run_cell return super().run_cell(*args, kwargs) File "C:\Users\ACER\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2881, in run_cell result = self._run_cell( File "C:\Users\ACER\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2936, in _run_cell return runner(coro) File "C:\Users\ACER\anaconda3\lib\site-packages\IPython\core\async_helpers.py", line 129, in _pseudo_sync_runner coro.send(None) File "C:\Users\ACER\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3135, in run_cell_async has_raised = await self.run_ast_nodes(code_ast.body, cell_name, File "C:\Users\ACER\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3338, in run_ast_nodes if await self.runcode(code, result, async=asy): File "C:\Users\ACER\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3398, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "C:\Users\ACER\AppData\Local\Temp\ipykernel_3784\2307602351.py", line 1, in <cell line: 1> pred_name = labels.inverse_transform[np.argmax(model.predict(image[np.newaxis,:]))] File "C:\Users\ACER\anaconda3\lib\site-packages\keras\utils\traceback_utils.py", line 64, in error_handler return fn(*args, *kwargs) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\engine\training.py", line 2033, in predict tmp_batch_outputs = self.predict_function(iterator) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\engine\training.py", line 1845, in predict_function return step_function(self, iterator) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\engine\training.py", line 1834, in step_function outputs = model.distribute_strategy.run(run_step, args=(data,)) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\engine\training.py", line 1823, in run_step outputs = model.predict_step(data) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\engine\training.py", line 1791, in predict_step return self(x, training=False) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\utils\traceback_utils.py", line 64, in error_handler return fn(args, kwargs) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\engine\training.py", line 490, in call return super().call(*args, kwargs) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\utils\traceback_utils.py", line 64, in error_handler return fn(*args, *kwargs) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\engine\base_layer.py", line 1014, in call outputs = call_fn(inputs, args, kwargs) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\utils\traceback_utils.py", line 92, in error_handler return fn(*args, kwargs) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\engine\functional.py", line 458, in call return self._run_internal_graph( File "C:\Users\ACER\anaconda3\lib\site-packages\keras\engine\functional.py", line 596, in _run_internal_graph outputs = node.layer(*args, *kwargs) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\utils\traceback_utils.py", line 64, in error_handler return fn(args, kwargs) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\engine\base_layer.py", line 1014, in call outputs = call_fn(inputs, *args, *kwargs) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\utils\traceback_utils.py", line 92, in error_handler return fn(args, **kwargs) File "C:\Users\ACER\anaconda3\lib\site-packages\keras\layers\activation\relu.py", line 96, in call return backend.relu(inputs, File "C:\Users\ACER\anaconda3\lib\site-packages\keras\backend.py", line 4989, in relu x = tf.nn.relu6(x) Node: 'model/Conv1_relu/Relu6' input must be 4-dimensional[1,3,80,80,3] [[{{node model/Conv1_relu/Relu6}}]] [Op:__inference_predict_function_5311]

KhomZ commented 2 years ago

https://zhang-yang.medium.com/reshaping-numpy-arrays-newaxis-v-s-reshape-v-s-expand-dims-521289b73c8a