Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# Either wget or curl is required.
# It's assumed that a C/C++ compiler are installed.
# exit on error
set -e
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
# create our directories
#!/bin/bash
INDIR=$1
OUTDIR=$2
echo "Cloning leveldb in ${INDIR} to ${OUTDIR}"
INPATH=`realpath ${INDIR}`
mkdir -p ${OUTDIR}
sshput () {
RSAKEY="${HOME}/.ssh/id_rsa.pub"
DSAKEY="${HOME}/.ssh/id_dsa.pub"
if [ $# -eq 2 ]; then
KEY=$1
if [ ! -r $KEY ]
then
echo "'$KEY' does not exist or is not readable"
return 1
@jeffdonahue
jeffdonahue / bvlc_reference_alexnet_train_log.txt
Last active December 9, 2017 10:11
Training log for the BVLC AlexNet reference model.
This file has been truncated, but you can view the full file.
I1224 11:43:56.783612 2133 train_net.cpp:26] Starting Optimization
I1224 11:43:56.783983 2133 solver.cpp:26] Creating training net.
I1224 11:43:56.784008 2133 net.cpp:66] Creating Layer data
I1224 11:43:56.784013 2133 net.cpp:101] data -> data
I1224 11:43:56.784023 2133 net.cpp:101] data -> label
I1224 11:43:56.784036 2133 data_layer.cpp:122] Opening leveldb /home/jdonahue/caffe-train-leveldb
I1224 11:43:56.956717 2133 data_layer.cpp:159] output data size: 256,3,227,227
I1224 11:43:56.956765 2133 data_layer.cpp:176] Loading mean file from/home/jiayq/ilsvrc2012_mean.binaryproto
I1224 11:43:57.016316 2133 net.cpp:116] Top shape: 3 227 227
I1224 11:43:57.016341 2133 net.cpp:116] Top shape: 1 1 1
@jeffdonahue
jeffdonahue / alexnet_dummydata_nolrn.prototxt
Created November 11, 2015 01:24
AlexNet with no LRNs and dummy data, for comparison with TensorFlow
layer {
name: "data"
type: "DummyData"
top: "data"
top: "label"
dummy_data_param {
shape { dim: [128, 3, 227, 227] }
shape { dim: [128] }
}
}
try:
range = xrange # Python 2
except NameError:
pass # Python 3
def lazy_product(*iter_funcs, **kwargs):
"""
If f1, f2, ..., are functions which have no (required) arguments and
return iterables, then
lazy_product(f1, f2, ..., repeat=k)
#!/usr/bin/env python
# usage: python count_caffemodel_params.py /path/to/my.caffemodel [/path/to/my/other.caffemodel, ...]
from caffe.proto import caffe_pb2
import sys
assert len(sys.argv) >= 2
for caffemodel_filename in sys.argv[1:]:
@jeffdonahue
jeffdonahue / resize_imageset.py
Last active April 9, 2020 16:38
resize a directory of images
#!/usr/bin/env python
from __future__ import division
import functools
import itertools
import numpy as np
import os
import matplotlib.pyplot as plt
from PIL import Image
import numpy as np
def canonical_axis(x, axis):
def is_int_ndarray(x):
if not isinstance(x, np.ndarray):
return False
dtype = str(x.dtype)
prefixes = 'int', 'uint'
return any(dtype.startswith(p) for p in prefixes)
if axis is None: