Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YOLOv4 KeyError: 'up_sampling2d/mul' #79

Closed
vjsrinivas opened this issue May 19, 2021 · 2 comments
Closed

YOLOv4 KeyError: 'up_sampling2d/mul' #79

vjsrinivas opened this issue May 19, 2021 · 2 comments

Comments

@vjsrinivas
Copy link

Hello,
I've been trying to follow the YOLOv4 tutorial for Vitis AI 1.3, and I am stuck with the compilation stage where I get the following error:

**************************************************
* VITIS_AI Compilation - Xilinx Inc.
**************************************************
[INFO] Namespace(inputs_shape=['1,416,416,3'], layout='NHWC', model_files=['./quantize/quantize_eval_model.pb'], model_type='tensorflow', out_filename='./compiled/yolov4_org.xmodel', proto=None)
in_shapes: [[1, 416, 416, 3]]
[INFO] tensorflow model: quantize/quantize_eval_model.pb
[INFO] parse raw model     :100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████| 526/526 [00:00<00:00, 25868.00it/s]             
Traceback (most recent call last):
  File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/bin/xnnc-run", line 33, in <module>
    sys.exit(load_entry_point('xnnc==1.3.0', 'console_scripts', 'xnnc-run')())
  File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/__main__.py", line 194, in main
    normal_run(args)
  File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/__main__.py", line 178, in normal_run
    in_shapes=in_shapes if len(in_shapes) > 0 else None,
  File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/xconverter.py", line 131, in run
    xmodel = CORE.make_xmodel(model_files, model_type, _layout, in_shapes)
  File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/core.py", line 104, in make_xmodel
    model_files, layout, in_shapes=in_shapes, model_type=model_t
  File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/translator/tensorflow_translator.py", line 97, in to_xmodel
    model_name, raw_nodes, layout, in_shapes, model_fmt, model_type
  File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/translator/tensorflow_translator.py", line 161, in create_xmodel
    xmodel = cls.__create_xmodel_from_tf1(name, layers, layout, in_shapes)
  File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/translator/tensorflow_translator.py", line 284, in __create_xmodel_from_tf1
    cls.__specialcase_replace_elemadd_with_biasadd(xmodel)
  File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/translator/tensorflow_translator.py", line 3406, in __specialcase_replace_elemadd_with_biasadd
    xmodel.topsort()
  File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/ir/xmodel.py", line 190, in topsort
    indegree_xnode[cname] -= 1
KeyError: 'up_sampling2d/mul'

When I run with Vitis AI 1.2, it compiles fine but outputs the older elf format, not xmodel. Is there something I am missing from my compile script? Also, I converted the Darknet weights to PB with the YOLOv3 model-set project that was recommended in the tutorial, and both the normal and quantized weights run fine in Vitis.

TARGET=ZCU104
NET_NAME=yolov4

ARCH=/opt/vitis_ai/compiler/arch/DPUCZDX8G/${TARGET}/arch.json

vai_c_tensorflow --frozen_pb ./quantize/quantize_eval_model.pb \
		 --arch ${ARCH} \
		 --output_dir ./compiled \
		 --net_name ${NET_NAME} \
		 --options "{'mode':'normal', 'save_kernel':'', 'input_shape':'1,416,416,3'}"
@Premduth
Copy link

Please try this in

https://github.com/Xilinx/Vitis-AI-Tutorials

All ML tutorials moved there

@vjsrinivas
Copy link
Author

For anyone else who encounters this error statement, I tried exporting with Vitis AI 1.4 and it was able to compile. I haven't tried to see if the xmodel runs correctly on my 104, but I will close this issue since the main problem is solved.

vmayoral pushed a commit to vmayoral/Vitis-Tutorials that referenced this issue Jan 20, 2022
Update VCK190 platform for 2021.1
CRTejaswi pushed a commit to CRTejaswi/amd-vitis that referenced this issue Oct 3, 2023
f0e0005 Merge pull request Xilinx#83 from liyuanz/add_time
361913d add time
64ea0f9 Merge pull request Xilinx#82 from liyuanz/next
8386360 update
370bb26 Merge pull request Xilinx#81 from liyuanz/next
4716b14 add memory or time
2b41485 Merge pull request Xilinx#79 from yuxiangz/makefile
a5df524 update makefile for hw_emu
bc265f0 Merge pull request Xilinx#77 from tianminr/L3_dev
bd9b7c5 Merge pull request Xilinx#76 from yuxiangz/sizein
d2a2ab6 update scanline case
591cebc add golden out size
4898af0 push request for regress
4cee657 turn up
c13c69b update error kernel for kernel_ratio setting
1379c0d Merge remote-tracking branch 'xf_ultrasound/next' into L3_dev
43ecd58 update L2 graph & kernel ratio setup for scanline
5c9a2e5 update host
8a8bc80 Merge pull request Xilinx#71 from yuxiangz/graph_l3
bd69baf turn memory up 3
b7ee6a5 Merge pull request Xilinx#73 from siyangw/IO_Dev
f516f8e Merge pull request Xilinx#72 from tianminr/L3_dev
a467fa5 turn memory up
9d3c0cc revise description.json
bbaee77 Merge pull request Xilinx#70 from siyangw/IO_Dev
f0d9dd8 scanline graph update
22db53e scanline sw_emu pass
b0487bd update port name
4404027 sw_emu pass
2571dd9 plane wave pass sw_emu
19e4cc3 Merge remote-tracking branch 'ultrasound/next' into IO_Dev
081a881 plane wave pass x86sim and aiesim
5c27d04 build graph for L3

Co-authored-by: sdausr <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants