Skip to content

Commit

Permalink
Update OCR example on AVH Learning Path
Browse files Browse the repository at this point in the history
  • Loading branch information
annietllnd committed Sep 4, 2024
1 parent 3f7193a commit a5e2c40
Showing 1 changed file with 47 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,50 @@ Start by launching the [Arm Virtual Hardware AMI](/install-guides/avh/).

Alternatively, you can also download the Corstone-300 FVP from the [Arm Ecosystem FVP](https://developer.arm.com/downloads/-/arm-ecosystem-fvps) page. For installation instructions see [Arm Ecosystem FVPs](/install-guides/fm_fvp/eco_fvp/).

The code for this [project](https://github.com/ArmDeveloperEcosystem/Paddle-examples-for-AVH/tree/main/OCR-example), is available to download from [ArmDeveloperEcosystem](https://github.com/ArmDeveloperEcosystem/Paddle-examples-for-AVH) GitHub repository as well as [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR/tree/dygraph/deploy/avh)’s GitHub repository (under the dygraph branch).
The code for this [project](https://github.com/ArmDeveloperEcosystem/Paddle-examples-for-AVH/tree/main/OCR-example), is available to download from [ArmDeveloperEcosystem](https://github.com/ArmDeveloperEcosystem/Paddle-examples-for-AVH) GitHub repository as well as [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR/tree/dygraph/deploy/avh)’s GitHub repository (under the dygraph branch).

Start by cloning the code repository on your running AVH AMI instance:

```console
```bash
git clone https://github.com/ArmDeveloperEcosystem/Paddle-examples-for-AVH.git
cd Paddle-examples-for-AVH/OCR-example/Text-recognition-example
cd Paddle-examples-for-AVH
```
Run the setup scripts.
```bash
sudo bash scripts/config_cmsis_toolbox.sh
sudo bash scripts/config_tvm.sh
```
Now you can navigate to the text recognition example directory.

```bash
cd ./ocr/text_recognition/
```

In this directory, there is a script named [run_demo.sh](https://github.com/ArmDeveloperEcosystem/Paddle-examples-for-AVH/blob/main/OCR-example/run_demo.sh) that automates the entire process described in the End-to-end workflow diagram.
In this directory, there is a script named [run_demo.sh](https://github.com/ArmDeveloperEcosystem/Paddle-examples-for-AVH/blob/main/OCR-example/run_demo.sh) that automates the entire process described in the End-to-end workflow diagram.

Update the FVP executable name in the `run_demo.sh` script. The `VHT_Platform` should match what is installed in the system. The executable starts with either `VHT_Corstone_SSE` or `FVP_Corstone_SSE`. Check which one is available in the `$PATH` by typing it out and using the Tab key to autocomplete. Then, using a code editor of your choice or `vim`, you can assign the correct executable:

```console
vim run_demo.sh
```

The final result should look something like this, with the right option uncommented:
```
if [ "$DEVICE" == "cortex-m55" ]; then
RUN_DEVICE_NAME="M55"
# VHT_Platform="FVP_Corstone_SSE-300"
VHT_Platform="VHT_Corstone_SSE-300_Ethos-U55"
TVM_TARGET="cortex-m55"
elif [ "$DEVICE" == "cortex-m85" ]; then
RUN_DEVICE_NAME="M85"
# VHT_Platform="FVP_Corstone_SSE-310"
VHT_Platform="VHT_Corstone_SSE-310"
TVM_TARGET="cortex-m85"
else
echo 'ERROR: --device only support cortex-m55/cortex-m85' >&2
exit 1
fi
```

The `run_demo.sh` script automatically builds and executes the English text recognition application on the Corstone-300 platform included with Arm Virtual Hardware. Here is a list of steps performed by this script:

Expand All @@ -43,15 +77,21 @@ The `run_demo.sh` script automatically builds and executes the English text reco
- Step 6. Run application binary on Corstone-300 FVP included in AVH

Training the model usually takes a lot of time. In step 2, an already trained English text recognition model named [ocr_en.tar](https://paddleocr.bj.bcebos.com/tvm/ocr_en.tar) is used.
By default, the script uses the image shown below (QBHOUSE) as an example to verify the inference results on the Corstone-300 FVP with Arm Cortex-M55.

By default, the script uses the image shown below (QBHOUSE) as an example to verify the inference results on the Corstone-300 FVP with Arm Cortex-M55.

![QBHOUSE#center](./Figure4.png)

Make the script executable with `chmod`.

```bash
chmod 777 run_demo.sh
```

You can now run the trained PaddleOCR text recognition model on the Corstone-300 FVP included on the AVH AMI with the following command:

```console
./run_demo.sh
./run_demo.sh --device cortex-m55 --model EN_PPOCRV3_REC
```

The output from running the application on the Corstone-300 FVP is shown below:
Expand Down

0 comments on commit a5e2c40

Please sign in to comment.