Skip to content

Instantly share code, notes, and snippets.

@erogol
erogol / rmsprop.log
Created February 17, 2015 22:17
RMSprop output
I0218 00:09:37.517771 18287 caffe.cpp:99] Use GPU with device ID 0
I0218 00:09:37.842236 18287 caffe.cpp:107] Starting Optimization
I0218 00:09:37.842380 18287 solver.cpp:32] Initializing solver from parameters:
test_iter: 100
test_interval: 500
base_lr: 0.01
display: 100
max_iter: 10000
lr_policy: "inv"
gamma: 0.0001
@erogol
erogol / ext_to_csv.cpp
Created February 24, 2015 21:24
Caffe based feature extraction to a csv file
#include <stdio.h> // for snprintf
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include "boost/algorithm/string.hpp"
#include "boost/filesystem.hpp"
#include "boost/regex.hpp"
#include "google/protobuf/text_format.h"
@erogol
erogol / CART.ipynb
Created March 7, 2015 20:27
CART tree implementation for my ML HW
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include<opencv2/opencv.hpp>
#include<opencv2/imgproc.hpp>
#include<opencv2/imgcodecs/imgcodecs.hpp>
#include<opencv2/videoio.hpp>
#include<iostream>
#include<vector>
int main(int argc, char *argv[])
{
cv::Mat frame;
@erogol
erogol / git_cheatsheet
Last active August 31, 2015 09:17
GIT cheatsheet for beginners
git init
git status
git add file.ext
Add file.ext to tracking of GIT
git commit -m "Comment"
Say changes are commited
@erogol
erogol / face_detection.py
Created February 8, 2014 12:58
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 []
@erogol
erogol / readDataFromPath.m
Created April 28, 2013 18:04
Read images into matrix from two layer folder structure
function [images, images_RGB] = readDataFromPath(DataPath, image_size)
% Reads the image content of the given rootpath. Assumes that we have a
% root folder includes sub folder for each class of images
images = {};
images_RGB = {};
root_dir = dir(DataPath);
root_dir = root_dir([root_dir.isdir]);
folder_names = {root_dir.name};
root_dir = root_dir(~ismember(folder_names,{'.','..'}))
@erogol
erogol / gridsplit.m
Last active December 22, 2015 00:28
function im_array=gridsplit(im,grid_x,grid_y,width_fact,height_fact,left_extra,right_extra,top_extra,bottom_extra)
%Crops a grid of images out of one image
% im_array=gridsplit(im,...) returns an image array im_array that has
% size (MxNxPxR) in which M the width, N the height, P the channel and R
% the amount of images destilled from the grid. So it puts all the
% gridparts in R which has size (grid_x*grid_y)
% You get the idea. Otherwise more info on: www.timzaman.nl
%
% grid_x = Amount of horizontal patches
% grid_y = Amount of vertical patches
function[ROOT_DIR] = read_dir(PATH)
ROOT_DIR = dir(PATH);
% video_names = ls(fullfile(PATH,'*.mp4'));
file_names = {ROOT_DIR.name};
ROOT_DIR = ROOT_DIR(~ismember(file_names,{'.','..'}));
@erogol
erogol / normalize_data.m
Created September 3, 2013 15:06
Data normalization columnwise
%
% Normalize data columnwise to reduce different unit's effect
%
function[X_norm, val] = normalize_data(X,val)
% if ~exist('va','var')
% [val,ind] = max(X,[],1);
% end
% X_norm = bsxfun(@rdivide, X, val);