Skip to content

Commit

Permalink
Add Qeexo AutoML example
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertRostohar committed Sep 18, 2023
1 parent 45c3638 commit d54ef60
Show file tree
Hide file tree
Showing 111 changed files with 13,693 additions and 0 deletions.
80 changes: 80 additions & 0 deletions QeexoAutoML/Include/QxAutoMLUser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#pragma once

#ifndef MIDDLEWARES_QEEXO_INCLUDE_APPS_QXAUTOMLCONFIG_USER_H_
#define MIDDLEWARES_QEEXO_INCLUDE_APPS_QXAUTOMLCONFIG_USER_H_

#ifdef __cplusplus
extern "C" {
#endif

/************************************************
* SENSOR ENABLE DEFINITIONS
************************************************/
#define QXAUTOMLCONFIG_SENSOR_ENABLE_ACCEL
#define QXAUTOMLCONFIG_SENSOR_ENABLE_GYRO
// #define QXAUTOMLCONFIG_SENSOR_ENABLE_MAG

#ifdef QXAUTOMLCONFIG_SENSOR_ENABLE_ACCEL
#define QXAUTOMLCONFIG_SENSOR_ACCEL_FSR 4.0f
#define QXAUTOMLCONFIG_SENSOR_ACCEL_ODR 417.0f
#define QXAUTOMLCONFIG_SENSOR_ACCEL_BUFCOUNT 163
#define QXAUTOMLCONFIG_SENSOR_ACCEL_BYTES_PER_SAMPLE 6
#endif

#ifdef QXAUTOMLCONFIG_SENSOR_ENABLE_GYRO
#define QXAUTOMLCONFIG_SENSOR_GYRO_FSR 500.0f
#define QXAUTOMLCONFIG_SENSOR_GYRO_ODR 417.0f
#define QXAUTOMLCONFIG_SENSOR_GYRO_BUFCOUNT 163
#define QXAUTOMLCONFIG_SENSOR_GYRO_BYTES_PER_SAMPLE 6
#endif

#ifdef QXAUTOMLCONFIG_SENSOR_ENABLE_MAG
#define QXAUTOMLCONFIG_SENSOR_MAG_FSR 50.0f //50gauss
#define QXAUTOMLCONFIG_SENSOR_MAG_ODR 100.0f //100hz
#define QXAUTOMLCONFIG_SENSOR_MAG_BUFCOUNT 39
#define QXAUTOMLCONFIG_SENSOR_MAG_BYTES_PER_SAMPLE 6
#endif

/* sensor type definitions inside inference Engine.
* Customer should define the sensor index as the same sequence regarding to
* fill the prediction data buffer with multiple sensors*/
typedef enum {
QXSENSOR_TYPE_NONE = 0, /*!< None defined sensor */
QXSENSOR_TYPE_ACCEL, /*!< Default accelerometer sensor */
QXSENSOR_TYPE_GYRO, /*!< Default gyroscope sensor */
QXSENSOR_TYPE_MAG, /*!< Megnotometer sensor */
QXSENSOR_TYPE_PRESSURE, /*!< Pressure sensor */
QXSENSOR_TYPE_TEMPERATURE, /*!< Temperature sensor */
QXSENSOR_TYPE_HUMIDITY, /*!< Humidity sensor */
QXSENSOR_TYPE_MICROPHONE, /*!< Microphone sensor */

QXSENSOR_TYPE_ACCEL_LOWPOWER, /*!< Additional lowpower accelometer sensor */
QXSENSOR_TYPE_ACCEL_HIGHSENSITIVE, /*!< Additional high sensitive accelometer sensor */
QXSENSOR_TYPE_TEMPERATURE_EXT1, /*!< Additional temperature sensor */
QXSENSOR_TYPE_PROXIMITY, /*!< Proximity sensor */
QXSENSOR_TYPE_AMBIENT, /*!< Ambient light sensor */
QXSENSOR_TYPE_LIGHT, /*!<Light sensor with one axis>*/

QXSENSOR_TYPE_TVOC, /*!< ZMOD gas sensor (TVOC) */
QXSENSOR_TYPE_ECO2, /*!< ZMOD gas sensor (ECO2) */
QXSENSOR_TYPE_ETOH, /*!< ZMOD gas sensor (ETOH) */
QXSENSOR_TYPE_RCDA, /*!< ZMOD gas sensor (RCDA) */
QXSENSOR_TYPE_IAQ, /*!< ZMOD gas sensor (IAQ) */
QXSENSOR_TYPE_RMOX, /*!< ZMOD gas sensor (MOx array) */
QXSENSOR_TYPE_CURRENT, /*!<Current sensor with one axis>*/
QXSENSOR_TYPE_MAX
}QXOSensorType;

/* Qeexo static engine APIs */
extern void QxFillSensorData(QXOSensorType type, void* data, int data_len);
extern int QxClassify(void);
extern float *QxGetProbabilities(int *numOfClasses);

/* Desired period of time between the start of the previous classification and the next request for classification (in msecs) */
#define PRED_CLASSIFICATION_INTERVAL_IN_MSECS 100

#ifdef __cplusplus
}
#endif

#endif /* MIDDLEWARES_QEEXO_INCLUDE_APPS_QXAUTOMLCONFIG_USER_H_ */
Binary file added QeexoAutoML/Lib/libQxClassifyEngine.a
Binary file not shown.
89 changes: 89 additions & 0 deletions QeexoAutoML/MLOps.csolution.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
solution:
created-for: [email protected]

cdefault:

packs:
- pack: ARM::CMSIS_DFP

misc:
- C-CPP:
- -fshort-enums
- Library:
- -lm
for-compiler: GCC

target-types:
# - type: CM0
# device: ARMCM0
# variables:
# - Target-Layer: ../Target/CM0/Target.clayer.yml
# - type: CM0plus
# device: ARMCM0P
# variables:
# - Target-Layer: ../Target/CM0plus/Target.clayer.yml
# - type: CM3
# device: ARMCM3
# variables:
# - Target-Layer: ../Target/CM3/Target.clayer.yml
# - type: CM4
# device: ARMCM4
# processor:
# fpu: off
# variables:
# - Target-Layer: ../Target/CM4/Target.clayer.yml
- type: CM4_FP
device: ARMCM4
variables:
- Target-Layer: ../Target/CM4/Target.clayer.yml
- type: CM7
device: ARMCM7
variables:
- Target-Layer: ../Target/CM7/Target.clayer.yml
# - type: CM23
# device: ARMCM23
# processor:
# trustzone: off
# variables:
# - Target-Layer: ../Target/CM23/Target.clayer.yml
- type: CM33
device: ARMCM33
processor:
trustzone: off
variables:
- Target-Layer: ../Target/CM33/Target.clayer.yml
- type: CM55
device: ARMCM55
processor:
trustzone: off
variables:
- Target-Layer: ../Target/CM55/Target.clayer.yml
- type: CM55_Ethos
device: ARMCM55
processor:
trustzone: off
variables:
- Target-Layer: ../Target/CM55_Ethos/Target.clayer.yml
- type: CM85
device: ARMCM85
processor:
trustzone: off
variables:
- Target-Layer: ../Target/CM85/Target.clayer.yml
- type: CM85_Ethos
device: ARMCM85
processor:
trustzone: off
variables:
- Target-Layer: ../Target/CM85_Ethos/Target.clayer.yml

build-types:
- type: balanced
optimize: balanced
- type: size
optimize: size
- type: speed
optimize: speed

projects:
- project: ./Test/ML_Test.cproject.yml
90 changes: 90 additions & 0 deletions QeexoAutoML/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Qeexo AutoML

Base Directory: `QeexoAutoML`

## Solution

| solution-name | solution YML |
|:--------------|:-------------------------------------------------------|
| MLOps | [MLOps.csolution.yml](MLOps.csolution.yml) |

## Projects

| project-name | project YML |
|:--------------|:-------------------------------------------------------|
| ML_Test | [ML_Test.cproject.yml](Test/ML_Test.cproject.yml) |

## Target types

| target-type | Target processor | model-executable |
|:------------|:--------------------------|:-------------------------------|
| CM4_FP | Cortex-M4_FP | VHT_MPS2_Cortex-M4 |
| CM7 | Cortex-M7 | VHT_MPS2_Cortex-M7 |
| CM33 | Cortex-M33 | VHT_MPS2_Cortex-M33 |
| CM55 | Cortex-M55 | VHT_MPS3_Corstone_SSE-300 |
| CM85 | Cortex-M85 | VHT_Corstone_SSE-310 |
| CM55_Ethos | Cortex-M55 with Ethos-U55 | VHT_Corstone_SSE-300_Ethos-U55 |
| CM85_Ethos | Cortex-M85 with Ethos-U65 | VHT_Corstone_SSE-310_Ethos-U65 |

## Build types

| build-type |
|:------------|
| balanced |
| size |
| speed |

## Toolchain

| toolchain |
|:--------------|
| AC6 |
| GCC (default) |

>Currently only AC6 is supported!
## Build

Build command syntax:

`cbuild MLOps.csolution.yml [--context [<project-name>][.<build-type>][+<target-type>]] [--toolchain <toolchain>]`

Examples:

- Build Test for Cortex-M7 with AC6 (size)
```sh
cbuild MLOps.csolution.yml --context ML_Test.size+CM7 --toolchain AC6
```
- Build Test for Cortex-M7 with AC6 (size, size, speed)
```sh
cbuild MLOps.csolution.yml --context +CM7 --toolchain AC6
```
- Build Test for all cores with GCC (size, size, speed)
```sh
cbuild MLOps.csolution.yml
```

## Run Test

Run command syntax:

`<model-executable> -f ./Target/<target_type>/fvp_config.txt ./out/ML_test/<target-type>/<build-type>/ML_Test.axf --simlimit 10`

Examples:

- Run Test on model for Cortex-M7 (size)
```sh
VHT_MPS2_Cortex-M7 -f ./Target/CM7/fvp_config.txt ./out/ML_Test/CM7/size/ML_Test.axf --simlimit 10
```
- Run Test on model for Cortex-M55 with Ethos (size)
```sh
VHT_Corstone_SSE-300_Ethos-U55 -f ./Target/CM55_Ethos/fvp_config.txt ./out/ML_Test/CM55_Ethos/size/ML_Test.axf --simlimit 10
```

## Show Test timing

Command syntax:

```sh
eventlist -s EventRecorder.log
```
60 changes: 60 additions & 0 deletions QeexoAutoML/Target/CM0/RTE/Device/ARMCM0/regions_ARMCM0.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#ifndef REGIONS_ARMCM0_H
#define REGIONS_ARMCM0_H


//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------

// <n>Device pack: ARM.CMSIS_DFP.0.0.0
// <i>Device pack used to generate this file

// <h>ROM Configuration
// =======================
// <h> ROM=<__ROM0>
// <o> Base address <0x0-0xFFFFFFFF:8>
// <i> Defines base address of memory region.
// <i> Default: 0x00000000
#define __ROM0_BASE 0x00000000
// <o> Region size [bytes] <0x0-0xFFFFFFFF:8>
// <i> Defines size of memory region.
// <i> Default: 0x00040000
#define __ROM0_SIZE 0x00400000
// <q>Default region
// <i> Enables memory region globally for the application.
#define __ROM0_DEFAULT 1
// <q>Startup
// <i> Selects region to be used for startup code.
#define __ROM0_STARTUP 1
// </h>

// </h>

// <h>RAM Configuration
// =======================
// <h> RAM=<__RAM0>
// <o> Base address <0x0-0xFFFFFFFF:8>
// <i> Defines base address of memory region.
// <i> Default: 0x20000000
#define __RAM0_BASE 0x20000000
// <o> Region size [bytes] <0x0-0xFFFFFFFF:8>
// <i> Defines size of memory region.
// <i> Default: 0x00020000
#define __RAM0_SIZE 0x00400000
// <q>Default region
// <i> Enables memory region globally for the application.
#define __RAM0_DEFAULT 1
// <q>No zero initialize
// <i> Excludes region from zero initialization.
#define __RAM0_NOINIT 0
// </h>

// </h>

// <h>Stack / Heap Configuration
// <o0> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
// <o1> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
#define __STACK_SIZE 0x00001000
#define __HEAP_SIZE 0x00010000
// </h>


#endif /* REGIONS_ARMCM0_H */
Loading

0 comments on commit d54ef60

Please sign in to comment.