From a5f319e95cfff15955813bd1bdac7cfd6d247c61 Mon Sep 17 00:00:00 2001 From: Albert Date: Thu, 29 Apr 2021 21:00:22 +0200 Subject: [PATCH] Moved TFLite build module into its own file. Worked on README. --- README => README.md | 15 +++++--- ...ensorflow.lite.examples.mnist.metainfo.xml | 8 ++++ org.tensorflow.lite.examples.mnist.yml | 36 +++++++----------- screenshot.png | Bin 0 -> 15963 bytes tflite.yml | 23 +++++++++++ 5 files changed, 55 insertions(+), 27 deletions(-) rename README => README.md (64%) create mode 100644 org.tensorflow.lite.examples.mnist.metainfo.xml create mode 100644 screenshot.png create mode 100644 tflite.yml diff --git a/README b/README.md similarity index 64% rename from README rename to README.md index a43a6e8..61410bd 100644 --- a/README +++ b/README.md @@ -1,6 +1,8 @@ -# +![](screenshot.png) -# Using a neural network in your app +This small app aims to demonstrate how machine learning can be integrated into desktop Linux applications. + +### Using a neural network in your app Neural networks are numerical models which take an array of numbers as an input, and produce an array of numbers as an output. In machine learning, the technical term for such an array is a 'tensor'. Tensors usually have more than 1 dimensions. @@ -10,11 +12,14 @@ A tensor is a technical term for a multi-dimentional array. Any network you find will have one or more input tensors and one or more output tensors. Before .., the input tensor of a network needs to be filled with data. When invoked, the data is processed by the neural network and the output tensor is filled with the result. This can then be copied out and used. -# Converting h5 files for use with TFLite +### Using pre-trained models +Models for doing common tasks already exist online and you can download and use them directly in your program. In cases where models work on something else than numerical data, you may have to do some preprocessing yourself. + +### Converting h5 files for use with TFLite -Many pre-trained models are available on sites like http://www.modelzoo.co/. +Many pre-trained models are available on sites like [ModelZoo](http://www.modelzoo.co/) or the [TensorFlow Hub](https://tfhub.dev/). -To convert a model saved as a .h5 file to TfLite's format, enter the following commands into Python: +To convert a model saved as a .h5 file to TFLite's format, enter the following commands into Python: import tensorflow as tf m = tf.keras.models.load_model('mnist.h5') diff --git a/org.tensorflow.lite.examples.mnist.metainfo.xml b/org.tensorflow.lite.examples.mnist.metainfo.xml new file mode 100644 index 0000000..86c7f46 --- /dev/null +++ b/org.tensorflow.lite.examples.mnist.metainfo.xml @@ -0,0 +1,8 @@ + + + org.tensorflow.lite.examples.mnist + TensorFlow Lite demo + Example application using the TensorFlow Lite machine learning library. + https://github.com/albert-tomanek/tflite-demo + CC0-1.0 + diff --git a/org.tensorflow.lite.examples.mnist.yml b/org.tensorflow.lite.examples.mnist.yml index ac5f00f..6e7d917 100644 --- a/org.tensorflow.lite.examples.mnist.yml +++ b/org.tensorflow.lite.examples.mnist.yml @@ -12,35 +12,27 @@ add-build-extensions: build-options: append-path: /usr/lib/sdk/bazel/bin modules: - - name: tflite - build-options: - build-args: - - --share=network # Bazel downloads some things when building tflite. Also, build.sh uses `git clone` to download the latest tensorflow. - buildsystem: simple - build-commands: - - pip3 install pip numpy wheel --prefix=/app # Dunno why these are required by bazel to build a C binary 🤷 https://www.tensorflow.org/install/source - - pip3 install keras_preprocessing --no-deps --prefix=/app - - ./build.sh - - rm -r package/DEBIAN # The build script is intended to create a debian package. We don't need package metadata so we remove it. - - mv package/usr/lib package/ # Flatpak apps seem to have libraries in /app/lib rather than /app/user/lib - - cp -RT package/ ${FLATPAK_DEST}/ # Merge directory structure from the debian package into the runtime (and build..? :-/) environment (`package/` contains directories like usr/, lib/, etc.) - sources: - - type: git - url: https://github.com/albert-tomanek/tflite-package + - tflite.yml - name: demo buildsystem: simple build-commands: - - valac main.vala --pkg gtk+-3.0 --pkg tflite --vapidir ${FLATPAK_DEST}/usr/share/vala/vapi -X -I/app/usr/include -X -L/app/lib + - valac main.vala --pkg gtk+-3.0 --pkg tflite --vapidir /app/usr/share/vala/vapi -X -I/app/usr/include -X -L/app/lib + - install -D main /app/bin/main - install -D mnist.tflite /app/bin/mnist.tflite - - echo "#!/bin/sh " >> /app/bin/run_main.sh - - echo "main /app/bin/mnist.tflite" >> /app/bin/run_main.sh - - chmod +x /app/bin/run_main.sh - - ls -l /app/bin + sources: - type: file path: main.vala - type: file path: mnist.tflite - # - type: file - # path: meson.build + # We need to create a shell script to start our app because we need to pass it a commandline argument and flatpak-builder doesn't support this. + - name: run_script + sources: + - type: script + commands: + - main /app/bin/mnist.tflite + dest-filename: run_main.sh + buildsystem: simple + build-commands: + - cp run_main.sh /app/bin/ diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..068a3141fdcb1f0304336bc4b4b673cfa0464bbc GIT binary patch literal 15963 zcmcJ01yodTxAzbNB4r>50xBX(BPAfE0@B?nN=T|Obc&)Pp`?O@ z+Q~5cSLVJ6)q=>q+0WRWSf^=~rLAs`N2*hcJ z&Q*t}KPVi%!#~sZlOm**;}0cVsYiX^5?a~R4^T2wa3c^aLA_(opHy7bb+Zl)vN{@^ zXj&#jbZJj~I?*>4vg)9rP04*!!8s{dc0o6V9Pz~M+R(3A^vS$74Tl!4!Yp+LW3rrp zWI}}DWt1x&EK`EW@47Nv@JURLrM4TQ87zcX7}2lRW$hq@rY zUvWnJ?%4+p^H)d%*iZ=n84`@fEfa%JFZ-rZai4zlYW#^KPw%du&HsVXP(I0ppiwWs z#p+;RD706Vb?9;)BgZ;CVp4;CgGvq0Z`XZu9g&`{^4$cemn694#aly8cMSU~v>P(Hrg|CIb z37+rIa6LYwjktsgd%j?AWhfQ%jU=H^=$V%=-RgMyh3uli#}A(h37_frCpk^|?%b8E z%rr8Egaw~)hLND6!)qvnv^rD5kfz^2o=Sv{W_ns=M3@ps0apAjE4mP~_yH|*j|r{G zNNKC3r)+B*WGIz^WKoImw95=(?-bv+y|450QeexazyM(oMPZ$5<hVLSTJzU0q!P)d^-X!7jcvq=G!dJ}@*v*<4{yq4b#-9hkZx+uFW?kpBoV`-bcu-Q8s)hd(YEQhGyMAnSr z_xraE3M1XcPG!}%C<|4T`K@!#*gEsYpFvDeX6NMS2&T+YXN%tdmamt84>L{lNX7P` z=Xu2DfEJ^i(3P^Q?kJ(U*7L*&_t1&pi6n&ujvGosmA0W`o7X2Rqz0T!u~OpIf)AYY zrx$It#Rm!PsWQfdnM9xIdw7)Jj7Qs#$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L&B=M5R& zx{LHY2x)1gb-JZgBDC(r&{SMFT9tosR7sxz5%GJpM)NmamD_n8dB1PveB#KTf6UV< zRjsm+0_djiLtmEU%D=@Abhk$VB)vLNFgDw2j~Nt2eY<9rxidqI!F;qe(T@+#&U=#_ z3{Q-ZWyg_an}pU{4gIo1p%Xt=Flc)Pe!)&UT8e4Nd<+We6kl$@Zmlh_3TR+SX5zu8#^*--%(1vfj{& z2=2|zd4+`D>s^`3jT*dxsM9La*86Vj#>a}>$rn)R(2NI#t8bwkGJeg@e*#e~uWj-s zw{Od+Omw={QP+ClAo|p#y~6!BobYMx>k39)q4n~d-T7zg39=Z>PhmG*yzKHxFwv-r zGirJd7c|x588I1zi>$tzx(f9TITUJb6zQEc`YR3-+qq(Q6uQQeP7vxGG2WAch)c|BDt|p z>y+!H@TQk>n1OT307EGpH2LqDGYMu38@o6^B~-51@8e A;{X5v literal 0 HcmV?d00001 diff --git a/tflite.yml b/tflite.yml new file mode 100644 index 0000000..2c52ece --- /dev/null +++ b/tflite.yml @@ -0,0 +1,23 @@ +# When using this module, the following needs to be added to the manifest: +# +# add-build-extensions: +# - org.freedesktop.Sdk.Extension.bazel +# build-options: +# append-path: /usr/lib/sdk/bazel/bin +# + +name: tflite +build-options: + build-args: + - --share=network # Bazel downloads some things when building tflite. Also, build.sh uses `git clone` to download the latest tensorflow. +buildsystem: simple +build-commands: + - pip3 install pip numpy wheel --prefix=/app # Dunno why these are required by bazel to build a C binary 🤷 https://www.tensorflow.org/install/source + - pip3 install keras_preprocessing --no-deps --prefix=/app + - ./build.sh + - rm -r package/DEBIAN # The build script is intended to create a debian package. We don't need package metadata so we remove it. + - mv package/usr/lib package/ # Flatpak apps seem to have libraries in /app/lib rather than /app/user/lib + - cp -RT package/ ${FLATPAK_DEST}/ # Merge directory structure from the debian package into the runtime (and build..? :-/) environment (`package/` contains directories like usr/, lib/, etc.) +sources: + - type: git + url: https://github.com/albert-tomanek/tflite-package