-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I need help about “assert failed: dl::Tensor<T>& dl::Tensor<T>::reshape(std::vector<int>) [with T = short int] dl_variable.cpp:77 (size == size_gt)“ (AIV-694) #163
Comments
@emoof1
|
@100312dog By the way, I would like to know how to achieve targeting using ESP-DL do you have any good suggestions or references to articles? |
@emoof1
according your code provided, the usage should be
|
---------This is my camera config
.pixel_format = PIXFORMAT_RGB565,
.frame_size = FRAMESIZE_96X96,
---------This is my model on python
print(tf.version)
model = Sequential()
model.add(Conv2D(32, (5, 5), activation='relu', input_shape=(96, 96, 3)))
model.add(MaxPooling2D((2, 2)))
model.add(Dropout(0.2))
model.add(Conv2D(64, (3, 3), activation='relu'))
model.add(MaxPooling2D((2, 2)))
model.add(Dropout(0.2))
model.add(Conv2D(64, (3, 3), activation='relu'))
model.add(MaxPooling2D((2, 2)))
model.add(Dropout(0.2))
model.add(Conv2D(64, (3, 3), activation='relu'))
model.add(MaxPooling2D((2, 2)))
model.add(Dropout(0.2))
model.add(Conv2D(64, (3, 3), activation='relu'))
model.add(MaxPooling2D((2, 2)))
model.add(Flatten())
model.add(Dense(128, activation='relu'))
model.add(Dense(64, activation='relu'))
model.add(Dense(32, activation='relu'))
model.add(Dense(2, activation='softmax'))
model.compile(optimizer='adam',loss='sparse_categorical_crossentropy',metrics=['accuracy'])
---------This is my model on C produced by python
#pragma once
#include <stdint.h>
#include "dl_layer_model.hpp"
#include "dl_layer_base.hpp"
#include "dl_layer_max_pool2d.hpp"
#include "dl_layer_conv2d.hpp"
#include "dl_layer_reshape.hpp"
#include "dl_layer_softmax.hpp"
#include "handrecognition_coefficient.hpp"
#include "handrecognition_coefficient.cpp"
using namespace dl;
using namespace layer;
using namespace handrecognition_coefficient;
class HANDRECOGNITION : public Model<int16_t>
{
private:
Conv2D<int16_t> l1;
MaxPool2D<int16_t> l2;
Conv2D<int16_t> l3;
MaxPool2D<int16_t> l4;
Conv2D<int16_t> l5;
MaxPool2D<int16_t> l6;
Conv2D<int16_t> l7;
MaxPool2D<int16_t> l8;
Conv2D<int16_t> l9;
MaxPool2D<int16_t> l10;
Reshape<int16_t> l11;
Conv2D<int16_t> l12;
Conv2D<int16_t> l13;
Conv2D<int16_t> l14;
Conv2D<int16_t> l15;
public:
Softmax<int16_t> l16; // output layer
HANDRECOGNITION () :
l1(Conv2D<int16_t>(-8, get_statefulpartitionedcall_sequential_conv2d_biasadd_filter(), get_statefulpartitionedcall_sequential_conv2d_biasadd_bias(), get_statefulpartitionedcall_sequential_conv2d_biasadd_activation(), PADDING_VALID, {}, 1,1, "l1")),
l2(MaxPool2D<int16_t>({2,2},PADDING_VALID, {}, 2, 2, "l2")),
l3(Conv2D<int16_t>(-9, get_statefulpartitionedcall_sequential_conv2d_1_biasadd_filter(), get_statefulpartitionedcall_sequential_conv2d_1_biasadd_bias(), get_statefulpartitionedcall_sequential_conv2d_1_biasadd_activation(), PADDING_VALID,{}, 1,1, "l3")),
l4(MaxPool2D<int16_t>({2,2},PADDING_VALID,{}, 2, 2, "l4")),
l5(Conv2D<int16_t>(-9, get_statefulpartitionedcall_sequential_conv2d_2_biasadd_filter(), get_statefulpartitionedcall_sequential_conv2d_2_biasadd_bias(), get_statefulpartitionedcall_sequential_conv2d_2_biasadd_activation(), PADDING_VALID,{}, 1,1, "l5")),
l6(MaxPool2D<int16_t>({2,2},PADDING_VALID,{}, 2, 2, "l6")),
void build(Tensor<int16_t> &input)
{
this->l1.build(input);
this->l2.build(this->l1.get_output());
this->l3.build(this->l2.get_output());
this->l4.build(this->l3.get_output());
this->l5.build(this->l4.get_output());
this->l6.build(this->l5.get_output());
this->l7.build(this->l6.get_output());
this->l8.build(this->l7.get_output());
this->l9.build(this->l8.get_output());
this->l10.build(this->l9.get_output());
this->l11.build(this->l10.get_output());
this->l12.build(this->l11.get_output());
this->l13.build(this->l12.get_output());
this->l14.build(this->l13.get_output());
this->l15.build(this->l14.get_output());
this->l16.build(this->l15.get_output());
}
void call(Tensor<int16_t> &input)
{
this->l1.call(input);
input.free_element();
};
----------This is my main
int input_height = 96;
int input_width = 96;
int input_channel = 3;
int input_exponent = -7;
int16_t model_input = (int16_t )dl::tool::malloc_aligned_prefer(input_heightinput_widthinput_channel, sizeof(int16_t *));
camera_fb_t *fbd = NULL;
static const char *TAG = "example";
static void Get(void *){
while(1){
if (xSemaphoreTake(xMutexInventory, SPINLOCK_WAIT_FOREVER) == pdPASS){
fbd = esp_camera_fb_get();
ESP_LOGI("esp", "Len:%d Wid:%d High:%d \n",fbd->len,fbd->width,fbd->height);
int id=0;
for (int i = 0; i < fbd->len; i +=2)
{
}
but there is a error :
assert failed: dl::Tensor& dl::Tensor::reshape(std::vector) [with T = short int] dl_variable.cpp:77 (size == size_gt)
Backtrace: 0x403760c6:0x3fceb880 0x4037c691:0x3fceb8a0 0x40382795:0x3fceb8c0 0x4201746b:0x3fceb9e0 0x4200cea6:0x3fceba10 0x42017db2:0x3fcebab0 0x4200b899:0x3fcebad0 0x4037f325:0x3fcebf20
ELF file SHA256: 768f2a452bcd0c8f
I don't know how to solve it , if you kown please tell me .
Thanks !
The text was updated successfully, but these errors were encountered: