cancel
Showing results for 
Search instead for 
Did you mean: 

Network analyze result is only on final layer

pjb
Associate II

Hi - I'm attempting to run my first NN on an STM32H5. This is a low frame rate, low resolution vision application.

When loading NN into CubeMX, the Analyze results and graph are always the same - just the final dense layer. In case it matters, I train the network using tensorflow/keras and have tried multiple variations with similar results. Also, I have updated all tools and libraries within the last few weeks.
Below is my network_generated_report.txt. It shows the param/size and macc for all layers but the summary is just the final layer.

Why might this be and how do I get the complete results? Perhaps I am deeply misunderstanding something!

 

ST Edge AI Core v2.1.0-20194 329b0e98d
Created date          : 2025-06-05 12:55:47
Parameters            : generate --target stm32h5 --name network -m C:/AI/line_intensity_model.h5 --compression none --verbosity 1 --workspace C:/Users/me/AppData/Local/Temp/mxAI_workspace1431250019060016128019384163178723 --output C:/Users/me/.stm32cubemx/network_output

Exec/report summary (generate)
---------------------------------------------------------------------------------------------------------------
model file         :   C:\AI\line_intensity_model.h5                                                           
type               :   keras                                                                                   
c_name             :   network                                                                                 
compression        :   none                                                                                    
options            :   allocate-inputs, allocate-outputs                                                       
optimization       :   balanced                                                                                
target/series      :   stm32h5                                                                                 
workspace dir      :   C:\Users\me\AppData\Local\Temp\mxAI_workspace1431250019060016128019384163178723   
output dir         :   C:\Users\me\.stm32cubemx\network_output                                           
model_fmt          :   float                                                                                   
model_name         :   line_intensity_model                                                                    
model_hash         :   0xb124f1a71b6e4dc396d0dc1318a94841                                                      
params #           :   69,505 items (271.50 KiB)                                                               
---------------------------------------------------------------------------------------------------------------
input 1/1          :   'input_0', f32(1x24x24x2), 4.50 KBytes, activations                                     
output 1/1         :   'dense_17', f32(1x1), 4 Bytes, activations                                              
macc               :   25                                                                                      
weights (ro)       :   100 B (100 B) (1 segment) / -277,920(-100.0%) vs float model                            
activations (rw)   :   4,708 B (4.60 KiB) (1 segment) *                                                        
ram (total)        :   4,708 B (4.60 KiB) = 4,708 + 0 + 0                                                      
---------------------------------------------------------------------------------------------------------------
(*) 'input'/'output' buffers can be used from the activations buffer

Model name - line_intensity_model
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
m_id   layer (type,original)               oshape                 param/size              macc   connected to   | c_size              c_macc                c_type         
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
0      input_0 (Input, None)               [b:1,h:24,w:24,c:2]                                                  |                                           
       conv2d_10_conv2d (Conv2D, Conv2D)   [b:1,h:22,w:22,c:32]   608/2,432            278,816        input_0   | -2,432(-100.0%)     -278,816(-100.0%)     
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
1      input_1 (Input, None)               [b:1,h:22,w:22,c:32]                                                 |                                           
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
2      input_2 (Input, None)               [b:1,h:22,w:22,c:32]                                                 |                                           
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
3      input_3 (Input, None)               [b:1,h:11,w:11,c:32]                                                 |                                           
       conv2d_11_conv2d (Conv2D, Conv2D)   [b:1,h:9,w:9,c:64]     18,496/73,984      1,493,056        input_3   | -73,984(-100.0%)    -1,493,056(-100.0%)   
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
4      input_4 (Input, None)               [b:1,h:9,w:9,c:64]                                                   |                                           
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
5      input_5 (Input, None)               [b:1,h:9,w:9,c:64]                                                   |                                           
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
6      input_6 (Input, None)               [b:1,h:4,w:4,c:64]                                                   |                                           
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
7      input_7 (Input, None)               [b:1,c:1024]                                                         |                                           
       dense_15_dense (Dense, Dense)       [b:1,c:48]             49,200/196,800        49,200        input_7   | -196,800(-100.0%)   -49,200(-100.0%)      
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
8      input_8 (Input, None)               [b:1,c:48]                                                           |                                           
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
9      input_9 (Input, None)               [b:1,c:48]                                                           |                                           
       dense_16_dense (Dense, Dense)       [b:1,c:24]             1,176/4,704            1,176        input_9   | -4,704(-100.0%)     -1,176(-100.0%)       
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
10     input_10 (Input, None)              [b:1,c:24]                                                           |                                           
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
11     input_11 (Input, None)              [b:1,c:24]                                                           | +100(+100.0%)       +25(+100.0%)          Dense_[o][0]   
       dense_17 (Dense, Dense)             [b:1,c:1]              25/100                    25       input_11   | -100(-100.0%)       -25(-100.0%)          
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
model/c-model: macc=1,822,273/25 -1,822,248(-100.0%) weights=278,020/100 -277,920(-100.0%) activations=--/4,708 io=--/0



Generated C-graph summary
------------------------------------------------------------------------------------------------------------------------
model name            : line_intensity_model
c-name                : network
c-node #              : 1
c-array #             : 5
activations size      : 4708 (1 segment)
weights size          : 100 (1 segment)
macc                  : 25
inputs                : ['input_0_output']
outputs               : ['dense_17_output']

C-Arrays (5)
------ ------------------ ----------- ------------------------- ------------- --------- 
c_id   name (*_array)     item/size   domain/mem-pool           c-type        comment   
------ ------------------ ----------- ------------------------- ------------- --------- 
0      dense_17_bias      1/4         weights/weights           const float             
1      dense_17_output    1/4         activations/**default**   float         /output   
2      dense_17_weights   24/96       weights/weights           const float             
3      input_0_output     1152/4608   activations/**default**   float         /input    
4      input_11_output    24/96       activations/**default**   float                   
------ ------------------ ----------- ------------------------- ------------- --------- 

C-Layers (1)
------ ---------------- ---- ------------ ------ ----- --------------------- ------------------ 
c_id   name (*_layer)   id   layer_type   macc   rom   tensors               shape (array id)   
------ ---------------- ---- ------------ ------ ----- --------------------- ------------------ 
0      dense_17         11   Dense        25     100   I: input_11_output    f32(1x24) (4)      
                                                       W: dense_17_weights   f32(1x24) (2)      
                                                       W: dense_17_bias      f32(1) (0)         
                                                       O: dense_17_output    f32(1x1) (1)       
------ ---------------- ---- ------------ ------ ----- --------------------- ------------------ 



Number of operations per c-layer
------- ------ ------------------ ----- -------------- 
c_id    m_id   name (type)          #op           type 
------- ------ ------------------ ----- -------------- 
0       11     dense_17 (Dense)      25   smul_f32_f32 
------- ------ ------------------ ----- -------------- 
total                                25 

Number of operation types
---------------- ---- ----------- 
operation type      #           % 
---------------- ---- ----------- 
smul_f32_f32       25      100.0% 

Complexity report (model)
------ ---------- ------------------------- ------------------------- ------ 
m_id   name       c_macc                    c_rom                     c_id   
------ ---------- ------------------------- ------------------------- ------ 
11     input_11   |||||||||||||||| 100.0%   |||||||||||||||| 100.0%   [0]    
------ ---------- ------------------------- ------------------------- ------ 
macc=25 weights=100 act=4,708 ram_io=0
 
 Requested memory size by section - "stm32h5" target
 ------------------------------- ------- -------- ------ ------- 
 module                             text   rodata   data     bss 
 ------------------------------- ------- -------- ------ ------- 
 NetworkRuntime1010_CM33_GCC.a     5,900        0      0       0 
 network.o                           408        8    692     116 
 network_data.o                       48       16     88       0 
 lib (toolchain)*                      0        0      0       0 
 ------------------------------- ------- -------- ------ ------- 
 RT total**                        6,356       24    780     116 
 ------------------------------- ------- -------- ------ ------- 
 weights                               0      104      0       0 
 activations                           0        0      0   4,708 
 io                                    0        0      0       0 
 ------------------------------- ------- -------- ------ ------- 
 TOTAL                             6,356      128    780   4,824 
 ------------------------------- ------- -------- ------ ------- 
 *  toolchain objects (libm/libgcc*)
 ** RT AI runtime objects (kernels+infrastructure)
  
  Summary - "stm32h5" target
  ---------------------------------------------------
               FLASH (ro)      %*   RAM (rw)       % 
  ---------------------------------------------------
  RT total          7,160   98.6%        896   16.0% 
  ---------------------------------------------------
  TOTAL             7,264              5,604         
  ---------------------------------------------------
  *  rt/total


Generated files (7)
--------------------------------------------------------------------- 
C:\Users\me\.stm32cubemx\network_output\network_data_params.h   
C:\Users\me\.stm32cubemx\network_output\network_data_params.c   
C:\Users\me\.stm32cubemx\network_output\network_data.h          
C:\Users\me\.stm32cubemx\network_output\network_data.c          
C:\Users\me\.stm32cubemx\network_output\network_config.h        
C:\Users\me\.stm32cubemx\network_output\network.h               
C:\Users\me\.stm32cubemx\network_output\network.c               

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @pjb,

 

I think there is a bug when using the Sequential API. I escalated the bug to the dev team to investigate.

In your case, please use something like this:

 

import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Conv2D, Dense, BatchNormalization, Flatten,ReLU

input_layer = Input(shape = (24,24,2), batch_size = 1)
x = Conv2D(32, kernel_size=(3, 3))(input_layer)
x = BatchNormalization(momentum=0.8, epsilon=1e-3)(x)
x = ReLU()(x)
x = MaxPooling2D(pool_size=(2, 2))(x)

x =Conv2D(16, kernel_size=(1, 1))(x)
x = BatchNormalization(momentum=0.9)(x)
x = ReLU()(x)

# Second Conv Block
x = Conv2D(32, kernel_size=(3, 3))(x)
x = BatchNormalization(momentum=0.9)(x)
x = ReLU()(x)
x = MaxPooling2D(pool_size=(2, 2))(x)

# Fully Connected Layers
x = Flatten()(x)
x = Dense(48, activation='relu')(x)
x = Dropout(0.1)(x)
x = Dense(24, activation='relu')(x)
x = Dropout(0.1)(x)
output_layer = Dense(1, activation='linear')(x)

# Create the model
model = Model(inputs=input_layer, outputs=output_layer)

model.summary()

model.save('non_seq_model.h5')

 

report:

 stedgeai.exe analyze --model non_seq_model.h5 --target stm32
ST Edge AI Core v2.1.0-20194 329b0e98d

Creating c (debug) info json file C:\Users\ettariaj\Downloads\st_ai_output\network_c_info.json

 Exec/report summary (analyze)
 -----------------------------------------------------------------------------------------
 model file         :   C:\Users\ettariaj\Downloads\non_seq_model.h5
 type               :   keras
 c_name             :   network
 compression        :   lossless
 options            :   allocate-inputs, allocate-outputs
 optimization       :   balanced
 target/series      :   stm32
 workspace dir      :   C:\Users\ettariaj\Downloads\st_ai_ws
 output dir         :   C:\Users\ettariaj\Downloads\st_ai_output
 model_fmt          :   float
 model_name         :   non_seq_model
 model_hash         :   0x4067780f2ddae9bff15bae826f6379a1
 params #           :   31,761 items (124.07 KiB)
 -----------------------------------------------------------------------------------------
 input 1/1          :   'input_layer_12', f32(1x24x24x2), 4.50 KBytes, activations
 output 1/1         :   'dense_36', f32(1x1), 4 Bytes, activations
 macc               :   777,513
 weights (ro)       :   126,276 B (123.32 KiB) (1 segment) / -768(-0.6%) vs float model
 activations (rw)   :   24,200 B (23.63 KiB) (1 segment) *
 ram (total)        :   24,200 B (23.63 KiB) = 24,200 + 0 + 0
 -----------------------------------------------------------------------------------------
 (*) 'input'/'output' buffers can be used from the activations buffer

Computing AI RT data/code size (target=stm32)..
 -> compiler "gcc:arm-none-eabi-gcc" is not in the PATH

 Model name - non_seq_model
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 m_id   layer (original)                              oshape                 param/size           macc             connected to
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 0      input_layer_12 (InputLayer)                   [b:1,h:24,w:24,c:2]
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 1      conv2d_36 (Conv2D)                            [b:1,h:22,w:22,c:32]   608/2,432         278,816           input_layer_12
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 2      batch_normalization_36 (BatchNormalization)   [b:1,h:22,w:22,c:32]   64/256             30,976                conv2d_36
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 3      re_lu_36 (ReLU)                               [b:1,h:22,w:22,c:32]                      15,488   batch_normalization_36
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 4      max_pooling2d_24 (MaxPooling2D)               [b:1,h:11,w:11,c:32]                      15,488                 re_lu_36
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 5      conv2d_37 (Conv2D)                            [b:1,h:11,w:11,c:16]   528/2,112          61,968         max_pooling2d_24
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 6      batch_normalization_37 (BatchNormalization)   [b:1,h:11,w:11,c:16]   32/128              3,872                conv2d_37
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 7      re_lu_37 (ReLU)                               [b:1,h:11,w:11,c:16]                       1,936   batch_normalization_37
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 8      conv2d_38 (Conv2D)                            [b:1,h:9,w:9,c:32]     4,640/18,560      373,280                 re_lu_37
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 9      batch_normalization_38 (BatchNormalization)   [b:1,h:9,w:9,c:32]     64/256              5,184                conv2d_38
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 10     re_lu_38 (ReLU)                               [b:1,h:9,w:9,c:32]                         2,592   batch_normalization_38
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 11     max_pooling2d_25 (MaxPooling2D)               [b:1,h:4,w:4,c:32]                         2,048                 re_lu_38
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 12     flatten_12 (Flatten)                          [b:1,c:512]                                              max_pooling2d_25
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 13     dense_34_dense (Dense)                        [b:1,c:48]             24,624/98,496      24,624               flatten_12
        dense_34 (Dense)                              [b:1,c:48]                                    48           dense_34_dense
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 15     dense_35_dense (Dense)                        [b:1,c:24]             1,176/4,704         1,176                 dense_34
        dense_35 (Dense)                              [b:1,c:24]                                    24           dense_35_dense
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 17     dense_36 (Dense)                              [b:1,c:1]              25/100                 25                 dense_35
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 model: macc=817,545 weights=127,044 activations=-- io=--

 Number of operations per c-layer
 ------- ------ ------------------------- --------- --------------
 c_id    m_id   name (type)                     #op           type
 ------- ------ ------------------------- --------- --------------
 0       4      conv2d_36 (Conv2D)          309,792   smul_f32_f32
 1       6      conv2d_37 (Conv2D)           61,968   smul_f32_f32
 2       7      re_lu_37 (Nonlinearity)       1,936     op_f32_f32
 3       11     conv2d_38 (Conv2D)          377,920   smul_f32_f32
 4       13     dense_34_dense (Dense)       24,624   smul_f32_f32
 5       13     dense_34 (Nonlinearity)          48     op_f32_f32
 6       15     dense_35_dense (Dense)        1,176   smul_f32_f32
 7       15     dense_35 (Nonlinearity)          24     op_f32_f32
 8       17     dense_36 (Dense)                 25   smul_f32_f32
 ------- ------ ------------------------- --------- --------------
 total                                      777,513

 Number of operation types
 ---------------- --------- -----------
 operation type           #           %
 ---------------- --------- -----------
 smul_f32_f32       775,505       99.7%
 op_f32_f32           2,008        0.3%

 Complexity report (model)
 ------ ------------------------ ------------------------- ------------------------- --------
 m_id   name                     c_macc                    c_rom                     c_id
 ------ ------------------------ ------------------------- ------------------------- --------
 4      max_pooling2d_24         |||||||||||||     39.8%   |                  1.9%   [0]
 6      batch_normalization_37   |||                8.0%   |                  1.7%   [1]
 7      re_lu_37                 |                  0.2%   |                  0.0%   [2]
 11     max_pooling2d_25         ||||||||||||||||  48.6%   |||               14.7%   [3]
 13     dense_34_dense           |                  3.2%   ||||||||||||||||  78.0%   [4, 5]
 15     dense_35_dense           |                  0.2%   |                  3.7%   [6, 7]
 17     dense_36                 |                  0.0%   |                  0.1%   [8]
 ------ ------------------------ ------------------------- ------------------------- --------
 macc=777,513 weights=126,276 act=24,200 ram_io=0

Creating txt report file C:\Users\ettariaj\Downloads\st_ai_output\network_analyze_report.txt

Have a good day,

Julian


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

5 REPLIES 5
Julian E.
ST Employee

Hello @pjb,

 

Can you share an example of model that you used and the code to generate it. I think you are doing something wrong.

If you take a look at the table describing your model, all the layers are called input_# and always taking in input "(Input,None)" , like:

10     input_10 (Input, None)              [b:1,c:24]                                                           |                                           
------ ----------------------------------- ---------------------- ---------------- ----------- -------------- --- ------------------- --------------------- -------------- 
11     input_11 (Input, None)              [b:1,c:24]                                                           | +100(+100.0%)       +25(+100.0%)          Dense_[o][0]   
       dense_17 (Dense, Dense)             [b:1,c:1]              25/100                    25 

 As if your model is not connected (the output of one layer is not the input of the following one), which may explain the fact that you only see the last layer appearing in the analyze.

 

Have a good day,

Julian


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi Julian - I see what you mean. The model is nothing special and does train and inference well in a notebook. I don't have the original model in the above code as it has evolved since then. But here is latest, which is similar and same NONE input results. I've not tried using the add layer method of building a model but perhaps I should.  

def create_model():
    model = Sequential([
        Conv2D(32, (3, 3), input_shape=(24,24,2)),
        BatchNormalization(momentum=0.8, epsilon=1e-3),
        ReLU(),
        MaxPooling2D((2, 2)),

        Conv2D(16, (1, 1)),
        BatchNormalization(momentum=0.9),
        ReLU(),

        Conv2D(32, (3, 3)),
        BatchNormalization(momentum=0.9),
        ReLU(),
        MaxPooling2D((2, 2)),

        Flatten(),
        Dense(48, activation='relu'),
        Dropout(0.1),
        Dense(24, activation='relu'),
        Dropout(0.1),
        Dense(1, activation='linear')
    ])

    model.compile(optimizer='adam', loss='mse', metrics=['mae'])
    return model

 

Hello @pjb,

 

I think there is a bug when using the Sequential API. I escalated the bug to the dev team to investigate.

In your case, please use something like this:

 

import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Conv2D, Dense, BatchNormalization, Flatten,ReLU

input_layer = Input(shape = (24,24,2), batch_size = 1)
x = Conv2D(32, kernel_size=(3, 3))(input_layer)
x = BatchNormalization(momentum=0.8, epsilon=1e-3)(x)
x = ReLU()(x)
x = MaxPooling2D(pool_size=(2, 2))(x)

x =Conv2D(16, kernel_size=(1, 1))(x)
x = BatchNormalization(momentum=0.9)(x)
x = ReLU()(x)

# Second Conv Block
x = Conv2D(32, kernel_size=(3, 3))(x)
x = BatchNormalization(momentum=0.9)(x)
x = ReLU()(x)
x = MaxPooling2D(pool_size=(2, 2))(x)

# Fully Connected Layers
x = Flatten()(x)
x = Dense(48, activation='relu')(x)
x = Dropout(0.1)(x)
x = Dense(24, activation='relu')(x)
x = Dropout(0.1)(x)
output_layer = Dense(1, activation='linear')(x)

# Create the model
model = Model(inputs=input_layer, outputs=output_layer)

model.summary()

model.save('non_seq_model.h5')

 

report:

 stedgeai.exe analyze --model non_seq_model.h5 --target stm32
ST Edge AI Core v2.1.0-20194 329b0e98d

Creating c (debug) info json file C:\Users\ettariaj\Downloads\st_ai_output\network_c_info.json

 Exec/report summary (analyze)
 -----------------------------------------------------------------------------------------
 model file         :   C:\Users\ettariaj\Downloads\non_seq_model.h5
 type               :   keras
 c_name             :   network
 compression        :   lossless
 options            :   allocate-inputs, allocate-outputs
 optimization       :   balanced
 target/series      :   stm32
 workspace dir      :   C:\Users\ettariaj\Downloads\st_ai_ws
 output dir         :   C:\Users\ettariaj\Downloads\st_ai_output
 model_fmt          :   float
 model_name         :   non_seq_model
 model_hash         :   0x4067780f2ddae9bff15bae826f6379a1
 params #           :   31,761 items (124.07 KiB)
 -----------------------------------------------------------------------------------------
 input 1/1          :   'input_layer_12', f32(1x24x24x2), 4.50 KBytes, activations
 output 1/1         :   'dense_36', f32(1x1), 4 Bytes, activations
 macc               :   777,513
 weights (ro)       :   126,276 B (123.32 KiB) (1 segment) / -768(-0.6%) vs float model
 activations (rw)   :   24,200 B (23.63 KiB) (1 segment) *
 ram (total)        :   24,200 B (23.63 KiB) = 24,200 + 0 + 0
 -----------------------------------------------------------------------------------------
 (*) 'input'/'output' buffers can be used from the activations buffer

Computing AI RT data/code size (target=stm32)..
 -> compiler "gcc:arm-none-eabi-gcc" is not in the PATH

 Model name - non_seq_model
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 m_id   layer (original)                              oshape                 param/size           macc             connected to
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 0      input_layer_12 (InputLayer)                   [b:1,h:24,w:24,c:2]
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 1      conv2d_36 (Conv2D)                            [b:1,h:22,w:22,c:32]   608/2,432         278,816           input_layer_12
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 2      batch_normalization_36 (BatchNormalization)   [b:1,h:22,w:22,c:32]   64/256             30,976                conv2d_36
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 3      re_lu_36 (ReLU)                               [b:1,h:22,w:22,c:32]                      15,488   batch_normalization_36
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 4      max_pooling2d_24 (MaxPooling2D)               [b:1,h:11,w:11,c:32]                      15,488                 re_lu_36
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 5      conv2d_37 (Conv2D)                            [b:1,h:11,w:11,c:16]   528/2,112          61,968         max_pooling2d_24
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 6      batch_normalization_37 (BatchNormalization)   [b:1,h:11,w:11,c:16]   32/128              3,872                conv2d_37
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 7      re_lu_37 (ReLU)                               [b:1,h:11,w:11,c:16]                       1,936   batch_normalization_37
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 8      conv2d_38 (Conv2D)                            [b:1,h:9,w:9,c:32]     4,640/18,560      373,280                 re_lu_37
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 9      batch_normalization_38 (BatchNormalization)   [b:1,h:9,w:9,c:32]     64/256              5,184                conv2d_38
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 10     re_lu_38 (ReLU)                               [b:1,h:9,w:9,c:32]                         2,592   batch_normalization_38
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 11     max_pooling2d_25 (MaxPooling2D)               [b:1,h:4,w:4,c:32]                         2,048                 re_lu_38
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 12     flatten_12 (Flatten)                          [b:1,c:512]                                              max_pooling2d_25
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 13     dense_34_dense (Dense)                        [b:1,c:48]             24,624/98,496      24,624               flatten_12
        dense_34 (Dense)                              [b:1,c:48]                                    48           dense_34_dense
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 15     dense_35_dense (Dense)                        [b:1,c:24]             1,176/4,704         1,176                 dense_34
        dense_35 (Dense)                              [b:1,c:24]                                    24           dense_35_dense
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 17     dense_36 (Dense)                              [b:1,c:1]              25/100                 25                 dense_35
 ------ --------------------------------------------- ---------------------- --------------- --------- ------------------------
 model: macc=817,545 weights=127,044 activations=-- io=--

 Number of operations per c-layer
 ------- ------ ------------------------- --------- --------------
 c_id    m_id   name (type)                     #op           type
 ------- ------ ------------------------- --------- --------------
 0       4      conv2d_36 (Conv2D)          309,792   smul_f32_f32
 1       6      conv2d_37 (Conv2D)           61,968   smul_f32_f32
 2       7      re_lu_37 (Nonlinearity)       1,936     op_f32_f32
 3       11     conv2d_38 (Conv2D)          377,920   smul_f32_f32
 4       13     dense_34_dense (Dense)       24,624   smul_f32_f32
 5       13     dense_34 (Nonlinearity)          48     op_f32_f32
 6       15     dense_35_dense (Dense)        1,176   smul_f32_f32
 7       15     dense_35 (Nonlinearity)          24     op_f32_f32
 8       17     dense_36 (Dense)                 25   smul_f32_f32
 ------- ------ ------------------------- --------- --------------
 total                                      777,513

 Number of operation types
 ---------------- --------- -----------
 operation type           #           %
 ---------------- --------- -----------
 smul_f32_f32       775,505       99.7%
 op_f32_f32           2,008        0.3%

 Complexity report (model)
 ------ ------------------------ ------------------------- ------------------------- --------
 m_id   name                     c_macc                    c_rom                     c_id
 ------ ------------------------ ------------------------- ------------------------- --------
 4      max_pooling2d_24         |||||||||||||     39.8%   |                  1.9%   [0]
 6      batch_normalization_37   |||                8.0%   |                  1.7%   [1]
 7      re_lu_37                 |                  0.2%   |                  0.0%   [2]
 11     max_pooling2d_25         ||||||||||||||||  48.6%   |||               14.7%   [3]
 13     dense_34_dense           |                  3.2%   ||||||||||||||||  78.0%   [4, 5]
 15     dense_35_dense           |                  0.2%   |                  3.7%   [6, 7]
 17     dense_36                 |                  0.0%   |                  0.1%   [8]
 ------ ------------------------ ------------------------- ------------------------- --------
 macc=777,513 weights=126,276 act=24,200 ram_io=0

Creating txt report file C:\Users\ettariaj\Downloads\st_ai_output\network_analyze_report.txt

Have a good day,

Julian


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thanks Julian; using Tensorflow's Model instead of Sequential seems to have solved my analysis problem. Interestingly, this method of defining a model also made my training loss somewhat smoother and h5 file a tiny bit smaller! I've seen this method used by others before now but have always used Sequential. I never figured the resultant NN would be different.

Hello @pjb,

 

Just letting you know that the issue that you were facing with Sequential was reported and should be solved in the next st edge ai core version (~end of june)

 

Have a good day,

Julian


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.