Skip to content

Instantly share code, notes, and snippets.

View ColeMurray's full-sized avatar

Cole Murray ColeMurray

View GitHub Profile
@ColeMurray
ColeMurray / cnn_estimator.py
Last active November 28, 2018 07:00
Code to create a tensorflow estimator for a multi-task network
import tensorflow as tf
from age_gender_estimation_tutorial.cnn_model import network
def model_fn(features, labels, mode, params):
"""
Creates model_fn for Tensorflow estimator. This function takes features and input, and
is responsible for the creation and processing of the Tensorflow graph for training, prediction and evaluation.
@ColeMurray
ColeMurray / cnn_model.py
Last active November 29, 2018 07:08
A simple convolutional network architecture for predicting age and gender with a shared architecture
import tensorflow as tf
def network(feature_input, labels, mode):
"""
Creates a simple multi-layer convolutional neural network
:param feature_input:
:param labels:
:param mode:
@ColeMurray
ColeMurray / download-imdb-crop.sh
Last active July 15, 2022 17:19
Downloads imdb crop dataset
#!/usr/bin/env bash
if [[ ! -d "data" ]]
then
mkdir "data"
fi
curl https://data.vision.ee.ethz.ch/cvl/rrothe/imdb-wiki/static/imdb_crop.tar -O
tar -xzvf imdb_crop -C data
@ColeMurray
ColeMurray / preprocess_imdb.py
Last active November 26, 2018 21:32
Script to preprocess Imdb dataset to csv
import argparse as argparse
import csv
import os
import random
from datetime import datetime
import cv2
import numpy as np
from scipy.io import loadmat
from tqdm import tqdm
@ColeMurray
ColeMurray / download_model.py
Created March 29, 2018 06:19
Downloads weights for show and tell image caption model from Google Drive
import argparse
import logging
import os
import zipfile
import requests
model_dict = {
'show-and-tell-2M': '1RG2xggrl4rc8tKlZQt-G-ihX7ln8N3-p'
}
@ColeMurray
ColeMurray / lfw_input.py
Created August 7, 2017 16:04
Tensorflow queues to load lfw datset
import logging
import os
import numpy as np
import tensorflow as tf
from tensorflow.python.framework import ops
logger = logging.getLogger(__name__)
@ColeMurray
ColeMurray / train_classifier.py
Created August 6, 2017 04:58
Train facial recognition classifier
import argparse
import logging
import os
import pickle
import sys
import time
import numpy as np
import tensorflow as tf
from sklearn.svm import SVC
@ColeMurray
ColeMurray / preprocess.py
Created August 6, 2017 02:05
Preprocess images of faces using dlib
import argparse
import glob
import logging
import multiprocessing as mp
import os
import time
import cv2
from medium_facenet_tutorial.align_dlib import AlignDlib
@ColeMurray
ColeMurray / download_and_extract_model.py
Created August 5, 2017 21:00
download facenet weights
import argparse
import logging
import os
import requests
import zipfile
"""
This file is copied from:
https://github.com/davidsandberg/facenet/blob/master/src/download_and_extract_model.py
@ColeMurray
ColeMurray / Dockerfile
Created August 3, 2017 03:20
Tensorflow opencv dlib
FROM tensorflow/tensorflow:latest
RUN apt-get update -y --fix-missing
RUN apt-get install -y ffmpeg
RUN apt-get install -y build-essential cmake pkg-config \
libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev \
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
libxvidcore-dev libx264-dev \
libgtk-3-dev \
libatlas-base-dev gfortran \