Skip to content

Instantly share code, notes, and snippets.

View tawnkramer's full-sized avatar

Tawn Kramer tawnkramer

  • San Diego, CA
View GitHub Profile
@rocking5566
rocking5566 / keras_quant.py
Last active December 8, 2020 09:40
Quantization aware training in keras
import numpy as np
import tensorflow as tf
from tensorflow.keras.datasets import mnist
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Activation, Conv2D, Flatten
from tensorflow.keras.optimizers import RMSprop
# download the mnist to the path '~/.keras/datasets/' if it is the first time to be called
# X shape (60,000 28x28), y shape (10,000, )
@alanwells
alanwells / custom_train.py
Last active October 20, 2017 17:30
Donkey2 custom train script, updated to work when records have been removed
def custom_train(cfg, tub_names, model_name):
'''
use the specified data in tub_names to train an artifical neural network
saves the output trained model as model_name
'''
import sklearn
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
import random
from PIL import Image