README.md.bak 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <!--- Licensed to the Apache Software Foundation (ASF) under one -->
  2. <!--- or more contributor license agreements. See the NOTICE file -->
  3. <!--- distributed with this work for additional information -->
  4. <!--- regarding copyright ownership. The ASF licenses this file -->
  5. <!--- to you under the Apache License, Version 2.0 (the -->
  6. <!--- "License"); you may not use this file except in compliance -->
  7. <!--- with the License. You may obtain a copy of the License at -->
  8. <!--- http://www.apache.org/licenses/LICENSE-2.0 -->
  9. <!--- Unless required by applicable law or agreed to in writing, -->
  10. <!--- software distributed under the License is distributed on an -->
  11. <!--- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -->
  12. <!--- KIND, either express or implied. See the License for the -->
  13. <!--- specific language governing permissions and limitations -->
  14. <!--- under the License. -->
  15. Running PP-PicoDet via TVM on bare metal Arm(R) Cortex(R)-M55 CPU and CMSIS-NN
  16. ===============================================================
  17. This folder contains an example of how to use TVM to run a PP-PicoDet model
  18. on bare metal Cortex(R)-M55 CPU and CMSIS-NN.
  19. Prerequisites
  20. -------------
  21. If the demo is run in the ci_cpu Docker container provided with TVM, then the following
  22. software will already be installed.
  23. If the demo is not run in the ci_cpu Docker container, then you will need the following:
  24. - Software required to build and run the demo (These can all be installed by running
  25. tvm/docker/install/ubuntu_install_ethosu_driver_stack.sh.)
  26. - [Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software](https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps)
  27. - [cmake 3.19.5](https://github.com/Kitware/CMake/releases/)
  28. - [GCC toolchain from Arm(R)](https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2)
  29. - [Arm(R) Ethos(TM)-U NPU driver stack](https://review.mlplatform.org)
  30. - [CMSIS](https://github.com/ARM-software/CMSIS_5)
  31. - The python libraries listed in the requirements.txt of this directory
  32. - These can be installed by running the following from the current directory:
  33. ```bash
  34. pip install -r ./requirements.txt
  35. ```
  36. You will also need TVM which can either be:
  37. - Built from source (see [Install from Source](https://tvm.apache.org/docs/install/from_source.html))
  38. - When building from source, the following need to be set in config.cmake:
  39. - set(USE_CMSISNN ON)
  40. - set(USE_MICRO ON)
  41. - set(USE_LLVM ON)
  42. - Installed from TLCPack(see [TLCPack](https://tlcpack.ai/))
  43. You will need to update your PATH environment variable to include the path to cmake 3.19.5 and the FVP.
  44. For example if you've installed these in ```/opt/arm``` , then you would do the following:
  45. ```bash
  46. export PATH=/opt/arm/FVP_Corstone_SSE-300/models/Linux64_GCC-6.4:/opt/arm/cmake/bin:$PATH
  47. ```
  48. Running the demo application
  49. ----------------------------
  50. Type the following command to run the bare metal text recognition application ([src/demo_bare_metal.c](./src/demo_bare_metal.c)):
  51. ```bash
  52. ./run_demo.sh
  53. ```
  54. If the Ethos(TM)-U platform and/or CMSIS have not been installed in /opt/arm/ethosu then
  55. the locations for these can be specified as arguments to run_demo.sh, for example:
  56. ```bash
  57. ./run_demo.sh --cmsis_path /home/tvm-user/cmsis \
  58. --ethosu_platform_path /home/tvm-user/ethosu/core_platform
  59. ```
  60. This will:
  61. - Download a PP-PicoDet text recognition model
  62. - Use tvmc to compile the text recognition model for Cortex(R)-M55 CPU and CMSIS-NN
  63. - Create a C header file inputs.c containing the image data as a C array
  64. - Create a C header file outputs.c containing a C array where the output of inference will be stored
  65. - Build the demo application
  66. - Run the demo application on a Fixed Virtual Platform (FVP) based on Arm(R) Corstone(TM)-300 software
  67. - The application will report the text on the image and the corresponding score.
  68. Using your own image
  69. --------------------
  70. The create_image.py script takes a single argument on the command line which is the path of the
  71. image to be converted into an array of bytes for consumption by the model.
  72. The demo can be modified to use an image of your choice by changing the following line in run_demo.sh
  73. ```bash
  74. python3 ./convert_image.py ../../demo/000000014439_640x640.jpg
  75. ```
  76. Model description
  77. -----------------