Skip to content

Instantly share code, notes, and snippets.

Avatar

Ilya Kavalerov ilyakava

View GitHub Profile
@ilyakava
ilyakava / manual_warm_start.py
Created Jul 22, 2020
Tensorflow 1.15 manual warm start
View manual_warm_start.py
warm_starts = sorted(glob.glob(args.warm_start_from)) if args.warm_start_from is not None else None
warm_start_from = warm_starts[-1] if (warm_starts is not None and len(warm_starts)) else None
warm_start_from = os.path.join(warm_start_from, 'variables/variables')
id_assignment_map = {}
for myvar in tf.contrib.framework.get_variables_to_restore():
myscope = os.path.dirname(myvar.name)
if len(myscope):
myscope += '/'
id_assignment_map[myscope] = myscope
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Ilya Kavalerov</title>
</head>
<body>
<h1>Ilya Kavalerov</h1>
<img src="ilyak/headshot.jpg" width="300" height="300">
<h2>PhD Candidate at University of Maryland, College Park, Department of Electrical and Computer Engineering</h2>
<p>Advised by <a href="http://users.umiacs.umd.edu/~rama/people.html">Professor Rama Chellappa</a>, and <a href="https://www.math.umd.edu/~czaja/">Professor Wojciech Czaja</a></p>
@ilyakava
ilyakava / bbg_iterm.json
Last active Apr 24, 2020
Bloomberg terminal like appearance for iTerm
View bbg_iterm.json
{
"Horizontal Spacing" : 0.80000000000000004,
"Tags" : [
],
"Ansi 12 Color" : {
"Green Component" : 0.3333333432674408,
"Red Component" : 0.3333333432674408,
"Blue Component" : 1
},
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)
You can’t perform that action at this time.