Skip to content

Instantly share code, notes, and snippets.

View ilyakava's full-sized avatar

Ilya Kavalerov ilyakava

View GitHub Profile
@ilyakava
ilyakava / KSC_hsi_fix.m
Last active March 27, 2023 02:00
matlab hsi data reading from raster file for KSC
% // References:
% // http://www.ehu.eus/ccwintco/uploads/d/dc/LoadHypercubesMatlab.pdf
% data can be downloaded from:
% http://www.csr.utexas.edu/hyperspectral/data/KSC/KSC_data.bin
% http://www.csr.utexas.edu/hyperspectral/data/KSC/KSC_data.bin.hdr
% compare
% cd /scratch0/ilya/locDoc/data/hyperspec/datasets/
im = multibandread('KSC_data.bin', [512 614 176], 'uint16', 0, 'bsq', 'ieee-le');

Getting a linux virtual environment with GPU access on Windows 10

WSL2 with Ubuntu 18.04 and NVidia containers (tf 1.15)

  • Follow these directions, everything before "Set up Python environment"
    • Choose Ubuntu 18.04
  • Follow some sections in these directions
    • Do "Setting up CUDA Toolkit"
    • In "Running CUDA Applications", try to cd /usr/local/cuda/samples/0_Simple/matrixMulCUBLAS/, make, and ./matrixMulCUBLAS
  • Do "Setting up to Run Containers"
@ilyakava
ilyakava / manual_warm_start.py
Created July 22, 2020 01:15
Tensorflow 1.15 manual warm start
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
<!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 October 8, 2021 15:09
Bloomberg terminal like appearance for iTerm
{
"Horizontal Spacing" : 0.80000000000000004,
"Tags" : [
],
"Ansi 12 Color" : {
"Green Component" : 0.3333333432674408,
"Red Component" : 0.3333333432674408,
"Blue Component" : 1
},
// 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;
  • 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
# 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 January 8, 2016 02:26
Some names and works mentioned in Quack this Way
@ilyakava
ilyakava / caffe_struggles.py
Created September 30, 2015 13:00
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).
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))