Skip to content

Instantly share code, notes, and snippets.

import multiprocessing.dummy as mul
from time import time, sleep
from joblib import Parallel, delayed
def f(x):
sleep(.01)
return x*x
if __name__ == '__main__':
@ih4cku
ih4cku / lenet_deploy.prototxt
Last active August 29, 2015 14:12
Predict image with trained model.
name: "LeNet"
input: "data"
input_dim: 1
input_dim: 1
input_dim: 28
input_dim: 28
layers {
name: "conv1"
type: CONVOLUTION
bottom: "data"
#include <iostream>
#include "caffe/util/io.hpp"
#include "caffe/proto/caffe.pb.h"
using namespace std;
int main(int argc, char const *argv[])
{
caffe::BlobProto blob;
const char filename[] = "mean.binaryproto";
@ih4cku
ih4cku / build_cmds
Created March 6, 2015 08:24
OpenCV & Caffe build command
cmake -D BOOST_INCLUDEDIR=/usr/local/include -D BOOST_LIBRARYDIR=/usr/local/lib -D PYTHON_EXECUTABLE=/root/anaconda/bin/python -D PYTHON_INCLUDE_DIR=/root/anaconda/include/python2.7 -D PYTHON_LIBRARY=/root/anaconda/lib/libpython2.7.so -D PYTHON_PACKAGES_PATH=/root/anaconda/lib/python2.7/site-packages/ -D PYTHON_NUMPY_INCLUDE_DIR=/root/anaconda/lib/python2.7/dist-packages/numpy/core/include -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_EIGEN=ON BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D WITH_OPENCL=OFF -D WITH_CUDA=OFF -D BUILD_opencv_gpu=OFF -D BUILD_opencv_gpuarithm=OFF -D BUILD_opencv_gpubgsegm=OFF -D BUILD_opencv_gpucodec=OFF -D BUILD_opencv_gpufeatures2d=OFF -D BUILD_opencv_gpufilters=OFF -D BUILD_opencv_gpuimgproc=OFF -D BUILD_opencv_gpulegacy=OFF -D BUILD_opencv_gpuoptflow=OFF -D BUILD_opencv_gpustereo=OFF -D BUILD_opencv_gpuwarping=OFF ..
cmake -D BOOST_INCLUDEDIR=/usr/local/include -D BOOST_LIBRARYDIR=/usr/local/lib -D PYTHON_EXECUTABLE=/r

DL-RL

Introduction:

  • Deep learning (DL) is a new research track within the field of machine learning, building architectures consisting of multiple layers of representations in order to learn high level abstractions.
  • Reinforcement learning (RL) is one of the most promising AI paradigms for the future development of autonomous robots. RL allows a robot to learn from trial-and-error interactions with its environment.

Capability complementary:

  • DL can be used as a strong perception model of the environment.
  • RL is used as the learning paradigm for controling robot's actions.
  • The combination of DL and RL allows a learning agent to control a system based only on visual inputs, using a deep neural network to extract relevant features from the images.
#!/usr/bin/env python
import os
import sys
from os import path
script_dir = '/opt/rnnlib-utils'
scripts = os.walk(script_dir).next()[2]
for sc in scripts:
sc = path.join(script_dir, sc)
@ih4cku
ih4cku / create_nc.py
Created July 10, 2015 16:46
Create rnnlib nc dataset from a label file.
#!/usr/bin/env python
import netcdf_helpers
import numpy as np
import os
import cv2
from os import path
import sys
import cPickle
from glob import glob
from digitmodel import DigitNet
<blacklist>
<path>config.h</path>
<path>include.hpp</path>
<path>Makefile</path>
<path>rnnlib</path>
<path>rnnlib/Makefile</path>
<path>src/CodeNet.hpp</path>
<path>src/DecodingLayer.hpp</path>
<path>src/Makefile</path>
<path>src/MemoryNet.hpp</path>
@ih4cku
ih4cku / git-workflow.md
Created August 16, 2015 16:28
git workflow posts

working tree

  • A "working tree" consist of files that you are currently working on.

commits

  • a snapshot of
  • commiter
@ih4cku
ih4cku / opencv-2.4.11-cmake-command.txt
Created December 3, 2015 14:02
opencv-2.4.11-cmake-command
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D CUDA_GENERATION=Auto..