lanha/DSen2

UnimplementedError ... The Conv2D op currently only supports the NHWC tensor format on the CPU.

Opened this issue · 1 comments

I run the following line

%run demoDSen2.py but got the following error as below. Please help.

---------------------------------------------------------------------------
UnimplementedError                        Traceback (most recent call last)
File ~\OneDrive - University of Canterbury\DSen2\testing\demoDSen2.py:47
     45 print('Siberia')
     46 im10, im20, imGT = readh5('S2B_MSIL1C_20170725_T43WFQ.mat', imGT=True)
---> 47 SR20 = DSen2_20(im10, im20)
     48 # Evaluation against the ground truth on the 20m resolution bands (simulated)
     49 print('DSen2:')

File ~\OneDrive - University of Canterbury\DSen2\testing\supres.py:27, in DSen2_20(d10, d20, deep)
     25 test = [p10, p20]
     26 input_shape = ((4, None, None), (6, None, None))
---> 27 prediction = _predict(test, input_shape, deep=deep)
     28 images = recompose_images(prediction, border=border, size=d10.shape)
     29 images *= SCALE

File ~\OneDrive - University of Canterbury\DSen2\testing\supres.py:65, in _predict(test, input_shape, deep, run_60)
     63 model.load_weights(predict_file)
     64 print("Predicting using file: {}".format(predict_file))
---> 65 prediction = model.predict(test, verbose=1)
     66 return prediction

File ~\AppData\Local\anaconda3\Lib\site-packages\keras\src\utils\traceback_utils.py:70, in filter_traceback.<locals>.error_handler(*args, **kwargs)
     67     filtered_tb = _process_traceback_frames(e.__traceback__)
     68     # To get the full stack trace, call:
     69     # `tf.debugging.disable_traceback_filtering()`
---> 70     raise e.with_traceback(filtered_tb) from None
     71 finally:
     72     del filtered_tb

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

UnimplementedError: Graph execution error:

Detected at node 'model_1/conv2d_14/Conv2D' defined at (most recent call last):
    File "<frozen runpy>", line 198, in _run_module_as_main
    File "<frozen runpy>", line 88, in _run_code
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\ipykernel_launcher.py", line 17, in <module>
      app.launch_new_instance()
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\traitlets\config\application.py", line 992, in launch_instance
      app.start()
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\ipykernel\kernelapp.py", line 711, in start
      self.io_loop.start()
    File "C:\Users\gji19\AppData\Roaming\Python\Python311\site-packages\tornado\platform\asyncio.py", line 195, in start
      self.asyncio_loop.run_forever()
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\asyncio\base_events.py", line 607, in run_forever
      self._run_once()
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\asyncio\base_events.py", line 1922, in _run_once
      handle._run()
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\asyncio\events.py", line 80, in _run
      self._context.run(self._callback, *self._args)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\ipykernel\kernelbase.py", line 510, in dispatch_queue
      await self.process_one()
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\ipykernel\kernelbase.py", line 499, in process_one
      await dispatch(*args)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\ipykernel\kernelbase.py", line 406, in dispatch_shell
      await result
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\ipykernel\kernelbase.py", line 729, in execute_request
      reply_content = await reply_content
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\ipykernel\ipkernel.py", line 411, in do_execute
      res = shell.run_cell(
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\ipykernel\zmqshell.py", line 531, in run_cell
      return super().run_cell(*args, **kwargs)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\IPython\core\interactiveshell.py", line 3006, in run_cell
      result = self._run_cell(
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\IPython\core\interactiveshell.py", line 3061, in _run_cell
      result = runner(coro)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\IPython\core\async_helpers.py", line 129, in _pseudo_sync_runner
      coro.send(None)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\IPython\core\interactiveshell.py", line 3266, in run_cell_async
      has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\IPython\core\interactiveshell.py", line 3445, in run_ast_nodes
      if await self.run_code(code, result, async_=asy):
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\IPython\core\interactiveshell.py", line 3505, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
    File "C:\Users\gji19\AppData\Local\Temp\ipykernel_22004\3374343633.py", line 1, in <module>
      get_ipython().run_line_magic('run', 'demoDSen2.py')
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\IPython\core\interactiveshell.py", line 2414, in run_line_magic
      result = fn(*args, **kwargs)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\IPython\core\magics\execution.py", line 834, in run
      run()
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\IPython\core\magics\execution.py", line 819, in run
      runner(filename, prog_ns, prog_ns,
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\IPython\core\pylabtools.py", line 213, in mpl_execfile
      safe_execfile(fname,*where,**kw)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\IPython\core\interactiveshell.py", line 2863, in safe_execfile
      py3compat.execfile(
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\IPython\utils\py3compat.py", line 55, in execfile
      exec(compiler(f.read(), fname, "exec"), glob, loc)
    File "C:\Users\gji19\OneDrive - University of Canterbury\DSen2\testing\demoDSen2.py", line 47, in <module>
      SR20 = DSen2_20(im10, im20)
    File "C:\Users\gji19\OneDrive - University of Canterbury\DSen2\testing\supres.py", line 27, in DSen2_20
      prediction = _predict(test, input_shape, deep=deep)
    File "C:\Users\gji19\OneDrive - University of Canterbury\DSen2\testing\supres.py", line 65, in _predict
      prediction = model.predict(test, verbose=1)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\utils\traceback_utils.py", line 65, in error_handler
      return fn(*args, **kwargs)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\engine\training.py", line 2554, in predict
      tmp_batch_outputs = self.predict_function(iterator)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\engine\training.py", line 2341, in predict_function
      return step_function(self, iterator)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\engine\training.py", line 2327, in step_function
      outputs = model.distribute_strategy.run(run_step, args=(data,))
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\engine\training.py", line 2315, in run_step
      outputs = model.predict_step(data)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\engine\training.py", line 2283, in predict_step
      return self(x, training=False)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\utils\traceback_utils.py", line 65, in error_handler
      return fn(*args, **kwargs)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\engine\training.py", line 569, in __call__
      return super().__call__(*args, **kwargs)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\utils\traceback_utils.py", line 65, in error_handler
      return fn(*args, **kwargs)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\engine\base_layer.py", line 1150, in __call__
      outputs = call_fn(inputs, *args, **kwargs)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\utils\traceback_utils.py", line 96, in error_handler
      return fn(*args, **kwargs)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\engine\functional.py", line 512, in call
      return self._run_internal_graph(inputs, training=training, mask=mask)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\engine\functional.py", line 669, in _run_internal_graph
      outputs = node.layer(*args, **kwargs)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\utils\traceback_utils.py", line 65, in error_handler
      return fn(*args, **kwargs)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\engine\base_layer.py", line 1150, in __call__
      outputs = call_fn(inputs, *args, **kwargs)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\utils\traceback_utils.py", line 96, in error_handler
      return fn(*args, **kwargs)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\layers\convolutional\base_conv.py", line 290, in call
      outputs = self.convolution_op(inputs, self.kernel)
    File "C:\Users\gji19\AppData\Local\anaconda3\Lib\site-packages\keras\src\layers\convolutional\base_conv.py", line 262, in convolution_op
      return tf.nn.convolution(
Node: 'model_1/conv2d_14/Conv2D'
The Conv2D op currently only supports the NHWC tensor format on the CPU. The op was given the format: NCHW
	 [[{{node model_1/conv2d_14/Conv2D}}]] [Op:__inference_predict_function_1337]
RMNT commented

Currenly having the same issue. Maybe you solved it?