Skip to content

Instantly share code, notes, and snippets.

@liuliu
liuliu / gist:5369039
Created April 12, 2013 03:15
Ground Truth of CMU dataset
voyager.png 122.0 43.0 137.0 47.0 129.0 54.0 123.0 59.0 128.0 60.0 133.0 62.0
voyager.png 191.0 54.0 204.0 56.0 197.0 63.0 192.0 69.0 197.0 69.0 201.0 70.0
voyager.png 302.0 64.0 314.0 60.0 307.0 67.0 306.0 74.0 310.0 73.0 314.0 72.0
voyager.png 390.0 31.0 405.0 28.0 398.0 39.0 393.0 46.0 399.0 44.0 404.0 44.0
voyager.png 257.0 196.0 271.0 198.0 264.0 204.0 257.0 211.0 263.0 210.0 269.0 212.0
voyager.png 306.0 181.0 320.0 180.0 314.0 187.0 309.0 193.0 313.0 192.0 317.0 193.0
voyager.png 144.0 439.0 161.0 440.0 153.0 450.0 146.0 458.0 152.0 458.0 158.0 459.0
voyager.png 252.0 464.0 270.0 463.0 262.0 473.0 256.0 481.0 262.0 479.0 267.0 479.0
voyager.png 345.0 439.0 363.0 437.0 356.0 449.0 351.0 456.0 356.0 455.0 362.0 455.0
puneet.png 59.0 136.0 74.0 136.0 68.0 146.0 62.0 150.0 67.0 150.0 73.0 151.0
@liuliu
liuliu / gist:5369041
Created April 12, 2013 03:15
ccv output on CMU
addams-family.png 81 505 45 45 7.843119
addams-family.png 328 174 50 50 12.569483
addams-family.png 736 552 49 49 8.898903
addams-family.png 659 387 46 46 6.503688
addams-family.png 423 144 55 55 0.090923
addams-family.png 711 87 53 53 6.657643
addams-family.png 138 405 51 51 5.100987
aeon1a.png 161 86 142 142 -0.815429
aerosmith-double.png 272 110 39 39 6.868231
aerosmith-double.png 103 16 42 42 5.516684
#!/usr/bin/env ruby
exit unless ARGV.length == 1
files = Dir.glob(ARGV[0] + '/*.txt')
files.each do |file|
name = nil;
File.new(file).each_line do |line|
next if line[0] == '#'
#!/usr/bin/env ruby
meta = File.new "meta.txt"
synsets = Hash.new
meta.each_line do |line|
dicts = line.split(" ")
synsets[dicts[1].to_s] = dicts[0].to_i;
end
#!/usr/bin/env ruby
meta = File.new "ILSVRC2010_test_ground_truth.txt"
ids = Array.new
i = 0
meta.each_line do |line|
ids << line.to_i
print ids[i].to_s + " test/ILSVRC2010_test_00" + ("%06d" % [i + 1]) + ".JPEG\n"
@liuliu
liuliu / k-mean on histogram.c
Last active September 26, 2016 06:05
k-mean for layer
gsl_rng_env_setup();
gsl_rng* rng = gsl_rng_alloc(gsl_rng_default);
sqlite3* db = 0;
int h[0x10000];
int kc[0x100];
float kmean[0x100];
uint16_t tbl[0x10000];
int i;
for (i = 0; i < 0x10000; i++)
tbl[i] = i;
@liuliu
liuliu / bsi.c
Last active December 11, 2016 04:23
#include <stdio.h>
#include <string.h>
static inline int _ccv_nnc_try_sort_and_insert(int* md, const int ins, const int c)
{
if (!c)
{
md[0] = ins;
return 1;
}
union ptr_splitter {
void *ptr;
uint32_t part[2];
};
static const int default_stack_size = 65536;
typedef struct schd_s schd_t;
typedef struct task_s task_t;
typedef void (*task_fn_t)(task_t *task);
static void deltask(schd_t* const schd, task_t* const t)
{
if (t->prev)
t->prev->next = t->next;
else
schd->head = t->next;
if (t->next)
t->next->prev = t->prev;
else
schd->tail = t->prev;
static void _task_entry_point(uint32_t part0, uint32_t part1)
{
union ptr_splitter p;
p.part[0] = part0;
p.part[1] = part1;
task_t *task = (task_t*)p.ptr;
task->fn(task);
task->done = 1;
swapcontext(&task->schd->callee, &task->schd->caller);
}