Skip to content

Instantly share code, notes, and snippets.

@helxsz
helxsz / Visualization
Created December 6, 2015 22:45
Visualization
# This is all 'experimental code'; it loosely follows the instructions from
# the 'ImageNet classification' and 'Filter visualization' ipynb tutorials from
# http://caffe.berkeleyvision.org/
import numpy as np
import matplotlib.pyplot as plt
# Make sure that caffe is on the python path:
caffe_root = '../../caffe-master/'
@helxsz
helxsz / anotate
Created December 6, 2015 22:42
anotate
import os
import cv2
import sys
old_class = 0
truth = 0
w_file = open(sys.argv[1], 'w')
b_file = open(sys.argv[2], 'w')
m_file = open(sys.argv[3], 'w')
with open('test.txt') as f:
@helxsz
helxsz / 3_install_deeplearning_libs.sh
Created December 1, 2015 18:03 — forked from graphific/3_install_deeplearning_libs.sh
Installation script for Deep Learning Libraries on Ubuntu 14.04
#!/usr/bin/env bash
# Installation script for Deep Learning Libraries on Ubuntu 14.04, by Roelof Pieters (@graphific)
# BSD License
orig_executor="$(whoami)"
if [ "$(whoami)" == "root" ]; then
echo "running as root, please run as user you want to have stuff installed as"
exit 1
fi
###################################
@helxsz
helxsz / ReadCSVToDatum.txt
Created November 1, 2015 14:15 — forked from arunmallya/ReadCSVToDatum.txt
A function to load CSV data into a caffe datum
bool ReadCSVToDatum(const string& filename, Datum* datum) {
// read in the CSV file into a vector
fstream file(filename.c_str(), ios::in);
vector<vector<int> > label;
std::string line;
while (std::getline(file, line)) {
// replace commas with spaces
for (int i = 0; i < line.length(); i++) {
if (line[i] == ',')
line[i] = ' ';
@helxsz
helxsz / testHDF5
Last active October 24, 2015 21:22
import os
import numpy as np
import random
from PIL import Image
import numpy as np
import h5py
import matplotlib.pyplot as plt
import glob
import os, sys
import cv2
import argparse
from multiprocessing import Process
def vid_to_images(video_file, output_dir, skip_frames = 0):
print 'Processing video:', video_file
@helxsz
helxsz / face_detection.py
Created October 21, 2015 18:53 — forked from erogol/face_detection.py
detect faces and show them on separate windows. You give the image path as an argument to that python script and see the magic.
from __future__ import division
import cv2
import cv2.cv as cv
import sys
import pdb
def detect(img, cascade):
rects = cascade.detectMultiScale(img, scaleFactor=1.1, minNeighbors=3, minSize=(10, 10), flags = cv.CV_HAAR_SCALE_IMAGE)
if len(rects) == 0:
return []
def generateHDF5FromText2(label_num):
print '\nplease wait...'
HDF5_FILE = ['hdf5_train.h5', 'hdf5_test1.h5']
#store the training and testing data path and labels
LIST_FILE = ['train.txt','test.txt']
for kk, list_file in enumerate(LIST_FILE):
@helxsz
helxsz / nvidia-gpu-monitor.ipynb
Created October 19, 2015 12:04 — forked from jimgoo/nvidia-gpu-monitor.ipynb
Live plotting of Nvidia GPU utilization
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@helxsz
helxsz / deploy.prototxt
Created October 17, 2015 16:52 — forked from tsulej/deploy.prototxt
Train your own net prototxt files
name: "MYNET"
input: "data"
input_dim: 1
input_dim: 3
input_dim: 224
input_dim: 224
layer {
name: "conv1/7x7_s2"
type: "Convolution"
bottom: "data"