cancel
Showing results for 
Search instead for 
Did you mean: 

porting yolov11(best_saved_model/best_integer_quant.tflite) model to stm32mp257,

fanronghua0123456
Associate III

hi,all.

 I used “best_saved_model/best_integer_quant.tflite” to perform inference on the PC,it's looks success!

tflite_model = YOLO("/home/alientek/best_saved_model/best_integer_quant.tflite")

# Run inference
results = tflite_model("/home/alientek/hander1_1.jpg")

 

and output like this.

(yolov11) alientek@ubuntu:~/yolov11$ python test1.py 
/home/alientek/.conda/envs/yolov11/lib/python3.10/site-packages/requests/__init__.py:86: RequestsDependencyWarning: Unable to find acceptable character detection dependency (chardet or charset_normalizer).
  warnings.warn(
WARNING ⚠️ Unable to automatically guess model task, assuming 'task=detect'. Explicitly define task for your model, i.e. 'task=detect', 'segment', 'classify','pose' or 'obb'.
Loading /home/alientek/best_saved_model/best_integer_quant.tflite for TensorFlow Lite inference...
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.

image 1/1 /home/alientek/hander1_1.jpg: 640x640 1 handler1, 1760.9ms
Speed: 38.9ms preprocess, 1760.9ms inference, 26.5ms postprocess per image at shape (1, 3, 640, 640)

 

But when I deploy to the stm32mp257 using the following code, the target is not detected.

for (int w = 0; w < 8400; w++)
{
    float cx = data[0 * 8400 + w];
    float cy = data[1 * 8400 + w];
    float w_box = data[2 * 8400 + w];
    float h_box = data[3 * 8400 + w];

    // Find class with max probability
    float max_score = 0;
    int max_class = -1;
    for (int c = 0; c < num_classes; c++)
    {
        float score = data[(4 + c) * 8400 + w];
        if (score > max_score)
        {
            max_score = score;
            max_class = c;
        }
    }

    if (max_score > confidence_threshold)
    {
        ObjDetect_Results det;
        det.x = cx;
        det.y = cy;
        det.w = w_box;
        det.h = h_box;
        det.class_id = max_class;
        det.confidence = max_score;
        detections.push_back(det);
    }
}

 

0 REPLIES 0