Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install object_detect_tf post processing stage #1214

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 All @@ -37,4 +43,12 @@ EXTRA_OEMESON += "${NEON_FLAGS}"
# QA Issue: /usr/bin/camera-bug-report contained in package libcamera-apps requires /usr/bin/python3
do_install:append() {
rm -v ${D}/${bindir}/camera-bug-report

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
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This provider of tensorflow-lite only builds on 64-bit systems
COMPATIBLE_MACHINE:rpi = "^(aarch64)$"

# https://github.com/nnstreamer/meta-neural-network/pull/85
do_install:append () {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still find this an issue that needs to be fixed in the actual layer. I'm not sure I understand the reasoning not to do that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right this is a generic change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously that is a generic change that is being discussed upstream. The reasoning behind having a bbappend with the fix in our layer is to document the issue in the meantime, while still providing a functional example to the users. I'm not sure if you noticed, but processing with tensorflow did not work until now.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that the review is in progress, and it introduces some compile issues. Let's see how that settles upstream (see the symlink discussion). I want to avoid:

  1. introducing new issues while fixing this
  2. making sure that this gets cleaned up after upstream deals with it

ln -sf libtensorflow2-lite.a ${D}${libdir}/libtensorflow-lite.a
ln -sf tensorflow2-lite.pc ${D}${libdir}/pkgconfig/tensorflow-lite.pc
}