Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

yjxiong

🏠
Working from home
View GitHub Profile
@yjxiong
yjxiong / tracking.py
Created Aug 14, 2018
Sample code for tracking
View tracking.py
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
yjxiong / pnp.py
Last active Jun 20, 2018
SolvePnP for Head Pose Estimation
View pnp.py
"""
Light weight head pose estimation with SolvePnP
Author: Yuanjun Xiong
"""
# parameters
fx = 1
# model points
@yjxiong
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
\newcommand{\dummyfig}[1]{
\centering
\fbox{
\begin{minipage}[c][0.33\textheight][c]{0.5\textwidth}
\centering{#1}
\end{minipage}
}
}
@yjxiong
yjxiong / OpenCV.sh
Created Jul 7, 2016
Install OpenCV with ffmpeg and CUDA
View OpenCV.sh
version="2.4.12"
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 VideoWriter.md

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
yjxiong / run.sh
Last active Apr 4, 2016
Download youtube videos in best format
View run.sh
youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' \
--merge-output-format mp4 \
"http://www.youtube.com/watch?v=P9pzm5b6FFY"
# This command downloads the best available quality video together with the best audio. Then it combines them with the post-processor.
View build_flow_model.py
__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.
======================================================================
Usage:
python build_flow_network.py <caffe root> <first layer name> <image model prototxt> <image model weights> <flow model prototxt> <flow model weights[out]>
@yjxiong
yjxiong / nltk_word_extract.py
Created Oct 13, 2015
use NLTK to do word extraction
View nltk_word_extract.py
__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 Fusing.md

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
yjxiong / 1 - WIDER Baseline CNN.md
Last active Nov 14, 2018
The model spec for the baseline CNN Model on WIDER dataset
View 1 - WIDER Baseline CNN.md

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

cuhk_wider_baseline_cnn.caffemodel

Please refer to

You can’t perform that action at this time.