Issues Deploying Custom Model to ESP32s3 due to Dimension Issue

ketavery
Posts: 2
Joined: Thu May 30, 2024 9:28 pm

Issues Deploying Custom Model to ESP32s3 due to Dimension Issue

Postby ketavery » Thu May 30, 2024 10:53 pm

Hello, I am currently trying to use the Esp-dl [Manual Model Quantization and Deployment Guide](https://docs.espressif.com/projects/esp ... odels.html) in order to deploy a custom CIFAR10 CNN model onto an ESP32s3. I am running into an assert error in my first Conv2d layer:

Code: Select all

assert(input.shape[2] == this->filter->shape[2]);
This seems to assert that the number of channels should be equal to the number of kernals/filters. I expect a shape of (32, 32, 3) with 32x32 pixels and 3 channels for RGB, but when I check my input shape in building my tensor I find that I am inputting Shape: (32, 32, 3, 12). I am thinking there has to be something wrong with how I am defining my input data. I define it as a list of 3072 int_16's (32x32x3) in the following code:

Code: Select all

int input_height = 32;
    int input_width = 32;
    int input_channel = 3; // 3 channels for RGB
    int input_exponent = -15;

    int total_elements = input_height * input_width * input_channel;

    int16_t *model_input = (int16_t *)dl::tool::malloc_aligned_prefer(input_height*input_width*input_channel, sizeof(int16_t *));
    for(int i=0 ;i<input_height*input_width*input_channel; i++){
        float normalized_input = example_element[i] / 255.0; //normalization
        model_input[i] = (int16_t)DL_CLIP(normalized_input * (1 << -input_exponent), -32768, 32767);
    } 
    
    Tensor<int16_t> input;
    input.set_element((int16_t *)model_input).set_exponent(input_exponent).set_shape({32, 32, 3}).set_auto_free(false); 
  
Does anybody have any pointers as to why my input shape is being defined as (32, 32, 3, 12) rather than (32, 32, 3)? Please let me know if you need any more information, Thank You!

Who is online

Users browsing this forum: axellin and 126 guests