Skip to content

Instantly share code, notes, and snippets.

@abearman
Last active March 9, 2018 17:44
Show Gist options
  • Save abearman/58f24d821d75bc1bf7df6bef91aa7bfe to your computer and use it in GitHub Desktop.
Save abearman/58f24d821d75bc1bf7df6bef91aa7bfe to your computer and use it in GitHub Desktop.

Places or Faces?

To view this file in your browser, visit this link.

Problem definition

You are provided a set of images. These images may belong to either of these classes:

  1. Portraits or faces of people. The object in focus is a person or several people.

  2. Images of landscapes, mountains, city skylines, buildings, monuments, etc.

Your task: Build a model to identify the two classes of images as 'face' or 'place' respectively.

The data

You have a directory of images, images/, which contains all of the .jpg images in the train and test set. In case you don't have this directory, the zip file can be downloaded here.

  • gt_train.pkl is a Python pickle file containing the images and ground-truth labels in the training set. It contains a dictionary where the keys is the base filename of an image (e.g., img_792.jpg) and the corresponding values are binary numbers (0 or 1) where 0 = place and 1 = face.

  • gt_test.pkl is a Python pickle file containing the images and ground-truth labels in the test set. It is organized in the same fashion as the training set. Due to the brevity of this interview, you will be able to evaluate your model on the test set right away.

Starter code

  • starter.py contains some code to train and evaluate a basic model. It will run right away. Check out the main method: from main(), you can run either train_model() or test_model(<WEIGHTS_FILE>) to train or test a model, respectively, where WEIGHTS_FILE is a Keras .hdf5 saved model.

You are welcome to use the starter code starter.py -- however, it contains many errors! (Not syntax errors or things inherently designed to trip you up, but rather mistakes that a naive AI practitioner might implement). If you would prefer to start afresh, you may disregard the starter code. There are no pre-trained models contained in the starter code. Just make sure to include all of your code in the places-or-faces/ directory.

Using the GPU

You will have access to a GPU for training and running your models (if you wish to use it). The Alienware laptop has one GTX 1080 GPU on it. Run the command nvidia-smi to view the available GPU.

Our GPUs have TensorFlow, Keras, and scikit-learn installed already (and libraries like NumPy, SciPy, etc). You may download other libraries using a virtual environment, if needed. TensorFlow and Keras are set up to automatically use the GPU.

Using the internet

Please feel free to look up anything online, just document your sources if you use others' code. There is no need to cite documentation.

In this line, transfer learning from pre-trained models is allowed.

Deliverables

  • Your code, written in starter.py or elsewhere.
  • Accuracy scores on the training/validation set and test set
  • A simple bullet point list of (1) things you implemented and (2) things you would like to try, given more time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment