Skip to content

Instantly share code, notes, and snippets.

Ilya Kavalerov ilyakava

Block or report user

Report or block ilyakava

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View convnetjs_XOR.js
// http://cs.stanford.edu/people/karpathy/convnetjs//demo/classify2d.html
(function xor_data(){
data = [];
labels = [];
data.push([0 , 0 ]); labels.push(0);
data.push([1 , -1 ]); labels.push(0);
data.push([0 , -1 ]); labels.push(1);
data.push([1 , 0 ]); labels.push(1);
N = labels.length;
View vocab-2016-07-27.md
  • importunate: adj. expressing earnest entreaty
  • convalescence: noun gradual healing (through rest) after sickness or injury
  • Copse: noun a dense growth of bushes
  • anfractuous: adj. full of twists and turns
  • Agnate: adj. related on the father's side; noun one related on the father's side
  • Sub-rosa: adj. designed and carried out secretly or confidentially
  • soused: adj. very drunk; wet from being plunged into liquid
  • Abulia: noun a loss of will power
  • Screed: noun an accurately levelled strip of material placed on a wall or floor as guide for the even application of plaster or concrete; a long piece of writing; a long monotonous harangue
  • Probity: noun complete and confirmed integrity; having strong moral principles
View ffmpeg_tricks.sh
# to cut first 3 seconds and length 8 seconds (custom step done for each file)
ffmpeg -ss 3 -t 8 -i VID00080.MP4 -vcodec copy -acodec copy white.MP4
# to burn in the timecode (r=framerate) (use in loop like below)
# ffmpeg -i $MOVIE -vf "drawtext=fontfile=/Users/artsyinc/Library/Fonts/PxPlus_VGA_SquarePx.ttf: fontsize=128: timecode='00\:00\:00\:00': r=30: x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1" timecode/$MOVIE
# to speed up
for MOVIE in $(ls | grep MP4);
do LENGTH=$(ffprobe -i $MOVIE -show_format -loglevel quiet | egrep -oE 'duration=(\d+)' | awk -F= '{print $2}');
RATIO=$(echo 7.0/$LENGTH | bc -l);
@ilyakava
ilyakava / Quack This Way - names.md
Created Jan 8, 2016
Some names and works mentioned in Quack this Way
View Quack This Way - names.md
@ilyakava
ilyakava / caffe_struggles.py
Created Sep 30, 2015
Cannot copy param 1 weights from layer 'conv1'; shape mismatch. Source param shape is 1 1 1 96 (96); target param shape is 96 (96).
View caffe_struggles.py
import numpy as np
import caffe
MODEL_FILE = '../val.prototxt'
PRETRAINED = '../food_alexnet_train_iter_25000.caffemodel'
IMAGE_MEAN = '../imagenet_mean.binaryproto'
INPUT_IMAGE = '~/code/fundus/data/train/cent_crop_227/1000016.png'
net = caffe.Classifier(MODEL_FILE, PRETRAINED, image_dims=(256,256))
# net = caffe.Classifier(MODEL_FILE, PRETRAINED, image_dims=(227,227))
View occlusion_heatmap.py
import matplotlib
matplotlib.use('Agg')
from skimage.io import imread
matplotlib.rcParams.update({'font.size': 2})
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import AxesGrid
import sys
import numpy as np
import scipy.ndimage as nd
View imagenet_for_nn.sh
# assumes the images have been downloaded from imagenet and are named:
# bird.tar car.tar circle.tar flower.tar horse.tar house.tar mountain.tar tree.tar woman.tar
TAGS=( car tree circle house mountain bird flower horse woman )
# total=7577
LIMS=( 738 797 836 839 849 853 856 895 914 )
# list contents of tarballs and shave off file extension
for tag in "${TAGS[@]}"; do tar -tf $tag.tar | sed 's/.JPEG$//' > $tag.txt; done
# append my chosen class numbers for each class (hand is the missing #2)
@ilyakava
ilyakava / epub.sh
Created Aug 2, 2015
Input an arg of a file of a list of links, get an output.epub of all those webpages concatenated
View epub.sh
#!/bin/bash
COUNT=1
for link in $(cat $1)
do
wget -O - -o /dev/null $link | iconv -f iso8859-1 -t utf-8 > $COUNT.html
COUNT=$(echo $COUNT + 1 |bc)
done
View time.cu
#include <stdio.h>
#include <stdlib.h>
#define BLOCK_WIDTH 1000
void print_array(int *array, int size)
{
printf("{ ");
for (int i = 0; i < size; i++) { printf("%d ", array[i]); }
printf("}\n");
View mlp.py
"""
This tutorial introduces the multilayer perceptron using Theano.
A multilayer perceptron is a logistic regressor where
instead of feeding the input to the logistic regression you insert a
intermediate layer, called the hidden layer, that has a nonlinear
activation function (usually tanh or sigmoid) . One can use many such
hidden layers making the architecture deep. The tutorial will also tackle
the problem of MNIST digit classification.
You can’t perform that action at this time.