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 / cv_obj_coral.py
Last active January 20, 2020 17:06
An example of doing object detection with open cv on the dev board
# 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
#
@Namburger
Namburger / object_detection_2cameras.py
Created January 31, 2020 15:04
Doing object detection with 2 cameras with the Coral Dev Board
# 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
#
@Namburger
Namburger / object_csv.py
Created February 25, 2020 16:45
This program write does live object detection and write output to a csv file.
# 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
#
@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 / edgetpu_face_detector.py
Last active May 13, 2020 01:43
An example to run the edgetpu's face detection model
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
@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 / mendel-kiosk-chrome.guide
Last active September 28, 2020 16:29
Instructions for running Chrome in Mendel OS as kiosk mode
# 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
import tempfile
import os
import tensorflow as tf
import numpy as np
from tensorflow import keras
# Load MNIST dataset
mnist = keras.datasets.mnist
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()
@Namburger
Namburger / qat_demo.py
Created July 13, 2020 13:36
Quantization Aware Training Demo
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.