Skip to content

Commit

Permalink
libcamera-apps: install object_detect_tf stage
Browse files Browse the repository at this point in the history
Install the object_detect_tf stage described in the official
documentation:

    https://www.raspberrypi.com/documentation/computers/camera_software.html#object_detect_tf-stage

With libcamera-apps compiled with tflite support, one is able to run
the object detection model with e.g.:

    libcamera-still --post-process-file /usr/share/libcamera-apps/assets/object_detect_tf.json --lores-width 400 --lores-height 300

Signed-off-by: Vivien Didelot <[email protected]>
  • Loading branch information
vivien committed Aug 15, 2023
1 parent 9e86e72 commit bf9147c
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ SECTION = "console/utils"
LICENSE = "BSD-2-Clause"
LIC_FILES_CHKSUM = "file://license.txt;md5=a0013d1b383d72ba4bdc5b750e7d1d77"

OBJECT_DETECT_TF ?= "coco_ssd_mobilenet_v1_1.0_quant_2018_06_29"

SRC_URI = "\
git://github.com/raspberrypi/libcamera-apps.git;protocol=https;branch=main \
file://0001-utils-version.py-use-usr-bin-env-in-shebang.patch \
https://storage.googleapis.com/download.tensorflow.org/models/tflite/${OBJECT_DETECT_TF}.zip;name=object_detect_tf \
"

SRC_URI[object_detect_tf.sha256sum] = "a809cd290b4d6a2e8a9d5dad076e0bd695b8091974e0eed1052b480b2f21b6dc"

PV = "1.2.1+git${SRCPV}"
SRCREV = "1c1d1c1a2a86d70cf873edc8bb72d174f037973a"

Expand Down Expand Up @@ -40,4 +46,9 @@ do_install:append() {

install -d ${D}/usr/share/${BPN}/assets
install -m 644 ${S}/assets/* ${D}/usr/share/${BPN}/assets

install -d ${D}/usr/share/${BPN}/assets/${OBJECT_DETECT_TF}
install -m 644 ${WORKDIR}/detect.tflite ${D}/usr/share/${BPN}/assets/${OBJECT_DETECT_TF}
install -m 644 ${WORKDIR}/labelmap.txt ${D}/usr/share/${BPN}/assets/${OBJECT_DETECT_TF}
sed -i -e "s,/home/pi/models,/usr/share/${BPN}/assets,g" ${D}/usr/share/${BPN}/assets/object_detect_tf.json
}

0 comments on commit bf9147c

Please sign in to comment.