Saafke / EDSR_Tensorflow

TensorFlow implementation of 'Enhanced Deep Residual Networks for Single Image Super-Resolution'.
Apache License 2.0
233 stars 72 forks source link

Quantization Error when using Deephi Tools #1

Closed rokmc612 closed 3 years ago

rokmc612 commented 4 years ago

Hi I am not sure you are familiar with Deephi Tools which is doing quantization. But this makes below error when I compile your code to use Alveo Card( from Xilinx )

Traceback (most recent call last): File "run.py", line 130, in get_default_compiler_args() File "/opt/ml-suite/xfdnn/rt/xdnn_rt_tf.py", line 50, in init super(TFxdnnRT, self).init(TFFrontend, args, kwargs) File "/opt/ml-suite/xfdnn/rt/xdnn_rt_base.py", line 212, in init = compiler.compile() File "./xfdnn/tools/compile/bin/xfdnn_compiler_tensorflow.py", line 191, in compile File "./xfdnn/tools/compile/network/tensor_tools.py", line 2007, in from_tfgraph_to_fpga_code File "./xfdnn/tools/compile/bin/xfdnn_compiler_base.py", line 729, in GraphMassage File "./xfdnn/tools/compile/graph/dagtools.py", line 3667, in convert_offline File "./xfdnn/tools/compile/quantz/deephi_quant_info.py", line 556, in process TypeError: unsupported operand type(s) for /: 'float' and 'NoneType'

Do you have any idea how to solve this issue?

FYI. We are using this code to compare performance of Alveo vs nVidia GPU.

Saafke commented 4 years ago

Hi there!

I have no experience with DeepHi. One idea: it might be a problem with the DepthToSpace layer. This might not be supported in your framework (deephi). You might want to try to another upsampling layer like a transposed convolution layer, and then try again.

seli07 commented 4 years ago

Hi There, I am trying to use your code to test up-scaling of a cropped image. i am on anaconda python 3.5 cuda 10 cudnn 7.4 with tensorflow-gpu==1.15.0. I am getting. can you help to identify the exact version or procedure that i have to use?

Traceback (most recent call last): File "main_1.py", line 73, in run.upscaleFromPb(args.image) File "C:\Users\ASUS\Downloads\EDSR_Tensorflow-master\EDSR_Tensorflow-master\run.py", line 298, in upscaleFromPb output = sess.run(HR_tensor, feed_dict={LR_tensor: LRinput}) File "C:\Users\ASUS\Anaconda3\envs\tengpu\lib\site-packages\tensorflow_core\python\client\session.py", line 956, in run run_metadata_ptr) File "C:\Users\ASUS\Anaconda3\envs\tengpu\lib\site-packages\tensorflow_core\python\client\session.py", line 1180, in _run feed_dict_tensor, options, run_metadata) File "C:\Users\ASUS\Anaconda3\envs\tengpu\lib\site-packages\tensorflow_core\python\client\session.py", line 1359, in _do_run run_metadata) File "C:\Users\ASUS\Anaconda3\envs\tengpu\lib\site-packages\tensorflow_core\python\client\session.py", line 1384, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'Dequantize' used by node resFilter_three (defined at C:\Users\ASUS\Anaconda3\envs\tengpu\lib\site-packages\tensorflow_core\python\framework\ops.py:1748) with these attrs: [mode="MIN_FIRST", T=DT_QUINT8] Registered devices: [CPU, GPU] Registered kernels:

[[resFilter_three]]
seli07 commented 4 years ago

Thank you. It worked with the opencv + contrib build process.