Skip to main content
Associate III
July 3, 2025
Solved

image classification trained on stm32-h747 - results very biased

  • July 3, 2025
  • 4 replies
  • 1714 views

I used stm32-h747 to train image classification, I used the image classification routine, but the actual effect is very biased, my quantized_model_confusion_matrix_validation_set is as shown below, is there something wrong with my configuration?

Best answer by fanronghua0123456

I have solved the problem, it is that my python version is wrong, and I need to install the environment strictly according to the version requirements given by ST, otherwise there will be an unknown error.

 

4 replies

Julian E.
Technical Moderator
July 3, 2025

Hello @fanronghua0123456,

 

You mean that you trained a model with model zoo and deployed it on the stm32h747 disco?

 

In your case, I think you did provide images of only your label 1.
Your model predicted class 1 for almost all images, giving a good accuracy.

But you don't have any examples for the other labels, so you don't have metrics.

 

Please make sure to have a folder per class in your dataset folder if you are using model zoo.

Like:

datasets/

         MyDataset/

                         label1/

                                    img1.png

                                    img2.png

                                    ....

                         Label2/

                                    img1.png

                                    img2.png

                                    ....

 

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.
Associate III
July 4, 2025

thanks for you replay, my folder like follow screenshot,attach my user_config  file.

Julian E.
Technical Moderator
July 4, 2025

Hello @fanronghua0123456,

 

Thank you, I think your configuration is correct.

In your first message, it seems that it is the quantization matrix that has an issue. 

 

Can you tell me if your training and validation matrixes also have issues or are they correct?

 

Could you try to use your training path for the quantization?

dataset:
 name: handers
 class_names: [hander1, hander2, hander3, hander4, hander5, hander6, hander7] # Or, classes_file_path, one of it is mandatory for deployment and prediction.
 training_path: ./datasets/hander_photos # Mandatory
 validation_path: # Optional
 validation_split: 0.2 # Optional, default value is 0.2
 test_path: # Optional
 quantization_path: ./datasets/hander_photos # Mandatory
 quantization_split: # Optional
 check_image_files: False # Optional, set it to True if you want to check that all the image files can be read successfully
 seed: 127 # Optional, there is a default seed

When you don't provide a path for validation, it uses random data. It is always recommended to use real data to quantize. You can also use quantization_split to use less data if you want.

For test you need to use different data, but for quantization, you can use the training data.

 

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.
Associate III
July 9, 2025

Julinan,

thanks for your reply,  i changed

 quantization_path: ./datasets/hander_photos # Mandatory

But I still don't get such a graph like example.

 

Associate III
July 9, 2025

and this is my picture dataset. 

通过网盘分享的文件:HandWashDataset.zip
链接: https://pan.baidu.com/s/1wvfgoTCo70FJ2ajLzK36aQ 提取码: 5vx2
--来自百度网盘超级会员v6的分享

Associate III
July 18, 2025

can anyone help me ?

Julian E.
Technical Moderator
July 21, 2025

Hello @fanronghua0123456,

 

I can't get the dataset you linked.

Could you please try with this one that I tested and tell me if you have the same issue:

Jellyfish Image Dataset

 

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.
Associate III
July 22, 2025

the dataset is the flower dataset ,follow this link.

 How to build a flower classifier on stm32 mcu with transfer learning (mobilenet v2) - STMicroelectronics

But I don't get the Confusion matrix on the link.