Skip to content

Instantly share code, notes, and snippets.

Working from home


Working from home
View GitHub Profile
yjxiong /
Created Aug 14, 2018
Sample code for tracking
import cv2
import sys
(major_ver, minor_ver, subminor_ver) = (cv2.__version__).split('.')
assert minor_ver >= 2, "Must use opencv 3.2.x up"
if __name__ == '__main__' :
# Set up tracker.
# Instead of MIL, you can also use
yjxiong /
Last active Jun 20, 2018
SolvePnP for Head Pose Estimation
Light weight head pose estimation with SolvePnP
Author: Yuanjun Xiong
# parameters
fx = 1
# model points
yjxiong / dummyfig.tex
Created Nov 13, 2016 — forked from dpgettings/dummyfig.tex
Fancy placeholder figures in LaTeX
View dummyfig.tex
%% This part goes in preamble
yjxiong /
Created Jul 7, 2016
Install OpenCV with ffmpeg and CUDA
echo "Installing OpenCV" $version
mkdir OpenCV
cd OpenCV
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get -qq remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
View OpenCV H264

To use OpenCV's VideoWriter class to write an H264 encoded video, one would encounter some error like

Could not open codec libx264: unspecified error

Here is the trick. Beforehand, one has to make sure

  • --enable-libx264 is switched on in ffmpeg
  • OpenCV is downloaded in sources.
yjxiong /
Last active Apr 4, 2016
Download youtube videos in best format
youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' \
--merge-output-format mp4 \
# This command downloads the best available quality video together with the best audio. Then it combines them with the post-processor.
__author__ = 'Yuanjun Xiong'
This script will transform an image based Caffe model to its optic flow ready form
The basic approach is to average the three channels of the first set of convolution filters.
Averaged filters are then replicated K times to incorporate K input frames of optical flow maps.
Refer to "Towards Good Practices for Very Deep Two-Stream ConvNets" for more details.
python <caffe root> <first layer name> <image model prototxt> <image model weights> <flow model prototxt> <flow model weights[out]>
yjxiong /
Created Oct 13, 2015
use NLTK to do word extraction
__author__ = 'alex'
# from pyspark import SparkContext, SparkConf
import nltk
from nltk.corpus import stopwords
sw = stopwords.words('english')
tk = nltk.tokenize.WordPunctTokenizer()
View 1 - WIDER Deep Channel

This gist holds the Caffe style model spec for the CVPR'15 paper

Recognize Complex Events from Static Images by Fusing Deep Channels

The model has two channels, one for appearance analysis, the other one for detection bounding box analysis.

The appearcance analysis channel has the similar structure of the AlexNet and thus is initialized using a model pretrained on ImageNet.

yjxiong / 1 - WIDER Baseline
Last active Nov 14, 2018
The model spec for the baseline CNN Model on WIDER dataset
View 1 - WIDER Baseline

This gist holds the model spec for the baseline CNN model on the WIDER dataset.

The CNN structure is AlexNet. Network parameters are initialized using a model pretrained on ImageNet.

The weights can be downloaded at


Please refer to

You can’t perform that action at this time.