tf_image_classification.py

# هذا العمل مرخص بموجب ترخيص MIT.
# حقوق النشر (c) 2013-2024 OpenMV LLC. جميع الحقوق محفوظة.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# مثال اكتشاف الأشخاص باستخدام TensorFlow Lite
#
# يعمل هذا المثال على OpenMV RT1062 لاكتشاف الأشخاص
# باستخدام نموذج MobileNet المدمج.

import csi
import time
import ml
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.RGB565)
csi0.framesize(csi.QVGA)
csi0.snapshot(time=2000)

model = ml.Model("/rom/person_detect.tflite")
print(model)

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

    # يجمع هذا التسميات وقيم الثقة في قائمة من المجموعات
    # ثم يرتّب تلك القائمة حسب قيم الثقة.
    scores = sorted(
        zip(model.labels, model.predict([img])[0].flatten().tolist()),
        key=lambda x: x[1],
        reverse=True
    )

    print(clock.fps(), "fps\t", "%s = %f\t" % (scores[0][0], scores[0][1]))

results matching ""

    No results matching ""