|
|
6 tahun lalu | |
|---|---|---|
| .. | ||
| PregeneratedData | 5 tahun lalu | |
| Profiles | 6 tahun lalu | |
| TestCases | 5 tahun lalu | |
| README.md | 6 tahun lalu | |
| generate_test_data.py | 5 tahun lalu | |
| requirements.txt | 6 tahun lalu | |
| unittest_targets.py | 6 tahun lalu | |
Unit test CMSIS-NN functions on any Mbed supported HW.
Mbed are used for building and flashing. The Unity test framework is used for running the actual unit tests.
Python3 is required. It has been tested with Python 3.6 and it has been tested on Ubuntu 16 and 18.
There is a requirement file that can be used to install the dependencies.
``` pip3 install -r requirements.txt```
Note that the exact versions are not required, and there are not a lot of packages to install manually. The file contains a lot of packages but that is because those are installed when installing some of the other packages. To manually install packages, see below.
For executing unit tests, the python3 package pyserial is required. Version 3.4 of pyserial has been tested ok.
``` pip3 install pyserial```
Other required python packages are mbed-cli and and mbed-ls. It should not matter if those are installed under python2 or python3 as they are command-line tools. These packages have been tested for Python2, with the following versions: mbed-ls(1.7.9) and mbed-cli(1.10.1).
For generating new data, the python3 packages tensorflow, numpy and packaging are required. Tensorflow version 2 is required as a minimum.
Connect any HW (e.g. NUCLEO_F746ZG) that is supported by mbed. Multiple boards are supported. If all requirements are satisfied you can just run:
```./unittest_targets.py```
Use the -h flag to get more info.
Generating new test data is done with the following script. Use the -h flag to get more info.
```./generate_test_data.py -h```
The script use a concept of test data sets, i.e. it need a test set data name as input. It will then generate files with that name as prefix. Multiple header files of different test sets can then be included in the actual unit test files.
Output - This will be created when building.Profiles - These are the Mbed settings that are used.PregeneratedData - These are tests sets of data that have been previously been generated and are used in the unit tests.TestCases - Here are the actual unit tests. For each function under test there is a folder under here.TestCases/<cmsis-nn function name> - For each function under test there is a folder with the same name with test_ prepended to the name and it contains a c-file with the actual unit tests. For example for arm_convolve_s8() the file is called test_arm_convolve_s8.cTestCases/<cmsis-nn function name>/Unity - This folder contains a Unity file that calls the actual unit tests. For example for arm_convolve_s8() the file is called unity_test_arm_convolve_s8.c.TestCases/<cmsis-nn function name>/Unity/TestRunner - This folder will contain the autogenerated Unity test runner.TestCases/TestData - This is auto generated test data that the unit tests are using. It is the same data as in the PregenrateData folder but in actual C header format. The advantage of having the same data in two places, is that the data can be easily regenerated (randomized) with the same config. All data can regenerated or only parts of it (e.g. only bias data). Of course even the config can be regenerated. This might be useful during debugging.