Skip to content

Instantly share code, notes, and snippets.

View bobye's full-sized avatar

Jianbo Ye bobye

View GitHub Profile
@bobye
bobye / evaluate_signal.ipynb
Last active June 29, 2023 15:12
evaluate_signal.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
name: "CIFAR10_full"
layer {
name: "cifar"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
#!/usr/bin/perl -w -CS
use feature 'unicode_strings';
binmode( STDIN, ':utf8' );
binmode( STDOUT, ':utf8' );
## Condition plain text English sentences or word lists into a form suitable for constructing a vocabulary and language model
while (<STDIN>) {
@bobye
bobye / gist:3c64c2a03a53ce17bfc0
Created December 17, 2015 19:24
create_ohsumed.sh
#!/bin/sh
#wget http://disi.unitn.it/moschitti/corpora/ohsumed-all-docs.tar.gz
#tar xvf ohsumed-all-docs.tar.gz
cd ohsumed-all
filename=ohsumed_clusters.txt
rm -f $filename
for category in C*; do
echo %%%$category >> $filename
for abstract in $category/*; do
tr '\n' ' ' < $abstract | ../tocorpus.pl >> $filename
@bobye
bobye / prep_img_set.py
Created April 3, 2015 02:18
prep_img_set.py
import os
import Image
import glob
import numpy
def is_grey_scale(img_path="lena.jpg"):
im = Image.open(img_path).convert('RGB')
w,h = im.size
for i in range(w):
for j in range(h):
@bobye
bobye / post_evaluate.matlab
Last active August 29, 2015 14:18
post_evaluate.matlab
% select img_id,artist_id from images into outfile '/tmp/art_wiki_img2artist.csv';
% select task_id,artist_id from tasks into outfile '/tmp/art_wiki_task2artist.csv';
% select usr_id,task_id,chosen from events where usr_id ='admin' into outfile '/tmp/art_wiki_admin.csv' ;
t2a=load('art_wiki_task2artist.csv');
i2a=load('art_wiki_img2artist.csv');
username={'admin', 'fei', 'chenl', 'yukun', 'xinlu'};
#include <stdio.h>
int dmf(int *a, int n) {
int *I = new int[n];
int k=0;
for (int i=0; i<n; ++i) {
if (a[i] <= a[k]) {
k = i; }
I[i] = k;
}
@bobye
bobye / mArray.hpp
Created June 18, 2013 05:47
multidimensional array of C++
#ifndef _MARRAY_H_
#define _MARRAY_H_
#include <fstream>
#include <iostream>
#include "cv.h"
namespace BSPL {
// 1D array class with overloading operations
template <class T, int Size>
@bobye
bobye / compute_weights.matlab
Last active December 11, 2015 03:18
compute blend weights offline
%% load std_expr captured data
clear;
dof=24;
header_file = fopen('start_frame.txt');%set header information file
i = 0;
while (1)
[name, count]= fscanf(header_file, '%s',1);
if (count ==0)
break;
end
@bobye
bobye / u1204conf
Created August 17, 2012 14:57
Ubuntu 12.04 LTS configuration memo
1. Installation
It is recommended to have a partition at the start of disk, mounted at /boot/
For multiple system boots, boot-repair is very useful. My machine have two disks, one for Windows and one for Linux. I choose the later one as boot device when reparing boots.
2. Basics (step by step)
- time setting in Windows. (for multiple systems installed)
- install Dropbox and Google Drive(Insync) & sync
- install ssh, git & configure GitHub for new machine
[[https://help.github.com/articles/generating-ssh-keys]]
- dot.bashrc, import configuration from github