Coder Social home page Coder Social logo

zenfenan / tf_box_classify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wwoo/tf_box_classify

0.0 1.0 0.0 37.35 MB

A simple TensorFlow example for training CNN models using input queues and labelled JPEGs

Python 13.38% HTML 1.56% C++ 3.75% Protocol Buffer 0.20% Jupyter Notebook 81.11%

tf_box_classify's Introduction

Classifying boxes using TensorFlow

This is a simple example of how to build a convolutional neural network (CNN) with TensorFlow. It extends existing MNIST convnet examples with TensorFlow input queues for reading training and validation data in common image formats like JPEG. You should be able to easily change the sample code and text files to use your own training data.

Link to YouTube Video

The sample training data and code classifies images of a toy box into four states:

  1. Upright (box is upright)
  2. Tilted (box is tilted on its side)
  3. Open (box is upright and open)
  4. Spilled (box is tilted on it's side, open with contents spilled)

115 images for each class is used to train the model.

tf_convnet_test.ipynb is a Jupyter notebook which runs through the training example.

The main code samples are:

tf_convnet_test.py reads the training and validation data from train.txt and valid.txt, then builds and executes the TensorFlow graph. Run it with no arguments:

python tf_convnet_test.py

tf_convnet_export.py does all the above, and also exports the trained model. You'll need to install or build TensorFlow Serving to run this. Run it with no arguments:

python tf_convnet_export.py

tf_convnet_inference.cc serves the trained TensorFlow Serving. You'll need to install or build TensorFlow Serving to compile it. The code is slightly modified from the MNIST inference sample included with the TensorFlow SDK, most notably changing the shape of the input data and number of output classes. Run it by specifying the port and location of the exported model.

tf_convnet_inference --port=9000 location/to/model/dir/

web_server.py is a simple Flask application that takes images using a webcam and sends them to the inference server for classification. It has only been "tested" on Chrome. Run it with no arguments:

python web_server.py

I don't have a pattern for the box, but if you want to build your own, it is

  • 50x50x50mm
  • made of balsa wood
  • has white electrical tape on the sides to hold it together
  • has an articulating "lid"
  • filled coloured pom poms on the inside
  • marked on four sides with a "this side up" decal

tf_box_classify's People

Watchers

 avatar

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.