Skip to content

Instantly share code, notes, and snippets.

View leigh-johnson's full-sized avatar
💜

Leigh Johnson leigh-johnson

💜
View GitHub Profile
@leigh-johnson
leigh-johnson / keras_lstm.py
Created July 6, 2019 23:28
Comparsing TensorFlow vs Keras for an LSTM model
from keras.layers import LSTM
model = Sequential()
model.add(Embedding(max_features, 256, input_length=maxlen))
model.add(LSTM(output_dim=128, activation='sigmoid', inner_activation='hard_sigmoid'))
model.add(Dropout(0.5)) model.add(Dense(1))
model.add(Activation('sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy'])
model.fit(X_train, Y_train, batch_size=16, nb_epoch=10)
Model: "mobilenetv2_1.00_224"
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_1 (InputLayer) [(None, 224, 224, 3) 0
__________________________________________________________________________________________________
Conv1_pad (ZeroPadding2D) (None, 225, 225, 3) 0 input_1[0][0]
__________________________________________________________________________________________________
Conv1 (Conv2D) (None, 112, 112, 32) 864 Conv1_pad[0][0]
__________________________________________________________________________________________________
@leigh-johnson
leigh-johnson / v2.0.0-beta0-build.log
Created June 15, 2019 09:32
Internal Compiler Error cross-compiling v2.0.0-beta0 for Raspberry Pi
This file has been truncated, but you can view the full file.
WORKSPACE: /Users/ljohnson/repos/tensorflow
CI_DOCKER_BUILD_EXTRA_PARAMS:
CI_DOCKER_EXTRA_PARAMS: -e CI_BUILD_PYTHON=python3 -e CROSSTOOL_PYTHON_INCLUDE_PATH=/usr/include/python3.4
COMMAND: tensorflow/tools/ci_build/pi/build_raspberry_pi.sh
CI_COMMAND_PREFIX: ./tensorflow/tools/ci_build/builds/with_the_same_user ./tensorflow/tools/ci_build/builds/configured pi-python3
CONTAINER_TYPE: pi-python3
BUILD_TAG: tf_ci
(docker container name will be tf_ci.pi-python3)
@leigh-johnson
leigh-johnson / armv7.build_history000
Last active June 12, 2019 05:28
Cross-compiling Tensorflow 2.0 for RPI
CI_DOCKER_EXTRA_PARAMS="-e CI_BUILD_PYTHON=python3 -e CROSSTOOL_PYTHON_INCLUDE_PATH=/usr/include/python3.5" \
tensorflow/tools/ci_build/ci_build.sh PI-PYTHON3 \
tensorflow/tools/ci_build/pi/build_raspberry_pi.sh
CC_TOOL=/tools/cross-pi-gcc-8.3.0-1/bin/arm-linux-gnueabihf-g++ \
bazel build -c opt \
--copt=-march=armv7-a \
--copt=-mfpu=neon-vfpv4 \
--copt=-std=c++11 \
--copt=-funsafe-math-optimizations --copt=-ftree-vectorize \
@leigh-johnson
leigh-johnson / install-go.sh
Last active November 19, 2018 07:56
Updated init scripts for kubeflow + microk8s
echo "Downloading and installing go"
wget https://dl.google.com/go/go1.11.2.linux-amd64.tar.gz /home/multipass/go1.11.2.linux-amd64.tar.gz
tar -xvf go1.11.2.linux-amd64.tar.gz
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def nth_iterinterleave(*arrays, nth=1):
"""Interleave multiple lists.
via https://github.com/dgilland/pydash/blob/develop/src/pydash/arrays.py
Expanded to allow an nth parameter, where arrays[0] is treated as the primary and arrays[1:] are interleaved every n elements
Example:
given *arrays = [ [1,2,3,4,5,6,7,8,9,10], ['x', 'y', 'z'], ['a', 'b', 'c'] ]
@leigh-johnson
leigh-johnson / example.html
Created July 7, 2018 18:09
Three.js Cloth Animation Example
<link href="/assets/threejs-cloth/styles/styles.css" rel="stylesheet">
<div class='container'>
<div class='row'>
</div>
<h1> A quick demonstration - <small>writeup soon!</small></h1>
<div class='row'>
<h1 class='col-md-6'> Choose a pattern:</h1>
</div>
<div class='row controls'>
@leigh-johnson
leigh-johnson / NYSE_tradingdays.py
Created November 2, 2017 20:14 — forked from jckantor/NYSE_tradingdays.py
Python dateutil rule sets for NYSE trading days and holiday observances.
from dateutil import rrule
import datetime
# Generate ruleset for holiday observances on the NYSE
def NYSE_holidays(a=datetime.date.today(), b=datetime.date.today()+datetime.timedelta(days=365)):
rs = rrule.rruleset()
# Include all potential holiday observances
rs.rrule(rrule.rrule(rrule.YEARLY, dtstart=a, until=b, bymonth=12, bymonthday=31, byweekday=rrule.FR)) # New Years Day