This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MAKE THIS DOCKERFILE | |
FROM ubuntu:20.04 | |
ENV TZ=US/Central | |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
WORKDIR /home | |
ENV HOME /home | |
VOLUME /data | |
EXPOSE 8888 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tempfile | |
import os | |
import tensorflow as tf | |
from tensorflow import keras | |
# Load MNIST dataset | |
mnist = keras.datasets.mnist | |
(train_images, train_labels), (test_images, test_labels) = mnist.load_data() | |
# Normalize the input image so that each pixel value is between 0 to 1. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import sys | |
from tflite_runtime.interpreter import Interpreter | |
from tflite_runtime.interpreter import load_delegate | |
import time | |
if len(sys.argv) < 2: | |
print('Usage:', sys.argv[0], 'model_path') | |
exit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tempfile | |
import os | |
import tensorflow as tf | |
import numpy as np | |
from tensorflow import keras | |
# Load MNIST dataset | |
mnist = keras.datasets.mnist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# update and install needed packages | |
sudo su | |
apt-get update | |
apt-get -y install unclutter xorg chromium openbox lightdm locales | |
# add kiosk group and user | |
groupadd kiosk | |
useradd -m kiosk -g kiosk -s /bin/bash | |
mkdir -p /home/kiosk/.config/openbox | |
chown -R kiosk:kiosk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I got librosa working on the Dev Board running Mendel Day (4.0). | |
Some steps may not be necessary at later OS release. | |
1) Preparations: | |
The Dev Board may not have enough storage, so I suggest first to add an sdcard (I have a 16GB card), than mount it: | |
mkdir /home/mendel/sdcard | |
sudo mount /dev/mmcblk1p1 /home/mendel/sdcard | |
With extra storage now, we can add some swap which may be necessary for the build: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, argparse, cv2, sys, time, numpy | |
from tflite_runtime.interpreter import Interpreter | |
from tflite_runtime.interpreter import load_delegate | |
''' | |
Requirements: | |
1) Install the tflite_runtime package from here: | |
https://www.tensorflow.org/lite/guide/python | |
2) Camera to take inputs | |
3) Install libedgetpu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import argparse | |
import cv2 | |
import numpy as np | |
import sys | |
import time | |
import importlib.util | |
from tflite_runtime.interpreter import Interpreter | |
from tflite_runtime.interpreter import load_delegate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2019 Google LLC | |
# | |
# Changes made by Nam Vu 02/25/2020 | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# https://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2019 Google LLC | |
# | |
# Changes made by Nam Vu 01/20/2020 | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# https://www.apache.org/licenses/LICENSE-2.0 | |
# |