mirror of
https://github.com/nxp-imx/meta-imx.git
synced 2026-01-27 11:32:16 +01:00
tensorflow-lite: Upgrade to 2.3.1 version [YOCIMX-4987]
Signed-off-by: Neena Busireddy <neenareddy.busireddy@nxp.com>
This commit is contained in:
parent
d1869186fb
commit
3d6395fa42
65
meta-ml/classes/distutils3backport.bbclass
Normal file
65
meta-ml/classes/distutils3backport.bbclass
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
inherit distutils3-base
|
||||
|
||||
B = "${WORKDIR}/build"
|
||||
distutils_do_configure[cleandirs] = "${B}"
|
||||
|
||||
DISTUTILS_BUILD_ARGS ?= ""
|
||||
DISTUTILS_INSTALL_ARGS ?= "--root=${D} \
|
||||
--prefix=${prefix} \
|
||||
--install-lib=${PYTHON_SITEPACKAGES_DIR} \
|
||||
--install-data=${datadir}"
|
||||
|
||||
DISTUTILS_PYTHON = "python3"
|
||||
DISTUTILS_PYTHON_class-native = "nativepython3"
|
||||
|
||||
distutils3_do_configure() {
|
||||
:
|
||||
}
|
||||
|
||||
distutils3_do_compile() {
|
||||
cd ${S}
|
||||
NO_FETCH_BUILD=1 \
|
||||
STAGING_INCDIR=${STAGING_INCDIR} \
|
||||
STAGING_LIBDIR=${STAGING_LIBDIR} \
|
||||
${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py \
|
||||
build --build-base=${B} ${DISTUTILS_BUILD_ARGS} || \
|
||||
bbfatal_log "'${PYTHON_PN} setup.py build ${DISTUTILS_BUILD_ARGS}' execution failed."
|
||||
}
|
||||
distutils3_do_compile[vardepsexclude] = "MACHINE"
|
||||
|
||||
distutils3_do_install() {
|
||||
cd ${S}
|
||||
install -d ${D}${PYTHON_SITEPACKAGES_DIR}
|
||||
STAGING_INCDIR=${STAGING_INCDIR} \
|
||||
STAGING_LIBDIR=${STAGING_LIBDIR} \
|
||||
PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
|
||||
${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py \
|
||||
build --build-base=${B} install --skip-build ${DISTUTILS_INSTALL_ARGS} || \
|
||||
bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS}' execution failed."
|
||||
|
||||
# support filenames with *spaces*
|
||||
find ${D} -name "*.py" -exec grep -q ${D} {} \; \
|
||||
-exec sed -i -e s:${D}::g {} \;
|
||||
|
||||
for i in ${D}${bindir}/* ${D}${sbindir}/*; do
|
||||
if [ -f "$i" ]; then
|
||||
sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i
|
||||
sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
|
||||
|
||||
#
|
||||
# FIXME: Bandaid against wrong datadir computation
|
||||
#
|
||||
if [ -e ${D}${datadir}/share ]; then
|
||||
mv -f ${D}${datadir}/share/* ${D}${datadir}/
|
||||
rmdir ${D}${datadir}/share
|
||||
fi
|
||||
}
|
||||
distutils3_do_install[vardepsexclude] = "MACHINE"
|
||||
|
||||
EXPORT_FUNCTIONS do_configure do_compile do_install
|
||||
|
||||
export LDSHARED="${CCLD} -shared"
|
||||
4
meta-ml/classes/setuptools3backport.bbclass
Normal file
4
meta-ml/classes/setuptools3backport.bbclass
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
inherit distutils3backport
|
||||
|
||||
DEPENDS += "python3-setuptools-native"
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
From 3abfa65517959ad279481021fafefba28f955e76 Mon Sep 17 00:00:00 2001
|
||||
From: Philip Balister <philip@balister.org>
|
||||
Date: Fri, 10 Jul 2020 10:14:59 -0400
|
||||
Subject: [PATCH] Do not check pointer size when cross compiling.
|
||||
|
||||
It is reasonable to build for 32 machine on a 64 bit build machine. Prevents:
|
||||
| CMake Error at tools/FindPythonLibsNew.cmake:127 (message):
|
||||
| Python config failure: Python is 64-bit, chosen compiler is 32-bit
|
||||
|
||||
Signed-off-by: Philip Balister <philip@balister.org>
|
||||
---
|
||||
tools/FindPythonLibsNew.cmake | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/FindPythonLibsNew.cmake b/tools/FindPythonLibsNew.cmake
|
||||
index d0c8fa2..8479e70 100644
|
||||
--- a/tools/FindPythonLibsNew.cmake
|
||||
+++ b/tools/FindPythonLibsNew.cmake
|
||||
@@ -123,7 +123,7 @@ list(GET _PYTHON_VALUES 9 PYTHON_MULTIARCH)
|
||||
|
||||
# Make sure the Python has the same pointer-size as the chosen compiler
|
||||
# Skip if CMAKE_SIZEOF_VOID_P is not defined
|
||||
-if(CMAKE_SIZEOF_VOID_P AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL "${CMAKE_SIZEOF_VOID_P}"))
|
||||
+if((NOT CMAKE_CROSSCOMPILING) AND CMAKE_SIZEOF_VOID_P AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL "${CMAKE_SIZEOF_VOID_P}"))
|
||||
if(PythonLibsNew_FIND_REQUIRED)
|
||||
math(EXPR _PYTHON_BITS "${PYTHON_SIZEOF_VOID_P} * 8")
|
||||
math(EXPR _CMAKE_BITS "${CMAKE_SIZEOF_VOID_P} * 8")
|
||||
--
|
||||
2.25.4
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
From 918f3ef01c7a67f3beb67307966698474f144581 Mon Sep 17 00:00:00 2001
|
||||
From: Philip Balister <philip@balister.org>
|
||||
Date: Wed, 8 Jul 2020 09:41:43 -0400
|
||||
Subject: [PATCH] Do not strip binaries.
|
||||
|
||||
* OpenEmbedded strips them after creating debug packages.
|
||||
|
||||
Signed-off-by: Philip Balister <philip@balister.org>
|
||||
---
|
||||
tools/pybind11Tools.cmake | 13 -------------
|
||||
1 file changed, 13 deletions(-)
|
||||
|
||||
diff --git a/tools/pybind11Tools.cmake b/tools/pybind11Tools.cmake
|
||||
index a3603ab..b4c8f63 100644
|
||||
--- a/tools/pybind11Tools.cmake
|
||||
+++ b/tools/pybind11Tools.cmake
|
||||
@@ -230,19 +230,6 @@ function(pybind11_add_module target_name)
|
||||
|
||||
_pybind11_add_lto_flags(${target_name} ${ARG_THIN_LTO})
|
||||
|
||||
- if (NOT MSVC AND NOT ${CMAKE_BUILD_TYPE} MATCHES Debug|RelWithDebInfo)
|
||||
- # Strip unnecessary sections of the binary on Linux/Mac OS
|
||||
- if(CMAKE_STRIP)
|
||||
- if(APPLE)
|
||||
- add_custom_command(TARGET ${target_name} POST_BUILD
|
||||
- COMMAND ${CMAKE_STRIP} -x $<TARGET_FILE:${target_name}>)
|
||||
- else()
|
||||
- add_custom_command(TARGET ${target_name} POST_BUILD
|
||||
- COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${target_name}>)
|
||||
- endif()
|
||||
- endif()
|
||||
- endif()
|
||||
-
|
||||
if(MSVC)
|
||||
# /MP enables multithreaded builds (relevant when there are many files), /bigobj is
|
||||
# needed for bigger binding projects due to the limit to 64k addressable sections
|
||||
--
|
||||
2.25.4
|
||||
|
||||
36
meta-ml/recipes-devtools/python/python3-pybind11_2.5.0.bb
Normal file
36
meta-ml/recipes-devtools/python/python3-pybind11_2.5.0.bb
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
SUMMARY = "Seamless operability between C++11 and Python"
|
||||
HOMEPAGE = "https://github.com/wjakob/pybind11"
|
||||
LICENSE = "BSD-2-Clause"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=beb87117af69fd10fbf9fb14c22a2e62"
|
||||
|
||||
DEPENDS = "boost"
|
||||
|
||||
SRC_URI = "git://github.com/pybind/pybind11.git \
|
||||
file://0001-Do-not-strip-binaries.patch \
|
||||
file://0001-Do-not-check-pointer-size-when-cross-compiling.patch \
|
||||
"
|
||||
SRCREV = "3b1dbebabc801c9cf6f0953a4c20b904d444f879"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
BBCLASSEXTEND = "native"
|
||||
|
||||
EXTRA_OECMAKE = "-DPYBIND11_TEST=OFF"
|
||||
|
||||
inherit cmake setuptools3backport python3native
|
||||
|
||||
do_configure() {
|
||||
cmake_do_configure
|
||||
}
|
||||
|
||||
do_compile() {
|
||||
distutils3_do_compile
|
||||
cmake_do_compile
|
||||
}
|
||||
|
||||
do_install() {
|
||||
distutils3_do_install
|
||||
cmake_do_install
|
||||
}
|
||||
|
||||
BBCLASSEXTEND = "native nativesdk"
|
||||
|
|
@ -2,13 +2,13 @@ DESCRIPTION = "TensorFlow Lite C++ Library"
|
|||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=64a34301f8e355f57ec992c2af3e5157"
|
||||
|
||||
DEPENDS = "zlib unzip-native swig-native python3 python3-numpy-native python3-pip-native python3-wheel-native"
|
||||
DEPENDS = "zlib unzip-native python3 python3-numpy-native python3-pip-native python3-wheel-native python3-pybind11-native"
|
||||
|
||||
TENSORFLOW_LITE_SRC ?= "git://source.codeaurora.org/external/imx/tensorflow-imx.git;protocol=https"
|
||||
SRCBRANCH = "imx-v2.2.0"
|
||||
SRCBRANCH = "imx-v2.3.1"
|
||||
|
||||
SRC_URI = "${TENSORFLOW_LITE_SRC};branch=${SRCBRANCH}"
|
||||
SRCREV = "2f23726d35d4a25b91d932a522bae0dd98eaafe9"
|
||||
SRCREV = "43774992924fa060a4f60122a2548acb75dc0fbf"
|
||||
|
||||
SRC_URI += "https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz;name=model-mobv1"
|
||||
SRC_URI[model-mobv1.md5sum] = "36af340c00e60291931cb30ce32d4e86"
|
||||
Loading…
Reference in New Issue
Block a user