logo

钢球识别帧率太低

2026-07-29 11:53
H
h9a2402ohvhd

钢球识别帧率太低

问题概述

用户反馈在使用星瞳AI视觉模组进行钢球识别时,识别帧率过低,影响实时性或系统响应。

  • 问题类型:其他(性能相关)
  • 具体现象:钢球识别帧率偏低
  • 涉及场景:未提供详细背景,需后续补充(如硬件型号、环境、代码逻辑等)
H
h9a2402ohvhd

用的星瞳ai云服务生成的模型,帧率只有6fps

H
h9a2402ohvhd

用的

openmv n6

H
h9a2402ohvhd
# This work is licensed under the MIT license.
# Copyright (c) 2013-2025 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# TensorFlow Lite YOLO V8 Example
#
# This example runs a YOLO V8 person detection model.
#
# NOTE: This exaxmple requires an OpenMV Cam with an NPU like the AE3 or N6 to run real-time.

import csi
import time
import ml
from ml.postprocessing.ultralytics import YoloV8

# Initialize the sensor.
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.RGB565)
csi0.framesize(csi.VGA)
csi0.window((416, 416))

# Load YOLO V8 model from ROM FS.
model = ml.Model("/rom/trained.tflite", postprocess=YoloV8(threshold=0.4))
print(model)

# Visualization parameters.
n = len(model.labels)
model_class_colors = [(int(255 * i // n), int(255 * (n - i - 1) // n), 255) for i in range(n)]

clock = time.clock()
while True:
    clock.tick()
    img = csi0.snapshot()

    # boxes is a list of list per class of ((x, y, w, h), score) tuples
    boxes = model.predict([img])

    # Draw bounding boxes around the detected objects
    for i, class_detections in enumerate(boxes):
        rects = [r for r, score in class_detections]
        for rect in rects:
            img.draw_rectangle(rect)
        labels = [model.labels[i] for j in range(len(rects))]
        colors = [model_class_colors[i] for j in range(len(rects))]
        ml.utils.draw_predictions(img, rects, labels, colors, format=None)

    print(clock.fps(), "fps")
Z
星小瞳xs

1、导入romfs时选择最大优化; 2、训练时选择yolov8n最小的那一版;

H
h9a2402ohvhd
屏幕截图 2026-07-29 120031.png
H
h9a2402ohvhd
2026-07-29 12:19
H
h9a2402ohvhd

现在fps到30了,还有什么提高的方法吗

2026-07-29 14:57
Z
星小瞳xs

没有了,30帧已经足够了