Skip to content

Instantly share code, notes, and snippets.

Avatar

Shawn Hymel ShawnHymel

View GitHub Profile
@ShawnHymel
ShawnHymel / ei_json_to_csv.ipynb
Last active November 16, 2022 00:10
Edge Impulse JSON to CSV
View ei_json_to_csv.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ShawnHymel
ShawnHymel / gym-recorder-demo.py
Last active December 11, 2022 22:44
OpenAI Gym Video Recorder
View gym-recorder-demo.py
# This works for gym 0.26.2. It might not work on previous versions.
import gym
import cv2
fps = 30
# Create environment
env = gym.make('CartPole-v1', render_mode='rgb_array')
@ShawnHymel
ShawnHymel / magic_wand_standardized_inference.ino
Created October 10, 2022 19:38
Edge Impulse magic wand inference example
View magic_wand_standardized_inference.ino
/**
* Magic Wand Inference Demo
*
* Attach a button to pin 2. Press button to start collection. Raw data will be
* collected and fed to the impulse for inference. Inference results are printed
* to the serial terminal.
*
* Author: Shawn Hymel (EdgeImpulse, Inc.)
* Date: October 10, 2022
* License: Apache-2.0 (apache.org/licenses/LICENSE-2.0)
@ShawnHymel
ShawnHymel / pygame-display-test.py
Created September 21, 2022 21:22
PyGame Display Test
View pygame-display-test.py
"""
PyGame Display Test
Run to see if you can draw things in Pygame. Press 'esc` to exit. Run with
root privileges to draw on external monitor (e.g. from SSH).
"""
import pygame
# Initialize pygame
@ShawnHymel
ShawnHymel / printf_test.ino
Created August 28, 2022 18:02
Arduino printf test
View printf_test.ino
#include <stdarg.h>
// Makeshift printf for the Serial terminal
void aprintf(const char *format, ...) {
static char print_buf[1024] = { 0 };
va_list args;
va_start(args, format);
int r = vsnprintf(print_buf, sizeof(print_buf), format, args);
va_end(args);
@ShawnHymel
ShawnHymel / time_series_dataset_curation.ipynb
Last active May 1, 2023 14:20
CSV Time Series Dataset Curation and Standardization
View time_series_dataset_curation.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ShawnHymel
ShawnHymel / quantized-inference-example.py
Last active April 8, 2023 03:32
TensorFlow Lite (TFLite) Python Inference Example with Quantization
View quantized-inference-example.py
# TFLite quantized inference example
#
# Based on:
# https://www.tensorflow.org/lite/performance/post_training_integer_quant
# https://www.tensorflow.org/lite/api_docs/java/org/tensorflow/lite/Tensor.QuantizationParams
import numpy as np
import tensorflow as tf
# Location of tflite model file (float32 or int8 quantized)
@ShawnHymel
ShawnHymel / eye_test_01.py
Last active December 30, 2021 18:46
Adafruit HT16K33 LED matrix backpack test for Raspberry Pi
View eye_test_01.py
import board
import busio
import time
from random import random
from adafruit_ht16k33 import matrix
# Initialize LED matrix
i2c = busio.I2C(board.SCL, board.SDA)
eye =matrix.Matrix8x8(i2c)
@ShawnHymel
ShawnHymel / cnn-live-inference-lcd.py
Created September 26, 2021 19:33
OpenMV Electronic Component CNN Live Classification with LCD
View cnn-live-inference-lcd.py
"""
OpenMV Live Image Inference
Continuously captures images and performs image using provided TFLite model
file. Outputs probabilities in console. Displays preview on LCD backpack along
with predicted label.
Author: EdgeImpulse, Inc.
Modified: Shawn Hymel
Date: September 26, 2021
@ShawnHymel
ShawnHymel / tflite_sinewave_training.ipynb
Created March 18, 2020 17:42
TensorFlow Lite Sinewave Regression Training and Conversion
View tflite_sinewave_training.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.