Skip to content

Instantly share code, notes, and snippets.

@zhreshold
zhreshold / imagenet1000_clsid_to_human.txt
Created September 26, 2017 22:15 — forked from yrevar/imagenet1000_clsidx_to_labels.txt
text: imagenet 1000 class id to human readable labels
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
@zhreshold
zhreshold / README.md
Last active January 9, 2018 23:50
Super resolution example onnx

This is a demo onnx model for super resolution.

@zhreshold
zhreshold / concat.py
Created October 4, 2017 18:57
HybridBlock of concat layer
from mxnet.gluon import HybridBlock
class Concat(HybridBlock):
"""Concat operation for multiple inputs."""
def __init__(self, dim=1, **kwargs):
super(Concat, self).__init__(**kwargs)
self._kwargs = {'dim': dim}
def hybrid_forward(self, F, *args):
return F.concat(*args, name='fwd', **self._kwargs)
@zhreshold
zhreshold / fc_bench.py
Last active October 5, 2017 18:48
FC perf benchmark
import mxnet as mx
import numpy as np
from timeit import default_timer as timer
def get_bench_net(num_hidden=10000):
data = mx.sym.var('data')
fc = mx.sym.FullyConnected(data, num_hidden=num_hidden)
return fc
num_out = 10000
@zhreshold
zhreshold / resnet101_v2.sh
Last active October 12, 2017 23:31
MXNet Imagenet training configurations
python train_imagenet.py --data-train ~/data/train.rec --data-val ~/data/val.rec --gpus 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 --data-nthreads 32 --network resnet101_v2 --batch-size 256 --top-k 5 --model-prefix model/resnet101_v2 --min-random-scale 0.533 --max-random-shear-ratio 0 --max-random-rotate-angle 0 --max-random-h 0 --max-random-l 0 --max-random-s 0 --lr-step-epochs 30,60,90 --num-epochs 120 --rgb-std '58.395,57.12,57.375'
@zhreshold
zhreshold / bullet.js
Last active October 14, 2017 03:44
d3.js demo
(function() {
// Chart design based on the recommendations of Stephen Few. Implementation
// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
// http://projects.instantcognition.com/protovis/bulletchart/
d3.bullet = function() {
var orient = "left", // TODO top & bottom
reverse = false,
duration = 0,
ranges = bulletRanges,
@zhreshold
zhreshold / demo_bench.json
Last active October 14, 2017 22:23
Sortable table d3.js
{
"nvidia-titan-x": {
"devices": [
{
"cores": "3072",
"memory": "12GB",
"memory_bandwith": "336.5GB/s",
"name": "Nvidia Titan X",
"quantity": 1
}
name: "shufflenet"
# transform_param {
# scale: 0.017
# mirror: false
# crop_size: 224
# mean_value: [103.94,116.78,123.68]
# }
input: "data"
input_shape {
dim: 1
python mxnet/example/image-classification/train_imagenet.py --network shufflenet --data-train ~/efs/users/joshuazz/data/imagenet/record/train_480_q95.rec --data-val ~/efs/users/joshuazz/data/imagenet/record/val_256_q90.rec --batch-size 512 --gpus 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 --num-epochs 150 --lr-step-epochs 30,60,90 --min-random-scale 0.533 --lr 0.01 --disp-batches 100 --top-k 5 --data-nthreads 32 --random-mirror 1 --max-random-shear-ratio 0 --max-random-rotate-angle 0 --max-random-h 0 --max-random-l 0 --max-random-s 0 --model-prefix model/shufflenet | tee ~/efs/users/joshuazz/temp/train_imagenet_logs/shufflenet.log
@zhreshold
zhreshold / cuda9_2.sh
Last active October 26, 2018 08:24
CUDA 9 and CUDNN 7
sudo apt update
sudo apt-get -y install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev libgfortran3
wget 'https://developer.nvidia.com/compute/cuda/9.2/Prod2/local_installers/cuda_9.2.148_396.37_linux' -O cuda92.run
wget 'https://developer.nvidia.com/compute/cuda/9.2/Prod2/patches/1/cuda_9.2.148.1_linux' -O patch1.run
sudo sh cuda92.run
sudo sh patch1.run
echo "# CUDA9.2" >> ~/.bashrc
echo "export PATH=/usr/local/cuda/bin:\$PATH" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=/usr/local/cuda/lib64:\$LD_LIBRARY_PATH" >> ~/.bashrc