Face Recognition ================ Python Example -------------- .. literalinclude:: /_static/products/aicamera-k230d/_static/python-examples/face_recognition.py :caption: Example: Face recognition :name: Face recognition mPython Graphical Example ------------------------- .. figure:: /_static/products/aicamera-k230d/_static/image/example/face_recognization/face_recognization.png :align: center :width: 1080 Functions and Methods --------------------- .. function:: smart_camera.model_init(cur_state) :noindex: Instantiate the model :param cur_state: model id for initialization :type cur_state: int .. class:: smart_camera.fcr .. method:: recognize() :noindex: Run recognition .. class:: smart_camera.fcr Face recognition instance :var int face_id: face id :var float score: face confidence Face Registration ----------------- Open the camera photo mode and capture a suitable face image ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Each image should contain only one frontal face. The photo resolution supports jpg and png images lower than 1000*1000. .. figure:: /_static/products/aicamera-k230d/_static/image/example/face_recognization/1.jpg :align: center :width: 1080 Open the Album ^^^^^^^^^^^^^^^^^^^^ Image path: /CanMV/data/Camera/Photos .. figure:: /_static/products/aicamera-k230d/_static/image/example/face_recognization/2.png :align: center :width: 1080 Copy Face Images to the Face Data Directory ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Copy face images to the face data directory, named by numbers starting from 0. Face data path: /CanMV/sdcard/data/face_img .. figure:: /_static/products/aicamera-k230d/_static/image/example/face_recognization/5.jpg :align: center :width: 1080 Register the face and wait for the success prompt ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. figure:: /_static/products/aicamera-k230d/_static/image/example/face_recognization/3.jpg :align: center :width: 1080 .. figure:: /_static/products/aicamera-k230d/_static/image/example/face_recognization/4.jpg :align: center :width: 1080 .. Attention:: A successfully registered face remains valid permanently. After adding a new face, face registration must be performed again. .. Attention:: /CanMV/sdcard/data/face_db is the face database path