Toolkit _posts/ Pytorch&Tensorflow Installation

Start from installation

Pretty funny, the journey to explore torch start from installing pytorch from source code. It’s easy to do following the instructions given on Pytorch’s github README. So it is to build tensorflow from source code following the official guideline. Both could be pretty time consuming as lots of stuff got included, and lot of details hidden in the auto compiling process, its better to get the general idea of how these frameworks can do for us before trying to understand each line in the source code.

Theory _posts/ Detection

Got to know the work CornerNet which was attractive as researchers seems having done what I want to do but could not with limited knowledge and programming skills.

Theory _posts/ The confusing Math


Symbols let us express complex things in concise way. But without enough context information, mathematics is poisonous rather than being helpful for our reading and learning experience, serves as a trick to make the paper looks meaty.

As math troubles most of us when we met for the first time, genius guys could help by creating sites like Khan Academy, Better Explained, AOPS, writing books like Calculus Lifesaver, providing courses like LHTL. We need to practice like learning a language to really embrace it rather than let it being the jargon for professionals.

Number for everything

To extend the power of human mind by joining us in a union.

The name of google came from the word Googol which stands for a fairly big number(), and the roadmap of the company is interesting: turn everything to numbers->do computation->automate repetitive work->iterate.

It doesn’t matter what the world is, atoms for real world but numbers for human mind, which could link all human minds as a whole entity to do things that could not be done solely by anyone of us.

Programming _posts/ Daily Tricks

Programmers hold nice tricks for computer power users

Self-serviced 2X Video

As HTML5 is widely used, you can easily accelerate the video by opening the browser console and type in the following code:

vElement = document.querySelector('video');
vElement.playbackRate = 2.0;;

feel free to enjoy customized speed, ignore the criticisms saying young generation are impatient as that came from the same population who forces their child to start competing in the early age without being prepared in the name of win at the start line. DO NOT JUDGE.

Easy to use File Transfer Service in Local Area Network

If you have python installed, just type in

python3 -m http.server -p 6666

at the directory with files you want to share, then use ipconfig/ifconfig to check your ip, visit http://[ip]:[port] at any machine via webbrowser to get the file:)No need of QQ, Wechat or anything else.

Theory _posts/ Segmentation

Image/Semantic/Instance segmentation and various video segmentation methods.

Assuming there are three major colors in the image, so we can segment the image by clustering pixels according to their color. In OpenCV(py, 3.4.1), we could use code as below:

im = cv2.imread('x.jpg') # Assuming to be color image
pixels = im.reshape([-1, 3])
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 10, 1.0)
ret,label,center=cv2.kmeans(pixels.astype(np.float32),4, None, criteria,5,cv2.KMEANS_RANDOM_CENTERS)

For visualization we could also plot this dots in three dimensional space with help of matplotlib.

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

Knowledge _posts/ Neural Networks for Machine Learning

Course note for NN4ML offered by Geoffrey Hinton.

Theory _posts/ The classic and new approaches

Computer vision

CUDA _posts/ CUDA 101


Theory _posts/ Not real intelligence

Toolkit _posts/ Caffe Guide

Caffe was purposed and implemented in 2014 as the follow-up work done by Yangqing Jia after published their ICML paper, the prototype was called DeCAF. The framework was introduced to fast-prototyping training and testing of convolutional neural networks.

Caffe was not the first deep learning framework, nor the last one. It was successful due to the easy-to-reuse feature, support for command-line, python and MATLAB interface and rich model zoo. It heavily depends on a bunch of libraries which makes the compiling procedure painful and troublesome. Caffe was gradually replaced by other newly appeared frameworks but it’s concept in implementation and even partial of code has been inherited by new generations.

The logic behind Caffe is clear, the data are saved in a 4-dimension array(blob), flow between layers, both forward and backward, weight update controlled by optimizers. The whole model defined by protobuf specifications and declarations which looks similar to SUN RPC. Accelerated by CUDA, tested using GTest, en-powered by libraries like boost. But due to the various sources of input data, lots of Caffe code dedicated to data loading and pre-processing which may be confusing if you are not familiar with distributed file systems and other related topics. Customized Caffe and layers are also available in different sites(mainly on github) for specific purpose, Nvidia also provided a customized Caffe which has been optimized with support for new tech like TensorRT.

Toolkit _posts/ Add layers in Caffe

You should be able to compile Caffe successfully before reading this post.

By chance, I need to test the SINT project, and this would be a good demo showing how to add new layers to Caffe.

For this case, using official Caffe developed by BVLC, we need to put provided normalize_layer.cpp and .cu file into src/caffe/layers folder, put .hpp file into include/caffe/layers. Then adding ROI pooling layer included in Fast-RCNN, copy lines defining ROIPooling(keyword search is enough) in src/caffe/proto/caffe.proto from Fast-RCNN to the our caffe.proto(BTW, protobuf is quite similar to SUN RPC), copy roi_* files inside src/caffe/layers combined with fast_rcnn_layers.hpp inside include/caffe/ to corresponding folders to our branch.

Then re-make Caffe, SINT model should be runnable now which serves as a good example for adding given new layers.

Theory _posts/ I Love ML



从林老师和 Andrew 提供的课程材料兜兜转转到 Prof. Abu-Mostafa,Fei-Fei Li 的讲课视频,再到志华老师和李航老师的书,MLND 的 hands-on,调 sklearn 到 tf 的各种 API,到 OMSCS 的作业,啥时候才能学会科学炼金?


  • 怎样才算是一个好问题?


    def bienaole():
      return "ok"
  • 门派、故事以及推荐的书和老师?

  • Sklearn, Tensorflow, Pytorch, DIGITS, Spark, Hadoop…如何在工具海洋中挣扎求存,处理编译安装等各种问题?

  • 二分类、感知机、支持向量机到黄焖鸡,赶只鸡?用肉眼做二分类的坑。

  • 神经网络的暴力美学,如何做到知行合一?

Fun _posts/ Algorithms


前言, 吐槽, 术语核对表, 显然, DP, 排序, 线性结构, 半线性结构, 线性结构, :-O, 案例->来做一个各大算法课涉及内容的大杂烩。