Xilinx / DPU-PYNQ

DPU on PYNQ
Apache License 2.0
203 stars 69 forks source link

Errors running compile.sh #23

Closed balintbarna closed 3 years ago

balintbarna commented 3 years ago

Hello! I'm trying to compare performance between an Ultra96-V2 board and a desktop GPU running the same network and model. To achieve that on the board, I am trying to compile an item from the Vitis AI model zoo to an *.elf file for the DPU.

I followed the guide in host/README.md up until the point where I am supposed to run compile.sh in the docker container:

./compile.sh Ultra96 dk_yolov4_coco_416_416_60.1G_1.3

The first error I got was ./compile.sh: line 20: MODEL_NAME: command not found. Then I opened the file with vim and found that on line 20 and 21 () was used instead of {}. I corrected that and the script progressed.

The next issue was Error: currently only caffe and tensorflow are supported. so I tried the suggested example instead:

> ./compile.sh Ultra96 cf_resnet50_imagenet_224_224_7.7G_1.1
[DLet]Generate DPU DCF file dpu-03-26-2020-13-30.dcf successfully.
Archive:  cf_resnet50_imagenet_224_224_7.7G_1.1.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of cf_resnet50_imagenet_224_224_7.7G_1.1.zip or
        cf_resnet50_imagenet_224_224_7.7G_1.1.zip.zip, and cannot find cf_resnet50_imagenet_224_224_7.7G_1.1.zip.ZIP, period.

So I decided to try any tensorflow model from the zoo:

> ./compile.sh Ultra96 tf_yolov3_voc_416_416_65.63G_1.3
[DLet]Generate DPU DCF file dpu-03-26-2020-13-30.dcf successfully.
Archive:  tf_yolov3_voc_416_416_65.63G_1.3.zip
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/quantize/.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/quantize/config.ini.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/quantize/evaluate_quantize_model.sh.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/quantize/input_fn.py.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/quantize/quantize.sh.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/quantize/readme.md.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/test/.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/test/config.py.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/test/dataset_tools/.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/test/dataset_tools/convert_voc_anno.py.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/test/dataset_tools/prepare_data.sh.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/test/evaluation.py.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/test/run_eval.sh.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/test/tf_prediction.py.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/test/tf_prediction_pil.py.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/code/test/yolo3_predictor.py.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/data/.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/data/calib_list.txt.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/data/demo_list.txt.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/float/.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/float/yolov3_voc.pb.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/quantized/.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/quantized/deploy_model.pb.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/quantized/quantize_eval_model.pb.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/README.md.
checkdir error:  tf_yolov3_voc_416_416_65.63G_1.3 exists but is not directory
                 unable to process tf_yolov3_voc_416_416_65.63G_1.3/requirements.txt.

So I decided to try a different model and got this:

> ./compile.sh Ultra96 cf_ssdpedestrian_coco_360_640_0.97_5.9G_1.3
...
**************************************************
* VITIS_AI Compilation - Xilinx Inc.
**************************************************
[INFO] Namespace(inputs_shape=None, layout='NCHW', model_files=['cf_ssdpedestrian_coco_360_640_0.97_5.9G_1.3/quantized/deploy.caffemodel'], model_type='caffe', out_filename='./ssdpedestrian_org.xmodel', proto='cf_ssdpedestrian_coco_360_640_0.97_5.9G_1.3/quantized/deploy.prototxt')
[INFO] caffe model: cf_ssdpedestrian_coco_360_640_0.97_5.9G_1.3/quantized/deploy.caffemodel
[INFO] caffe model: cf_ssdpedestrian_coco_360_640_0.97_5.9G_1.3/quantized/deploy.prototxt
[INFO] parse raw model     :100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 123/123 [00:00<00:00, 1823.06it/s]
[INFO] infer shape (NCHW)  :100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 123/123 [00:00<00:00, 17733.99it/s]
[INFO] infer shape (NHWC)  :100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 123/123 [00:00<00:00, 17090.12it/s]
[INFO] generate xmodel     :100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 123/123 [00:00<00:00, 11883.80it/s]
[INFO] generate xmodel: /workspace/ssdpedestrian_org.xmodel
[UNILOG][INFO] The compiler log will be dumped at "/tmp/vitis-ai-user/log/xcompiler-20210121-075318-141"
[UNILOG][INFO] Target architecture: DPUCZDX8G
[UNILOG][FATAL][TARGET_FACTORY_UNREGISTERED_TARGET][Unregistered target!] Cannot find target with name DPUCZDX8G, valid names are: {DPUCAHX8H_ISA2=>0x20200000000002a,DPUCAHX8H_ISA2_ELP2=>0x20200000000002e,DPUCAHX8L_ISA0=>0x30000000000001d,DPUCVDX8G_ISA0_B16384C64B1=>0x600000076080812,DPUCVDX8G_ISA0_B8192C32B1=>0x600000076080811,DPUCVDX8G_ISA0_B8192C32B1_ELP4=>0x600000076040411,DPUCVDX8G_ISA0_B8192C32B3=>0x600000076080831,DPUCVDX8G_ISA0_B8192C32B3_DW=>0x6000000f6088831,DPUCVDX8G_ISA0_B8192C32B3_I4W8B2=>0x600000276080831,DPUCVDX8G_ISA0_B8192C32B3_I8W4B2=>0x600000376080831,DPUCVDX8G_ISA0_B8192C32B3_I8W8B2=>0x600000176080831,DPUCVDX8H_ISA0=>0x5000000000007ee,DPUCZDI4G_ISA0_B4096_DEMO_SSD=>0x400002003220206,DPUCZDI4G_ISA0_B8192D8_DEMO_SSD=>0x400002003220207,DPUCZDX8G_ISA0_B1024_MAX=>0x1000020f7014402,DPUCZDX8G_ISA0_B1024_MIN=>0x100002022010102,DPUCZDX8G_ISA0_B1152_MAX=>0x1000020f7012203,DPUCZDX8G_ISA0_B1152_MIN=>0x100002022010103,DPUCZDX8G_ISA0_B1600_MAX=>0x1000020f7014404,DPUCZDX8G_ISA0_B1600_MIN=>0x100002022010104,DPUCZDX8G_ISA0_B2304_MAX=>0x1000020f7014405,DPUCZDX8G_ISA0_B2304_MAX_BG2=>0x1000020f6014405,DPUCZDX8G_ISA0_B2304_MIN=>0x100002022010105,DPUCZDX8G_ISA0_B3136_MAX=>0x1000020f7014406,DPUCZDX8G_ISA0_B3136_MAX_BG2=>0x1000020f6014406,DPUCZDX8G_ISA0_B3136_MIN=>0x100002022010106,DPUCZDX8G_ISA0_B4096_MAX=>0x1000020f7014407,DPUCZDX8G_ISA0_B4096_MAX_BG2=>0x1000020f6014407,DPUCZDX8G_ISA0_B4096_MAX_EM=>0x1000030f7014407,DPUCZDX8G_ISA0_B4096_MIN=>0x100002022010107,DPUCZDX8G_ISA0_B512_MAX=>0x1000020f7012200,DPUCZDX8G_ISA0_B512_MIN=>0x100002022010100,DPUCZDX8G_ISA0_B800_MAX=>0x1000020f7012201,DPUCZDX8G_ISA0_B800_MIN=>0x100002022010101}
*** Check failure stack trace: ***
This program has crashed!
Aborted

So I guess my question is am I doing something wrong? Would I have different results with the GPU image or it's unrelated? How could I generate the .elf files to use with the DPU?

balintbarna commented 3 years ago

What I found out about the caffe example, is that the target names in arch.json changed in 1.3. I've tried with different target names, but this version only compiles to .xmodel, which does not seem to be supported by dpu-pynq yet. I am not sure about the tensorflow models. Using v1.2 of the docker image seems to be the way to go, I could actually actually build a caffe and tf model, however the paths of the models needed to be modified in compile.sh for them.

Jefferson111 commented 3 years ago

What I found out about the caffe example, is that the target names in arch.json changed in 1.3. I've tried with different target names, but this version only compiles to .xmodel, which does not seem to be supported by dpu-pynq yet. I am not sure about the tensorflow models. Using v1.2 of the docker image seems to be the way to go, I could actually actually build a caffe and tf model, however the paths of the models needed to be modified in compile.sh for them.

Hi, may I know how did you manage to get it to work on v1.2 docker image? I'm assuming you ran this command ./docker_run.sh xilinx/vitis-ai-cpu:1.1.56 instead of ./docker_run.sh xilinx/vitis-ai-cpu:latest? I used this link to check for image.

Subsequently I tried to run ./compile.sh Ultra96 cf_inceptionv1_imagenet_224_224_3.16G but had no luck in compiling :(

I am also getting .xmodel as output for latest version. ><

balintbarna commented 3 years ago

@Jefferson111 I used the GPU image xilinx/vitis-ai:1.2.82 so I cannot speak for vitis-ai-cpu:1.1.56 but compile.sh required some modifications There were 2 issues, one is the curly braces, the other is that each version of the models have a different folder structure. check the branches here https://github.com/balintmaci/DPU-PYNQ There's separate branchesfor v1.0 and v1.2 models

balintbarna commented 3 years ago

resolved by pull request #25