Skip to content

Instantly share code, notes, and snippets.

View pppoe's full-sized avatar
🎮
:)

Haoxiang Li pppoe

🎮
:)
View GitHub Profile
@pppoe
pppoe / EventParser.rb
Created June 2, 2011 09:17
get information of an event from douban, use for learning only
require 'open-uri'
require 'rubygems'
require 'nokogiri'
require 'photoParser'
#rootURL = "http://www.douban.com/event/13967079/"
class EventParser
def self.parse(rootURL)
html = open(rootURL)
@pppoe
pppoe / FixWidthText.h
Created June 14, 2011 05:40
Change Symbols to Fixed Width Symbols
//
// FixWidthText.h
// LayoutImageInText
//
// Created by Haoxiang on 6/14/11.
// Copyright 2011 DEV. All rights reserved.
//
#import <Foundation/Foundation.h>
@pppoe
pppoe / LayoutImageInText.m
Created June 14, 2011 09:46
Image-text-mixed Layout
//
// TestView.m
// LayoutImageInText
//
// Created by Haoxiang on 6/14/11.
// Copyright 2011 DEV. All rights reserved.
//
#import "TestView.h"
#import "NSString+Extern.h"
@pppoe
pppoe / InitializeStruct.m
Created August 25, 2011 02:46
An unfamiliar way to initialize structure array
typedef struct demoStruct {
int val;
float *point;
} DemoStruct;
@implementation InitStructureAppDelegate
@synthesize window=_window;
@pppoe
pppoe / DrawROC.m
Created February 2, 2012 22:28
Draw ROC Curve from two arrays
function [Tps, Fps] = ROC(scores, labels)
%% Sort Labels and Scores by Scores
sl = [scores; labels];
[d1 d2] = sort(sl(1,:));
sorted_sl = sl(:,d2);
s_scores = sorted_sl(1,:);
s_labels = round(sorted_sl(2,:));
@pppoe
pppoe / binary.cc
Created April 26, 2013 17:22
fread fwrite fprintf fscanf, C-style strtok and C++ getline for tokenize
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
/* Binary IO*/
/*
@pppoe
pppoe / discriminativecov.m
Created December 8, 2013 05:09
[CV] within-class and between-class covariance matrix
function [withincovar, betweencovar] = discriminativecov(X, ids)
arr_ids = int16(ids);
dim = size(X, 2);
num_pts = size(X, 1);
num_class = size(unique(arr_ids), 1);
arr_ids_sets = cell(num_class,1);
arr_ids_count = zeros(num_class,1);
for i = 1:num_class
@pppoe
pppoe / cmake-check-system-os
Created April 29, 2014 19:52
CMake check system OS
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Mac OS X specific code
SET(OperatingSystem "Mac OS X")
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET(OperatingSystem "Linux")
ELSE()
SET(OperatingSystem "Others")
ENDIF()
@pppoe
pppoe / ImageNet_mean_224
Created March 24, 2016 17:42
ImageNet Mean Values 3x224x224
This file has been truncated, but you can view the full file.
113.265
113.308
113.436
113.515
113.68
113.75
113.871
113.894
114.026
114.051
@pppoe
pppoe / Convert COFW dataset
Created September 23, 2016 05:06
Quick Script to dump out images and annotations from the COFW dataset
## http://www.vision.caltech.edu/xpburgos/ICCV13/
output_dets_f = './dets-COFW-train.txt'
image_root = './COFW-train-';
load('COFW_train.mat');
imgs = IsTr;
bboxes = bboxesTr;
lms = phisTr;
% output_dets_f = './dets-COFW-test.txt'