Skip to content

Instantly share code, notes, and snippets.

View Namburger's full-sized avatar
😃
segfault

Nam Vu Namburger

😃
segfault
View GitHub Profile
@Namburger
Namburger / converting_keras_model.py
Last active April 5, 2024 13:22
Example of creating a dummy keras model and convert it to tflite with tensorflow1.15
import tensorflow as tf
if not str(tf.__version__).startswith('1.15'):
print('please use tensorflow 1.15')
exit()
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Conv2D
tf.enable_eager_execution()
image_shape = (64,64,3)
@Namburger
Namburger / tflite_cv_objdetect.py
Last active March 29, 2024 11:31
An example with opencv/tflite object detection combo
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
@Namburger
Namburger / python38-ubuntu-Dockefile
Last active January 8, 2024 22:38
An example to get Ubuntu/python3.8 working with unofficial edgetpu wheel
# 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
@Namburger
Namburger / coral_brosa.txt
Last active November 19, 2023 09:23
installing libbrosa on the Coral Dev Board
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:
@Namburger
Namburger / disable-hdmi-mendel.dts
Created August 28, 2020 22:51
disable-hdmi-mendel.dts
/dts-v1/;
/plugin/;
/ {
compatible = "fsl,imx8mq-hdmi";
fragment@0 {
target-path = "/hdmi@32c00000";
__overlay__ {
status = "disabled";
@Namburger
Namburger / Dockerfile
Last active October 21, 2022 12:48
ubuntu18.04 coral minimal example
FROM ubuntu:18.04
WORKDIR /home
ENV HOME /home
RUN cd ~
RUN apt-get update
RUN apt-get install -y git nano python3-pip python-dev pkg-config wget usbutils curl
RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" \
| tee /etc/apt/sources.list.d/coral-edgetpu.list
@Namburger
Namburger / detects.service
Last active May 31, 2022 23:23
An example systemd service for object detection in the coral dev board.
# This is an example of starting a systemd object detection service on boot on the Coral Dev Board.
# 1) create a file call detects.service with the following contents:
[Unit]
Description=systemd object detection service
After=weston.target
[Service]
PAMName=login
@Namburger
Namburger / minimal-devboard-tflite-dockerfile
Created November 19, 2020 15:26
Minimal Dockerfile for Coral Dev Board with tflite API
FROM arm64v8/debian:latest
WORKDIR /home
ENV HOME /home
RUN cd ~
RUN apt-get update
RUN apt-get install -y git nano python3-pip python-dev pkg-config wget usbutils curl
RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" \
| tee /etc/apt/sources.list.d/coral-edgetpu.list
@Namburger
Namburger / evaluate_tflite.py
Created August 15, 2020 02:11
evaluate_tflite.py
# Install tflite_runtime package to evaluate the model.
!pip3 install https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp36-cp36m-linux_x86_64.whl
# Now we do evaluation on the tflite model.
import os
import numpy as np
from tflite_runtime.interpreter import Interpreter
from tflite_runtime.interpreter import load_delegate
from PIL import Image
from PIL import ImageDraw
@Namburger
Namburger / Dockerfile.edgetpu-example.devboard
Last active November 19, 2020 15:19
minimal Dockerfile for running some edgetpu demos on the dev board using the arm64 debian image
THIS IS DEPRECATED
# docker can be installed on the dev board following these instructions:
# https://github.com/f0cal/google-coral/issues/32#issuecomment-571629174
# 1) create this dockerfile
# 2) build: docker build -t "coral" .
# 3) run: docker run -it --device /dev/apex_0:/dev/apex_0 coral /bin/bash
# 4) Try the classify_image demo:
# apt-get install edgetpu-examples