Skip to content

Instantly share code, notes, and snippets.

@sidgan
sidgan / gist:2a61575c6027262f80e4036696dc1cea
Last active January 29, 2018 04:19 — forked from ttezel/gist:4138642
Natural Language Processing Notes

#A Collection of NLP notes

##N-grams

###Calculating unigram probabilities:

P( wi ) = count ( wi ) ) / count ( total number of words )

In english..

@sidgan
sidgan / pascalvoc.py
Created November 2, 2017 22:46 — forked from kastnerkyle/pascalvoc.py
Wrapper to read pascal voc data
# Author: Kyle Kastner # License: BSD 3-Clause # For a reference on parallel processing in Python see tutorial by David Beazley # http://www.slideshare.net/dabeaz/an-introduction-to-python-concurrency # Loosely based on IBM example # http://www.ibm.com/developerworks/aix/library/au-threadingpython/ # If you want to download all the PASCAL VOC data, use the following in bash... """ #! /bin/bash # 2008 wget http://host.robots.ox.ac.uk/pascal/VOC/voc2008/VOCtrainval_14-Jul-2008.tar # 2009 wget http://host.robots.ox.ac.uk/pascal/VOC/voc2009/VOCtrainval_11-May-2009.tar # 2010 wget http://host.robots.ox.ac.uk/pascal/VOC/voc2010/VOCtrainval_03-May-2010.tar # 2011 wget http://host.robots.ox.ac.uk/pascal/VOC/voc2011/VOCtrainval_25-May-2011.tar # 2012 wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar # Latest devkit wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCdevkit_18-May-2011.tar """ try: import Queue except ImportError: import queue as Queue import threading import ti
@sidgan
sidgan / file
Created September 17, 2017 18:37
import cv2
import string, random
vc = cv2.VideoCapture(0)
if vc.isOpened(): # try to get the first frame
rval, frame = vc.read()
else:
rval = False
@sidgan
sidgan / nn4.py
Last active September 4, 2017 19:03
nn4 architecture for facenet implementation by David Sandberg
# MIT License
#
# Copyright (c) 2016 David Sandberg
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@sidgan
sidgan / ssd_keras2.py
Created August 23, 2017 23:32
ssd.py in for keras 2.0
"""Keras implementation of SSD."""
import keras.backend as K
from keras.layers import Activation
from keras.layers import AtrousConv2D
from keras.layers import Conv2D
from keras.layers import Dense
from keras.layers import Flatten
from keras.layers import GlobalAveragePooling2D
from keras.layers import Input
@sidgan
sidgan / printing-model-neuraltalk2
Created June 27, 2017 21:36
printing-model-neuraltalk2
[?1034h{
protos :
{
cnn :
{
gradInput : FloatTensor - empty
modules :
{
1 :
{
#####
# modifiled from https://github.com/Hvass-Labs/TensorFlow-Tutorials/blob/master/06_CIFAR-10.ipynb
#####
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
from sklearn.metrics import confusion_matrix
import time
from datetime import timedelta
import math
@sidgan
sidgan / gist:75cb2a53b065549e1cf3c1b42988033c
Created October 8, 2016 16:59 — forked from rygorous/gist:9124356
On "Understanding Sources of Inefficiency in General-Purpose Chips"
My problems with the paper:
- There is no comparison of resulting video quality. The amount of encode time (and power
expended) to produce a H.264 bit stream *dramatically* depends on the desired quality level;
e.g. for x264 (state of the art SW encoder, already in 2010 when the paper was written), the
difference between the fastest and best quality settings is close to 2 orders of magnitude
in both speed and power use. This is not negligible!
[NOTE: This is excluding quality-presets like "placebo", which are more demanding still.
Even just comparing between different settings usable for real-time encoding, we still have
at least an order of magnitude difference.]
- They have their encoder, which is apparently based on JM 8.6 (*not* a good encoder!), for
@sidgan
sidgan / KeyValueMemNN.md
Created July 5, 2016 21:52 — forked from shagunsodhani/KeyValueMemNN.md
Summary of paper "Key-Value Memory Networks for Directly Reading Documents"

Key-Value Memory Networks for Directly Reading Documents

Introduction

  • Knowledge Bases (KBs) are effective tools for Question Answering (QA) but are often too restrictive (due to fixed schema) and too sparse (due to limitations of Information Extraction (IE) systems).
  • The paper proposes Key-Value Memory Networks, a neural network architecture based on Memory Networks that can leverage both KBs and raw data for QA.
  • The paper also introduces MOVIEQA, a new QA dataset that can be answered by a perfect KB, by Wikipedia pages and by an imperfect KB obtained using IE techniques thereby allowing a comparison between systems using any of the three sources.
  • Link to the paper.

Related Work

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: