GithubHelp home page GithubHelp logo

pex-tech-challenge's Introduction

Pex-tech-challenge

Goal

  1. To create a dataset of indoor and outdoor images

  2. To train a model to identify images as belonging to the indoor or outdoor class

  3. To build a CLI tool to input images one by one, and for the tool to predict the class that the image belongs to

Methodology

I used the script from this codebase to extract relevant videos from the YouTube-8m dataset. The categories I queried for indoor images were Room, Bedroom, Classroom, Office, Gym, Couch, Cooking, and Chair. The categories I queried for outdoor images were Beach, Landscape, Skyscraper, Mountain, Hiking, Skiing, Weather, and Thunderstorm. After obtaining these videos, I extracted 5 frames from each video to create a dataset of images.

I used a pretrained VGG16 model, excluding the fully connected layers. Instead, I added fully connected layers of my own, and trained only those layers on the dataset that I had collected. Due to the lack of compute power on my local machine, I trained it only for 5 epochs. I was able to obtain a validation accuracy of 79.92%.

I then created a command line tool called "mytool", which would take an image path as an argument, and would output whether the image was taken indoors or outdoors.

Running the code

  1. Install python 2.7
  2. Install virtualenv
  3. Clone this repository
  4. cd into this repository
  5. Create a virtual environment
  6. Run pip install -r requirements.txt
  7. Run python setup.py install
  8. Run mytool --img img_name where img_name is the path to an image of your choice

Important notes

The main source code is contained in the 'src' directory

utils.py was used to create the dataset. It was run as python utils.py indoor or python utils.py outdoor depending upon the data I was creating.

model.py contains the code for training the deep learning model. It took no other arguments, and simply ran with 'python model.py'

unit_test.py contains a few test units that I wrote

All the data related content is contained in the 'data' directory

It contains a directory titled photos, which contains the dataset I created.

It was in this folder that I had two other folders, each containing the indoor and outdoor videos respectively. Due to the size of the videos, I did not upload them onto github.

It also has two bash scripts, which were used to make the data processing more convenient.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.