Skip to content

Instantly share code, notes, and snippets.

@somewacko
somewacko / install_libtensorflow_cc.sh
Last active April 27, 2020 12:43
Script to build and install the C++ TensorFlow library to /usr/local
#!/usr/bin/env sh
#
# Installs the C++ headers and library for TensorFlow.
TF_VERSION=v1.2.1
INSTALL_TARGET=/usr/local
if [ ! `command -v bazel` ]; then
echo "TensorFlow requires bazel in order to build TensorFlow!"
echo "Please install bazel and make sure it's on your PATH and try again."
@somewacko
somewacko / vgg16.py
Created April 15, 2016 02:48
Keras VGG-16 model with functional API
from keras.layers import Dense, Dropout, Flatten, Input
from keras.layers import Convolution2D, MaxPooling2D, ZeroPadding2D
from keras.models import Model
from keras.utils.layer_utils import print_summary
VGG_PATH = 'vgg16_weights.h5'
vis_input = Input(shape=visual_shape, name="vis_input")
x = ZeroPadding2D((1,1)) (vis_input)
@somewacko
somewacko / doge.grammar
Created February 3, 2016 04:50
A CFG definition for doge. wow.
# such grammar. very linguistics. wow.
#
# a context-free grammar of doge.
#
# much reference: the-toast.net/2014/02/06/linguist-explains-grammar-doge-wow
1 ROOT S
# ---- Sentences and doge phrases
#
@somewacko
somewacko / progress_bar.py
Last active February 3, 2016 05:35
A simple progress bar with carriage return. Reinventing the wheel.
import math, sys
def print_progress_bar(progress, length=40, fill_char='=', empty_char=' ',
side_char='|'):
'''
Prints a simple progress bar using carriage returns.
Args:
progress (int): The progress done as a percentage 0-100
@somewacko
somewacko / scrape_images.py
Created November 16, 2015 18:27
Python script to scrape images using Google CSE.
'''
CS.661: Computer Vision
Johns Hopkins University
Flynn, Michael
Python script to scrape images from Google CSE.
Usage:
python scrape_images.py {directory} {num_queries}