Skip to content

Instantly share code, notes, and snippets.

Youssef Kashef kashefy

  • Berlin, Germany
Block or report user

Report or block kashefy

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
kashefy / rename_img_files
Created Jun 16, 2015
traversing subdirectories and renaming image files with strange windows-specific character
View rename_img_files
Created on Jun 16, 2015
@author: kashefy
import argparse
import os
def list_paths(root_path):
kashefy / val_59.txt
Created Aug 7, 2015
Entities from the PASCAL-Context db assigned to the validation set. Obtained from
View val_59.txt
kashefy /
Created Sep 29, 2015
file system utilities
import os
def gen_paths(dir_src, func_filter=None):
if func_filter is None:
def func_filter(fileName):
return True
dst = []
# Installing Caffe dependencies without sudo privileges:
# The prefix serves as the installation directory for caffe dependencies
# that are not already installed on the system
# Set "inputs" according to host machine
export PREFIX_HOST=/mnt/scratch/$USER/caffe_deps
export PREFIX_CUDNN=$PREFIX_HOST/../build/cudnn-7.5
kashefy /
Created Jan 13, 2016
2d convolution using numpy
Created on Jul 13, 2015
@author: kashefy
import numpy as np
from scipy import signal
if __name__ == '__main__':
View print_caffe_blob.cpp
template <typename Dtype>
void printMat(const Dtype* data, int rows, int cols) {
int j = 0;
for (int r=0; r<rows; r++) {
for (int c=0; c<cols; c++) {
if (c<cols-1) std::cout<<",";
kashefy / mnist_ae_tied_weights_trainval.prototxt
Last active Jan 29, 2016
network definition for an Auto-encoder with tied weights. The weight are tied by sharing parameter names in 'permissive mode' and setting the decoder's ip params to use tranposed weigts.
View mnist_ae_tied_weights_trainval.prototxt
name: "MNISTAutoencoderTiedWeights"
layer {
name: "mnist"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
transform_param {
kashefy / 59_labels.txt
Last active Feb 20, 2016
The 59 labels subset for PASCAL Context dataset. Originally from here:
View 59_labels.txt
1: aeroplane
2: bicycle
3: bird
4: boat
5: bottle
6: bus
7: car
8: cat
9: chair
10: cow
kashefy /
Last active May 26, 2016
downsample sound files using ffmpeg
def is_wav(p):
return os.path.splitext(p)[-1] == '.wav'
def lower_samplerate_cmds(dir_src, samplerate, dir_dst, fpath_exec_script):
paths = fs.gen_paths(dir_src, is_wav)
commands = []
for fpath in paths:
path_dst = os.path.join(dir_dst, os.path.basename(fpath))
kashefy /
Last active Jul 29, 2016
Moving average for a time series
import numpy as np
def moving_avg(x, window_size):
window = np.ones(int(window_size)) / float(window_size)
return np.convolve(x, window, 'valid')
You can’t perform that action at this time.