Skip to content

Commit

Permalink
SDK release v1.57.11
Browse files Browse the repository at this point in the history
  • Loading branch information
mmajchrzycki committed Sep 12, 2024
1 parent 3efb012 commit 27fc96c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 24 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.57.9/</url>
<url>https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.57.11/</url>
<supportContact>[email protected]</supportContact>
<repository type="git">https://github.com/edgeimpulse/edge-impulse-sdk-pack.git</repository>
<releases>
<release version="1.57.9" tag="v1.57.9" date="2024-09-05" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.57.9/EdgeImpulse.EI-SDK.1.57.9.pack">
<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>
<release version="1.57.9" tag="v1.57.9" date="2024-09-05" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.57.9/EdgeImpulse.EI-SDK.1.57.9.pack">
EI-SDK
</release>
<release version="1.57.1" tag="v1.57.1" date="2024-08-23" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.57.1/EdgeImpulse.EI-SDK.1.57.1.pack">
EI-SDK
</release>
Expand Down Expand Up @@ -98,9 +101,6 @@
</release>
<release version="1.49.30" tag="v1.49.30" date="2024-05-14" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.49.30/EdgeImpulse.EI-SDK.1.49.30.pack">
EI-SDK
</release>
<release version="1.49.27" tag="v1.49.27" date="2024-05-13" url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.49.27/EdgeImpulse.EI-SDK.1.49.27.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.9">
<component Cclass="EdgeImpulse" Cgroup="SDK" Cversion="1.57.11">
<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-09-05 09:16:54</timestamp>
<timestamp>2024-09-12 14:30:49</timestamp>
<pindex>
<pdsc url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.57.9/" vendor="EdgeImpulse" name="EI-SDK" version="1.57.9"/>
<pdsc url="https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.57.11/" vendor="EdgeImpulse" name="EI-SDK" version="1.57.11"/>
</pindex>
</index>
26 changes: 11 additions & 15 deletions edgeimpulse/edge-impulse-sdk/classifier/ei_fill_result_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,42 +404,38 @@ __attribute__((unused)) static EI_IMPULSE_ERROR fill_result_struct_f32(const ei_
__attribute__((unused)) static EI_IMPULSE_ERROR fill_result_visual_ad_struct_f32(const ei_impulse_t *impulse,
ei_impulse_result_t *result,
float *data,
float threshold,
ei_learning_block_config_tflite_graph_t* block_config,
bool debug) {
#if EI_CLASSIFIER_HAS_VISUAL_ANOMALY
float max_val = 0;
float sum_val = 0;
// the feature extractor output will be 1/8 of input
// due to the cut-off layer chosen in MobileNetV2
uint32_t grid_size_x = (impulse->input_width / 8) / 2 - 1;
uint32_t grid_size_y = (impulse->input_height / 8) / 2 - 1;

for (uint32_t ix = 0; ix < grid_size_x * grid_size_y; ix++) {
for (uint32_t ix = 0; ix < impulse->visual_ad_grid_size_x * impulse->visual_ad_grid_size_y; ix++) {
float value = data[ix];
sum_val += value;
if (value > max_val) {
max_val = value;
}
}

result->visual_ad_result.mean_value = sum_val / (grid_size_x * grid_size_y);
result->visual_ad_result.mean_value = sum_val / (impulse->visual_ad_grid_size_x * impulse->visual_ad_grid_size_y);
result->visual_ad_result.max_value = max_val;

static ei_vector<ei_impulse_result_bounding_box_t> results;

int added_boxes_count = 0;
results.clear();

for (uint32_t x = 0; x <= grid_size_x - 1; x++) {
for (uint32_t y = 0; y <= grid_size_y - 1; y++) {
if (data[x * grid_size_x + y] >= threshold) {
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++) {
if (data[x * impulse->visual_ad_grid_size_x + y] >= block_config->threshold) {
ei_impulse_result_bounding_box_t tmp = {
.label = "anomaly",
.x = static_cast<uint32_t>(y * (static_cast<float>(impulse->input_height) / grid_size_y)),
.y = static_cast<uint32_t>(x * (static_cast<float>(impulse->input_width) / grid_size_x)),
.width = (impulse->input_width / grid_size_x),
.height = (impulse->input_height / grid_size_y),
.value = data[x * grid_size_x + y]
.x = static_cast<uint32_t>(y * (static_cast<float>(impulse->input_height) / impulse->visual_ad_grid_size_y)),
.y = static_cast<uint32_t>(x * (static_cast<float>(impulse->input_width) / impulse->visual_ad_grid_size_x)),
.width = (impulse->input_width / impulse->visual_ad_grid_size_x),
.height = (impulse->input_height / impulse->visual_ad_grid_size_y),
.value = data[x * impulse->visual_ad_grid_size_x + y]
};

results.push_back(tmp);
Expand Down
2 changes: 2 additions & 0 deletions edgeimpulse/edge-impulse-sdk/classifier/ei_model_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ typedef struct ei_impulse {
/* object detection */
uint16_t object_detection_count;
uint32_t fomo_output_size;
uint16_t visual_ad_grid_size_x;
uint16_t visual_ad_grid_size_y;
uint32_t tflite_output_features_count;

/* learning blocks */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ EI_IMPULSE_ERROR fill_result_struct_from_output_tensor_tflite(
else if (block_config->classification_mode == EI_CLASSIFIER_CLASSIFICATION_MODE_VISUAL_ANOMALY)
{
if (!result->copy_output) {
fill_res = fill_result_visual_ad_struct_f32(impulse, result, output->data.f, block_config->threshold, debug);
fill_res = fill_result_visual_ad_struct_f32(impulse, result, output->data.f, block_config, debug);
}
}
// if we copy the output, we don't need to process it as classification
Expand Down

0 comments on commit 27fc96c

Please sign in to comment.