- FaceNet (Google)
- They use a triplet loss with the goal of keeping the L2 intra-class distances low and inter-class distances high
- DeepID (Hong Kong University)
- They use verification and identification signals to train the network. Afer each convolutional layer there is an identity layer connected to the supervisory signals in order to train each layer closely (on top of normal backprop)
- DeepFace (Facebook)
- Convs followed by locally connected, followed by fully connected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/local/cuda/bin/nvcc -c file1.cu | |
g++ -c file2.cpp | |
g++ -o test file1.o file2.o -L/usr/local/cuda/lib64 -lcudart | |
./test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np, h5py | |
from collections import defaultdict | |
import os | |
f = h5py.File('wider_face_train.mat','r') | |
event_list = f.get('event_list') | |
print f[event_list.value[0][0]].value.tostring() | |
# for i in range(0, 61): | |
# print f[event_list.value[0][i]].value.tostring() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Jul 6 10:13:27 2016 | |
@author: gene | |
""" | |
import xml.etree.cElementTree as ET | |
import Image | |
import os, glob |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PIL | |
import cv2 | |
from PIL import ImageFont | |
from PIL import Image | |
from PIL import ImageDraw | |
import string | |
import os | |
import shutil | |
import random | |
from collections import defaultdict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob | |
from collections import defaultdict | |
import cv2 | |
import numpy as np | |
import random | |
char2num = { | |
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, | |
'9': 9, 'A': 10, 'B': 12, 'C': 13, 'D': 14, 'E': 15, 'F': 16, 'G': 17, | |
'H': 18, 'I': 19, 'J': 20, 'K': 21, 'L': 23, 'M': 24, 'N': 25, 'O': 26, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mnist import MNIST | |
import numpy as np | |
import lmdb | |
import caffe | |
mndata = MNIST('./data') | |
count = 0 | |
env = lmdb.open('mnist_lmdb', map_size=1000*1000*1000) | |
txn = env.begin(write=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import struct | |
from array import array | |
import numpy as np | |
class MNIST(object): | |
def __init__(self, path='.'): | |
self.path = path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mnist import MNIST | |
import numpy as np | |
import cv2 | |
import lmdb | |
import caffe | |
mndata = MNIST('./data') | |
images, labels = mndata.load_training() | |
labels = np.array(labels) | |
images = np.array(images).reshape(len(labels), 28, 28).astype(np.uint8) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import caffe | |
import numpy as np | |
# http://stackoverflow.com/questions/33828582/vgg-face-descriptor-in-python-with-caffe | |
img = caffe.io.load_image( "ak.png" ) | |
img = img[:,:,::-1]*255.0 # convert RGB->BGR | |
avg = np.array([129.1863,104.7624,93.5940]) | |
img = img - avg # subtract mean (numpy takes care of dimensions :) | |
img = img.transpose((2,0,1)) | |
img = img[None,:] # add singleton dimension | |
net = caffe.Net("VGG_FACE_deploy.prototxt","VGG_FACE.caffemodel", caffe.TEST) |