Im currently making a localized simulator where i predict the dogs breed.
but i get this error
InvalidArgumentError: Graph execution error: Detected at node 'model_1/conv1_conv/Conv2D' defined at (most recent call last): File "c:\users\rosha\appdata\local\programs\python\python39\lib\threading.py", line 912, in _bootstrap self._bootstrap_inner() File "c:\users\rosha\appdata\local\programs\python\python39\lib\threading.py", line 954, in _bootstrap_inner self.run() File "c:\users\rosha\appdata\local\programs\python\python39\lib\threading.py", line 892, in run self._target(*self._args, **self._kwargs) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 289, in _run_script_thread self._run_script(request.rerun_data) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 542, in _run_script exec(code, module.__dict__) File "C:\Users\rosha\OneDrive\Desktop\git\Dog-Breed-Classification\simulator_app.py", line 3708, in <module> run() File "C:\Users\rosha\OneDrive\Desktop\git\Dog-Breed-Classification\simulator_app.py", line 200, in run table_data = import_and_predict(img, model) File "C:\Users\rosha\OneDrive\Desktop\git\Dog-Breed-Classification\simulator_app.py", line 145, in import_and_predict prediction = model.predict(x)[0] # Get predictions for the image File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\utils\traceback_utils.py", line 65, in error_handler return fn(*args, **kwargs) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\engine\training.py", line 2253, in predict tmp_batch_outputs = self.predict_function(iterator) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\engine\training.py", line 2041, in predict_function return step_function(self, iterator) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\engine\training.py", line 2027, in step_function outputs = model.distribute_strategy.run(run_step, args=(data,)) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\engine\training.py", line 2015, in run_step outputs = model.predict_step(data) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\engine\training.py", line 1983, in predict_step return self(x, training=False) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\utils\traceback_utils.py", line 65, in error_handler return fn(*args, **kwargs) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\engine\training.py", line 557, in __call__ return super().__call__(*args, **kwargs) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\utils\traceback_utils.py", line 65, in error_handler return fn(*args, **kwargs) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\engine\base_layer.py", line 1097, in __call__ outputs = call_fn(inputs, *args, **kwargs) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\utils\traceback_utils.py", line 96, in error_handler return fn(*args, **kwargs) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\engine\functional.py", line 510, in call return self._run_internal_graph(inputs, training=training, mask=mask) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\engine\functional.py", line 667, in _run_internal_graph outputs = node.layer(*args, **kwargs) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\utils\traceback_utils.py", line 65, in error_handler return fn(*args, **kwargs) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\engine\base_layer.py", line 1097, in __call__ outputs = call_fn(inputs, *args, **kwargs) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\utils\traceback_utils.py", line 96, in error_handler return fn(*args, **kwargs) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\layers\convolutional\base_conv.py", line 283, in call outputs = self.convolution_op(inputs, self.kernel) File "c:\users\rosha\appdata\local\programs\python\python39\lib\site-packages\keras\layers\convolutional\base_conv.py", line 255, in convolution_op return tf.nn.convolution( Node: 'model_1/conv1_conv/Conv2D' input depth must be evenly divisible by filter depth: 4 vs 3 [[{{node model_1/conv1_conv/Conv2D}}]] [Op:__inference_predict_function_17045]
I know that the error says that the image that ive uploaded has 4 channels, but my models only wants 3 channels.
is there any way for me to output an error that says “Error! image has 4 channels” or any error handling functions.