Skip to content

Commit

Permalink
SDK release v1.60.2
Browse files Browse the repository at this point in the history
  • Loading branch information
francovaro committed Oct 14, 2024
1 parent 740bd62 commit c56ace1
Show file tree
Hide file tree
Showing 26 changed files with 803 additions and 434 deletions.
17 changes: 11 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.57.18/</url>
<url>https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.60.2/</url>
<supportContact>[email protected]</supportContact>
<repository type="git">https://github.com/edgeimpulse/edge-impulse-sdk-pack.git</repository>
<releases>
<release version="1.57.18" tag="v1.57.18" date="2024-09-18" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.57.18/EdgeImpulse.EI-SDK.1.57.18.pack">
<release version="1.60.2" tag="v1.60.2" date="2024-10-14" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.60.2/EdgeImpulse.EI-SDK.1.60.2.pack">
EI-SDK
</release>
<release version="1.57.18" tag="v1.57.18" date="2024-09-18" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.57.18/EdgeImpulse.EI-SDK.1.57.18.pack">
EI-SDK
</release>
<release version="1.57.11" tag="v1.57.11" date="2024-09-12" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.57.11/EdgeImpulse.EI-SDK.1.57.11.pack">
EI-SDK
</release>
Expand Down Expand Up @@ -98,9 +101,6 @@
</release>
<release version="1.49.38" tag="v1.49.38" date="2024-05-17" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.49.38/EdgeImpulse.EI-SDK.1.49.38.pack">
EI-SDK
</release>
<release version="1.49.31" tag="v1.49.31" date="2024-05-15" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.49.31/EdgeImpulse.EI-SDK.1.49.31.pack">
EI-SDK
</release>
</releases>
<keywords>
Expand Down Expand Up @@ -146,7 +146,7 @@
</packages>
</requirements>
<components>
<component Cclass="EdgeImpulse" Cgroup="SDK" Cversion="1.57.18">
<component Cclass="EdgeImpulse" Cgroup="SDK" Cversion="1.60.2">
<description>Edge Impulse SDK</description>
<!-- short component description -->
<files>
Expand Down Expand Up @@ -355,6 +355,8 @@
<file category="source" name="edgeimpulse/edge-impulse-sdk/porting/stm32-cubeai/debug_log.cpp"/>
<file category="source" name="edgeimpulse/edge-impulse-sdk/porting/arduino/ei_classifier_porting.cpp"/>
<file category="source" name="edgeimpulse/edge-impulse-sdk/porting/arduino/debug_log.cpp"/>
<file category="source" name="edgeimpulse/edge-impulse-sdk/porting/ambiq/ei_classifier_porting.cpp"/>
<file category="source" name="edgeimpulse/edge-impulse-sdk/porting/ambiq/debug_log.cpp"/>
<file category="source" name="edgeimpulse/edge-impulse-sdk/porting/synaptics/ei_classifier_porting.cpp"/>
<file category="source" name="edgeimpulse/edge-impulse-sdk/porting/synaptics/debug_log.cpp"/>
<file category="source" name="edgeimpulse/edge-impulse-sdk/porting/mingw32/ei_classifier_porting.cpp"/>
Expand All @@ -374,6 +376,7 @@
<file category="header" name="edgeimpulse/edge-impulse-sdk/classifier/ei_aligned_malloc.h"/>
<file category="header" name="edgeimpulse/edge-impulse-sdk/classifier/ei_run_dsp.h"/>
<file category="header" name="edgeimpulse/edge-impulse-sdk/classifier/ei_nms.h"/>
<file category="header" name="edgeimpulse/edge-impulse-sdk/classifier/ei_constants.h"/>
<file category="header" name="edgeimpulse/edge-impulse-sdk/classifier/ei_run_classifier_c.h"/>
<file category="header" name="edgeimpulse/edge-impulse-sdk/classifier/ei_run_classifier.h"/>
<file category="header" name="edgeimpulse/edge-impulse-sdk/classifier/ei_run_classifier_image.h"/>
Expand Down Expand Up @@ -631,6 +634,8 @@
<file category="header" name="edgeimpulse/edge-impulse-sdk/dsp/kissfft/kissfft.h"/>
<file category="header" name="edgeimpulse/edge-impulse-sdk/dsp/kissfft/kiss_fftr.h"/>
<file category="header" name="edgeimpulse/edge-impulse-sdk/dsp/dct/fast-dct-fft.h"/>
<file category="header" name="edgeimpulse/edge-impulse-sdk/dsp/dsp_engines/ei_arm_cmsis_dsp.h"/>
<file category="header" name="edgeimpulse/edge-impulse-sdk/dsp/dsp_engines/ei_no_hw_dsp.h"/>
<file category="header" name="edgeimpulse/edge-impulse-sdk/porting/ei_classifier_porting.h"/>
<file category="header" name="edgeimpulse/edge-impulse-sdk/porting/ei_logging.h"/>
<file category="header" name="edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/ethosu_driver.h"/>
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-09-18 09:32:58</timestamp>
<timestamp>2024-10-14 09:07:02</timestamp>
<pindex>
<pdsc url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.57.18/" vendor="EdgeImpulse" name="EI-SDK" version="1.57.18"/>
<pdsc url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.60.2/" vendor="EdgeImpulse" name="EI-SDK" version="1.60.2"/>
</pindex>
</index>
10 changes: 9 additions & 1 deletion edgeimpulse/edge-impulse-sdk/classifier/ei_classifier_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ typedef struct {
int64_t anomaly_us;
} ei_impulse_result_timing_t;

/**
* @brief Holds intermediate results of hr / hrv block
*
*/
typedef struct {
float heart_rate;
} ei_impulse_result_hr_t;

/**
* @brief Holds the output of inference, anomaly results, and timing information.
*
Expand Down Expand Up @@ -290,7 +298,7 @@ typedef struct {
ei_post_processing_output_t postprocessed_output;

#if EI_DSP_ENABLE_RUNTIME_HR == 1
float heart_rate;
ei_impulse_result_hr_t hr_calcs;
#endif
} ei_impulse_result_t;

Expand Down
12 changes: 12 additions & 0 deletions edgeimpulse/edge-impulse-sdk/classifier/ei_constants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef __EI_CONSTANTS__H__
#define __EI_CONSTANTS__H__

#define EI_CLASSIFIER_RESIZE_NONE 0
#define EI_CLASSIFIER_RESIZE_FIT_SHORTEST 1
#define EI_CLASSIFIER_RESIZE_FIT_LONGEST 2
#define EI_CLASSIFIER_RESIZE_SQUASH 3

// This exists for linux runner, etc
__attribute__((unused)) static const char *EI_RESIZE_STRINGS[] = { "none", "fit-shortest", "fit-longest", "squash" };

#endif //!__EI_CONSTANTS__H__
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@ __attribute__((unused)) static EI_IMPULSE_ERROR fill_result_visual_ad_struct_f32
int added_boxes_count = 0;
results.clear();

for (uint32_t x = 0; x <= impulse->visual_ad_grid_size_x - 1; x++) {
for (uint32_t y = 0; y <= impulse->visual_ad_grid_size_y - 1; y++) {
for (uint16_t x = 0; x <= impulse->visual_ad_grid_size_x - 1; x++) {
for (uint16_t y = 0; y <= impulse->visual_ad_grid_size_y - 1; y++) {
if (data[x * impulse->visual_ad_grid_size_x + y] >= block_config->threshold) {
ei_impulse_result_bounding_box_t tmp = {
.label = "anomaly",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ extern "C" EI_IMPULSE_ERROR process_impulse(ei_impulse_handle_t *handle,
ret = dsp_handle->extract(internal_signal, features[ix].matrix, block.config, handle->impulse->frequency);
#if EI_DSP_ENABLE_RUNTIME_HR == 1
hr_class* hr = static_cast<hr_class*>(dsp_handle);
result->heart_rate = hr->get_last_hr();
result->hr_calcs.heart_rate = hr->get_last_hr();
#endif
}
else {
Expand Down
12 changes: 11 additions & 1 deletion edgeimpulse/edge-impulse-sdk/classifier/ei_run_dsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,9 @@ __attribute__((unused)) int extract_image_features(signal_t *signal, matrix_t *o

#if (EI_CLASSIFIER_QUANTIZATION_ENABLED == 1) && (EI_CLASSIFIER_INFERENCING_ENGINE == EI_CLASSIFIER_DRPAI)

/*
* Since we run the preprocessing on the DRP we pass the input buffer (mostly) as-is.
*/
__attribute__((unused)) int extract_drpai_features_quantized(signal_t *signal, matrix_u8_t *output_matrix, void *config_ptr, const float frequency) {
ei_dsp_config_image_t config = *((ei_dsp_config_image_t*)config_ptr);

Expand Down Expand Up @@ -1193,7 +1196,14 @@ __attribute__((unused)) int extract_drpai_features_quantized(signal_t *signal, m
output_matrix->buffer[output_ix++] = b;
}
else {
//NOTE: not implementing greyscale yet
float r = static_cast<float>(pixel >> 16 & 0xff);
float g = static_cast<float>(pixel >> 8 & 0xff);
float b = static_cast<float>(pixel & 0xff);

// ITU-R 601-2 luma transform
// see: https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.convert
float v = (0.299f * r) + (0.587f * g) + (0.114f * b);
output_matrix->buffer[output_ix++] = v;
}
}
bytes_left -= elements_to_read;
Expand Down
26 changes: 10 additions & 16 deletions edgeimpulse/edge-impulse-sdk/classifier/inferencing_engines/drpai.h
Original file line number Diff line number Diff line change
Expand Up @@ -710,22 +710,16 @@ EI_IMPULSE_ERROR run_nn_inference_image_quantized(
return EI_IMPULSE_UNSUPPORTED_INFERENCING_ENGINE;
}
case EI_CLASSIFIER_LAST_LAYER_YOLOV5_V5_DRPAI: {
if (block_config->quantized == 1) {
ei_printf("ERR: YOLOv5 does not support quantized inference\n");
return EI_IMPULSE_UNSUPPORTED_INFERENCING_ENGINE;
}
else {
if (debug) {
ei_printf("DEBUG: raw drpai output");
ei_printf("\n[");
// impulse->tflite_output_features_count can't be used here as this is not the final output
// so print only the first 10 values.
for (uint32_t i = 0; i < 10; i++) {
ei_printf_float(drpai_output_buf[i]);
ei_printf(" ");
}
ei_printf("]\n");
}
if (debug) {
ei_printf("DEBUG: raw drpai output");
ei_printf("\n[");
// impulse->tflite_output_features_count can't be used here as this is not the final output
// so print only the first 10 values.
for (uint32_t i = 0; i < 10; i++) {
ei_printf_float(drpai_output_buf[i]);
ei_printf(" ");
}
ei_printf("]\n");
}

#if ((EI_CLASSIFIER_OBJECT_DETECTION == 1) && (EI_CLASSIFIER_OBJECT_DETECTION_LAST_LAYER == EI_CLASSIFIER_LAST_LAYER_YOLOV5_V5_DRPAI))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ EI_IMPULSE_ERROR run_nn_inference(
void *config_ptr,
bool debug);

int extract_tflite_eon_features(signal_t *signal, matrix_t *output_matrix,
int extract_tflite_eon_features(ei::signal_t *signal, ei::matrix_t *output_matrix,
void *config_ptr, const float frequency);

int extract_tflite_features(signal_t *signal, matrix_t *output_matrix,
int extract_tflite_features(ei::signal_t *signal, ei::matrix_t *output_matrix,
void *config_ptr, const float frequency);

#endif // _EI_CLASSIFIER_ENGINES_H_s
83 changes: 2 additions & 81 deletions edgeimpulse/edge-impulse-sdk/dsp/dct/fast-dct-fft.cpp
Original file line number Diff line number Diff line change
@@ -1,81 +1,2 @@
/*
* Copyright (c) 2022 Project Nayuki. (MIT License)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS
* IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#include "fast-dct-fft.h"
#include "../returntypes.hpp"
#include "../numpy.hpp"
#include "../memory.hpp"

#ifndef M_PI
#define M_PI 3.14159265358979323846264338327950288
#endif // M_PI

// DCT type II, unscaled
int ei::dct::transform(float vector[], size_t len) {
const size_t fft_data_out_size = (len / 2 + 1) * sizeof(ei::fft_complex_t);
const size_t fft_data_in_size = len * sizeof(float);

// Allocate KissFFT input / output buffer
fft_complex_t *fft_data_out =
(ei::fft_complex_t*)ei_dsp_calloc(fft_data_out_size, 1);
if (!fft_data_out) {
return ei::EIDSP_OUT_OF_MEM;
}

float *fft_data_in = (float*)ei_dsp_calloc(fft_data_in_size, 1);
if (!fft_data_in) {
ei_dsp_free(fft_data_out, fft_data_out_size);
return ei::EIDSP_OUT_OF_MEM;
}

// Preprocess the input buffer with the data from the vector
size_t halfLen = len / 2;
for (size_t i = 0; i < halfLen; i++) {
fft_data_in[i] = vector[i * 2];
fft_data_in[len - 1 - i] = vector[i * 2 + 1];
}
if (len % 2 == 1) {
fft_data_in[halfLen] = vector[len - 1];
}

int r = ei::numpy::rfft(fft_data_in, len, fft_data_out, (len / 2 + 1), len);
if (r != 0) {
ei_dsp_free(fft_data_in, fft_data_in_size);
ei_dsp_free(fft_data_out, fft_data_out_size);
return r;
}

size_t i = 0;
for (; i < len / 2 + 1; i++) {
float temp = i * M_PI / (len * 2);
vector[i] = fft_data_out[i].r * cos(temp) + fft_data_out[i].i * sin(temp);
}
//take advantage of hermetian symmetry to calculate remainder of signal
for (; i < len; i++) {
float temp = i * M_PI / (len * 2);
int conj_idx = len-i;
// second half bins not calculated would have just been the conjugate of the first half (note minus of imag)
vector[i] = fft_data_out[conj_idx].r * cos(temp) - fft_data_out[conj_idx].i * sin(temp);
}
ei_dsp_free(fft_data_in, fft_data_in_size);
ei_dsp_free(fft_data_out, fft_data_out_size);

return 0;
}
// This file intentinally left blank
// Function moved to numpy.hpp
32 changes: 2 additions & 30 deletions edgeimpulse/edge-impulse-sdk/dsp/dct/fast-dct-fft.h
Original file line number Diff line number Diff line change
@@ -1,35 +1,7 @@
/*
* Copyright (c) 2022 Project Nayuki. (MIT License)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS
* IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef __FAST_DCT_FFT__H__
#define __FAST_DCT_FFT__H__


#include <stdbool.h>
#include <stddef.h>
#include "../kissfft/kiss_fft.h"

namespace ei {
namespace dct {

int transform(float vector[], size_t len);
int inverse_transform(float vector[], size_t len);

} // namespace dct
} // namespace ei
// This file intentinally left blank
// Function moved to numpy.hpp

#endif //!__FAST-DCT-FFT__H__
Loading

0 comments on commit c56ace1

Please sign in to comment.