Skip to content

Commit

Permalink
SDK release v1.61.36
Browse files Browse the repository at this point in the history
  • Loading branch information
francovaro committed Dec 8, 2024
1 parent 446f260 commit 04e5c2f
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 23 deletions.
12 changes: 6 additions & 6 deletions EdgeImpulse.EI-SDK.pdsc
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
<name>EI-SDK</name>
<license>LICENSE-apache-2.0.txt</license>
<description>Edge Impulse SDK</description>
<url>https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.61.30/</url>
<url>https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.61.36/</url>
<supportContact>[email protected]</supportContact>
<repository type="git">https://github.com/edgeimpulse/edge-impulse-sdk-pack.git</repository>
<releases>
<release version="1.61.30" tag="v1.61.30" date="2024-12-02" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.61.30/EdgeImpulse.EI-SDK.1.61.30.pack">
<release version="1.61.36" tag="v1.61.36" date="2024-12-08" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.61.36/EdgeImpulse.EI-SDK.1.61.36.pack">
EI-SDK
</release>
<release version="1.61.30" tag="v1.61.30" date="2024-12-02" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.61.30/EdgeImpulse.EI-SDK.1.61.30.pack">
EI-SDK
</release>
<release version="1.61.23" tag="v1.61.23" date="2024-11-22" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.61.23/EdgeImpulse.EI-SDK.1.61.23.pack">
EI-SDK
</release>
Expand Down Expand Up @@ -98,9 +101,6 @@
</release>
<release version="1.51.1" tag="v1.51.1" date="2024-06-09" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.51.1/EdgeImpulse.EI-SDK.1.51.1.pack">
EI-SDK
</release>
<release version="1.50.19" tag="v1.50.19" date="2024-06-05" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.50.19/EdgeImpulse.EI-SDK.1.50.19.pack">
EI-SDK
</release>
</releases>
<keywords>
Expand Down Expand Up @@ -146,7 +146,7 @@
</packages>
</requirements>
<components>
<component Cclass="EdgeImpulse" Cgroup="SDK" Cversion="1.61.30">
<component Cclass="EdgeImpulse" Cgroup="SDK" Cversion="1.61.36">
<description>Edge Impulse SDK</description>
<!-- short component description -->
<files>
Expand Down
4 changes: 2 additions & 2 deletions EdgeImpulse.pidx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<index schemaVersion="1.0.0" xs:noNamespaceSchemaLocation="PackIndex.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
<vendor>EdgeImpulse</vendor>
<url>https://raw.githubusercontent.com/edgeimpulse/edge-impulse-sdk-pack/main/</url>
<timestamp>2024-12-02 12:34:28</timestamp>
<timestamp>2024-12-08 22:21:40</timestamp>
<pindex>
<pdsc url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.61.30/" vendor="EdgeImpulse" name="EI-SDK" version="1.61.30"/>
<pdsc url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.61.36/" vendor="EdgeImpulse" name="EI-SDK" version="1.61.36"/>
</pindex>
</index>
52 changes: 50 additions & 2 deletions edgeimpulse/edge-impulse-sdk/classifier/ei_run_classifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ extern "C" EI_IMPULSE_ERROR process_impulse(ei_impulse_handle_t *handle,
ei_impulse_result_t *result,
bool debug = false)
{
if(!handle) {
if ((handle == nullptr) || (handle->impulse == nullptr) || (result == nullptr) || (signal == nullptr)) {
return EI_IMPULSE_INFERENCE_ERROR;
}

Expand All @@ -252,19 +252,43 @@ extern "C" EI_IMPULSE_ERROR process_impulse(ei_impulse_handle_t *handle,
// smart pointer to features array
std::unique_ptr<ei_feature_t[]> features_ptr(new ei_feature_t[block_num]);
ei_feature_t* features = features_ptr.get();

if (features == nullptr) {
ei_printf("ERR: Out of memory, can't allocate features\n");
return EI_IMPULSE_ALLOC_FAILED;
}

memset(features, 0, sizeof(ei_feature_t) * block_num);

// have it outside of the loop to avoid going out of scope
std::unique_ptr<std::unique_ptr<ei::matrix_t>[]> matrix_ptrs_ptr(new std::unique_ptr<ei::matrix_t>[block_num]);
std::unique_ptr<ei::matrix_t> *matrix_ptrs = matrix_ptrs_ptr.get();

if (matrix_ptrs == nullptr) {
delete[] matrix_ptrs;
ei_printf("ERR: Out of memory, can't allocate matrix_ptrs\n");
return EI_IMPULSE_ALLOC_FAILED;
}

uint64_t dsp_start_us = ei_read_timer_us();

size_t out_features_index = 0;

for (size_t ix = 0; ix < handle->impulse->dsp_blocks_size; ix++) {
ei_model_dsp_t block = handle->impulse->dsp_blocks[ix];

matrix_ptrs[ix] = std::unique_ptr<ei::matrix_t>(new ei::matrix_t(1, block.n_output_features));
if (matrix_ptrs[ix] == nullptr) {
ei_printf("ERR: Out of memory, can't allocate matrix_ptrs[%lu]\n", ix);
return EI_IMPULSE_ALLOC_FAILED;
}

if (matrix_ptrs[ix]->buffer == nullptr) {
ei_printf("ERR: Out of memory, can't allocate matrix_ptrs[%lu]\n", ix);
delete[] matrix_ptrs;
return EI_IMPULSE_ALLOC_FAILED;
}

features[ix].matrix = matrix_ptrs[ix].get();
features[ix].blockId = block.blockId;

Expand Down Expand Up @@ -395,8 +419,12 @@ extern "C" EI_IMPULSE_ERROR init_impulse(ei_impulse_handle_t *handle) {
extern "C" EI_IMPULSE_ERROR process_impulse_continuous(ei_impulse_handle_t *handle,
signal_t *signal,
ei_impulse_result_t *result,
bool debug)
bool debug = false)
{
if ((handle == nullptr) || (handle->impulse == nullptr) || (result == nullptr) || (signal == nullptr)) {
return EI_IMPULSE_INFERENCE_ERROR;
}

auto impulse = handle->impulse;
static ei::matrix_t static_features_matrix(1, impulse->nn_input_frame_size);
if (!static_features_matrix.buffer) {
Expand Down Expand Up @@ -482,16 +510,36 @@ extern "C" EI_IMPULSE_ERROR process_impulse_continuous(ei_impulse_handle_t *hand
// smart pointer to features array
std::unique_ptr<ei_feature_t[]> features_ptr(new ei_feature_t[block_num]);
ei_feature_t* features = features_ptr.get();
if (features == nullptr) {
ei_printf("ERR: Out of memory, can't allocate features\n");
return EI_IMPULSE_ALLOC_FAILED;
}
memset(features, 0, sizeof(ei_feature_t) * block_num);

// have it outside of the loop to avoid going out of scope
std::unique_ptr<ei::matrix_t> *matrix_ptrs = new std::unique_ptr<ei::matrix_t>[block_num];
if (matrix_ptrs == nullptr) {
ei_printf("ERR: Out of memory, can't allocate matrix_ptrs\n");
return EI_IMPULSE_ALLOC_FAILED;
}

out_features_index = 0;
// iterate over every dsp block and run normalization
for (size_t ix = 0; ix < impulse->dsp_blocks_size; ix++) {
ei_model_dsp_t block = impulse->dsp_blocks[ix];
matrix_ptrs[ix] = std::unique_ptr<ei::matrix_t>(new ei::matrix_t(1, block.n_output_features));

if (matrix_ptrs[ix] == nullptr) {
ei_printf("ERR: Out of memory, can't allocate matrix_ptrs[%lu]\n", ix);
return EI_IMPULSE_ALLOC_FAILED;
}

if (matrix_ptrs[ix]->buffer == nullptr) {
ei_printf("ERR: Out of memory, can't allocate matrix_ptrs[%lu]\n", ix);
delete[] matrix_ptrs;
return EI_IMPULSE_ALLOC_FAILED;
}

features[ix].matrix = matrix_ptrs[ix].get();
features[ix].blockId = block.blockId;

Expand Down
2 changes: 1 addition & 1 deletion edgeimpulse/edge-impulse-sdk/dsp/numpy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2511,7 +2511,7 @@ class numpy {
first_time = false; // only warn once
if (res == EIDSP_FFT_SIZE_NOT_SUPPORTED) {
EI_LOGI("HW RFFT failed, FFT size not supported. Must be a power of 2 between %d and %d, (size was %d)",
ei::fft::MIN_FFT_SIZE, ei::fft::MAX_FFT_SIZE, n_fft);
ei::fft::MIN_FFT_SIZE, ei::fft::MAX_FFT_SIZE, (int)n_fft);
}
else {
EI_LOGI("HW RFFT failed, falling back to SW");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1786,13 +1786,16 @@ TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
if (input->type == kTfLiteInt8) {
data_dims_t input_dims = {
.width = input_width, .height = input_height,
.channels = input->dims->data[3], 1
.channels = input->dims->data[3], .extra = 1
};
data_dims_t output_dims = {
.width = output_width, .height = output_height,
.channels = output->dims->data[3], 1
.channels = output->dims->data[3], .extra = 1
};
data_dims_t filter_dims = {
.width = filter_width, .height = filter_height,
.channels = 0, .extra = 0
};
data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
conv_params_t conv_params = {
.in_offset = 0, .out_offset = 0,
.stride = {params.stride_width, params.stride_height},
Expand Down Expand Up @@ -1880,13 +1883,15 @@ inline void EvalQuantizedPerChannel(

data_dims_t input_dims = {
.width = input_width, .height = input_height,
.channels = input_depth, 1
.channels = input_depth, .extra = 1
};
data_dims_t output_dims = {
.width = output_width, .height = output_height,
.channels = output_depth, 1
.channels = output_depth, .extra = 1
};
data_dims_t filter_dims = { .width = filter_width, .height = filter_height,
.channels = 0, .extra = 0
};
data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
conv_params_t conv_params = {
.in_offset = input_offset, .out_offset = output_offset,
.stride = {stride_width, stride_height},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1724,13 +1724,15 @@ inline void EvalQuantizedPerChannel(TfLiteContext* context, TfLiteNode* node,

data_dims_t input_dims = {
.width = input_width, .height = input_height,
.channels = input_depth, 1
.channels = input_depth, .extra = 1
};
data_dims_t output_dims = {
.width = output_width, .height = output_height,
.channels = output_depth, 1
.channels = output_depth, .extra = 1
};
data_dims_t filter_dims = { .width = filter_width, .height = filter_height,
.channels = 0, .extra = 0
};
data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
dw_conv_params_t conv_params = {
.in_offset = input_offset, .out_offset = output_offset,
.ch_mult = depth_multiplier,
Expand Down Expand Up @@ -1833,13 +1835,15 @@ TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
if (input->type == kTfLiteInt8) {
data_dims_t input_dims = {
.width = input_width, .height = input_height,
.channels = input->dims->data[3], 1
.channels = input->dims->data[3], .extra = 1
};
data_dims_t output_dims = {
.width = output_width, .height = output_height,
.channels = output->dims->data[3], 1
.channels = output->dims->data[3], .extra = 1
};
data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
data_dims_t filter_dims = {
.width = filter_width, .height = filter_height,
.channels = 0, .extra = 0};
dw_conv_params_t conv_params = {
.in_offset = 0, .out_offset = 0,
.ch_mult = params.depth_multiplier,
Expand Down

0 comments on commit 04e5c2f

Please sign in to comment.