Skip to content

Instantly share code, notes, and snippets.

@yassersouri
yassersouri / sampler.py
Created February 19, 2018 22:35
PyTorch Sampler for Intensional Overfitting!
from torch.utils.data.sampler import Sampler
class MySampler(Sampler):
def __init__(self, main_source, indices):
self.main_source = main_source
self.indices = indices
main_source_len = len(self.main_source)
how_many = int(round(main_source_len / len(self.indices)))
@yassersouri
yassersouri / README.md
Created December 2, 2015 11:48 — forked from SNagappan/README.md
bAbI

##Model

This is an implementation of Facebook's baseline GRU/LSTM model on the bAbI dataset Weston et al. 2015. It includes an interactive demo.

The bAbI dataset contains 20 different question answering tasks.

Model script

The model training script train.py and demo script demo.py are included below.

Instructions

@yassersouri
yassersouri / add_monitor_resolution.sh
Created February 13, 2015 17:51
Add new monitor resolution to ubuntu
# change 1280*768 to what ever your monitor and computer must support but does not!
cvt 1280 768 60
# 1280x768 59.87 Hz (CVT) hsync: 47.78 kHz; pclk: 79.50 MHz
# Modeline "1280x768_60.00" 79.50 1280 1344 1472 1664 768 771 781 798 -hsync +vsync
# change based on what was printed after the previous command
xrandr --newmode "1280x768_60.00" 79.50 1280 1344 1472 1664 768 771 781 798 -hsync +vsync
xrandr --addmode VGA1 "1280x768_60.00"
@yassersouri
yassersouri / How to visualize the ILSVRC mean image.md
Last active September 6, 2016 20:57
How to visualize the ILSVRC mean image

I had an issue with how to visualize the ILSVRC mean image. I just wanted to look at it and see how much does it differ from using pixel-wise mean subtraction instead of image-wise mean subtraction.

I assume that you have already downloaded the CaffeNet pretrained and model definition files.

The trick is to initialize two networks, one with mean file set (called net_mean) and the other one without mean file (called net). Then create a fake all 1 image. Use the net_mean to preprocess the fake image for data layer and save the result as fake_pre. Then use the net to deprocess fake_pre for data layer and save it as fake_re. If the two networks net and net_mean were the same then fake_re would be equal to fake, but since we have not set any mean file for net then we can visualize the mean image using 1 - fake_re. Take a look at the code.

The result looks like this:

![ILSVRC mean image](https://gist.github.com/yassersouri/f617bf7eff9172290b4f/raw/863971c47470204234017b91196b5e94a6fe

###Download XCode from the App Store Get it from here

###Get cmake Use/get a package manager, such as homebrew. Open a terminal window and type the following

brew install cmake

This will get the required packages for cmake.

@yassersouri
yassersouri / Assignments Latex Template.md
Last active November 8, 2021 03:46
Assignments Latex template.

##Assignments Latex Template

###V 0.1

I always wanted some latex template that I could use for assignments. But none of the templates I found online had all the features I wanted. So the natural next step for me was to create one.

###Notes:

  • Use with XeLaTeX
@yassersouri
yassersouri / flare.json
Last active December 18, 2015 14:19 — forked from mbostock/.block
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{"name": "AgglomerativeCluster", "size": 3938},

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@yassersouri
yassersouri / Default (OSX).sublime-keymap
Created March 14, 2013 06:03 — forked from idan/Default (OSX).sublime-keymap
add the 1-2 layout to sublime text. Add these files with these file names to /Users/$ACCOUNTNAME$/Library/Application\ Support/Sublime\ Text\ 3/Packages/User
[
{
"keys": ["super+alt+shift+5"],
"command": "set_layout",
"caption" : "1-2 Grid",
"args":
{
"cols": [0.0, 0.5, 1.0],
"rows": [0.0, 0.5, 1.0],
"cells":
@yassersouri
yassersouri / mexopts.sh
Created February 15, 2013 11:19
`~/.matlab/R2012a/mexopts.sh` for Mac OS X 10.8 with homebrew. via <http://bastibe.de/matlab-mex-homebrew-and-os-x-108-mountain-lion.html>
#
# mexopts.sh Shell script for configuring MEX-file creation script,
# mex. These options were tested with the specified compiler.
#
# usage: Do not call this file directly; it is sourced by the
# mex shell script. Modify only if you don't like the
# defaults after running mex. No spaces are allowed
# around the '=' in the variable assignment.
#
# Note: For the version of system compiler supported with this release,