Skip to main content

Image classification using tensorflow.

Project description

Image classification (not object detection) using tensorflow.

Based on example code located here:

https://www.tensorflow.org/hub/tutorials/image_retraining

Installation

  • install virtual environment:

    virtualenv -p /usr/bin/python3.7 venv
  • install dependencies:

    ./venv/bin/pip install -r requirements.txt
  • install tensorflow (1.x or 2.x works)

    • with GPU (1.x):

      ./venv/bin/pip install "tensorflow-gpu<2.0.0"
    • with GPU (2.x):

      ./venv/bin/pip install "tensorflow-gpu>=2.0.0"
    • CPU only (1.x):

      ./venv/bin/pip install "tensorflow<2.0.0"
    • CPU only (2.x):

      ./venv/bin/pip install "tensorflow>=2.0.0"
  • install library

    • via pip:

      ./venv/bin/pip install wai.tfimageclass
    • from source (from within the directory containing the setup.py script):

      ./venv/bin/pip install .

Usage

All scripts support –help option to list all available options.

Train

  • For training, use module wai.tfimageclass.train.retrain or console script tfic-retrain

  • For evaluating a built model, use module wai.tfimageclass.train.stats or console script tfic-stats

Training data

All the data for building the model must be located in a single directory, with each sub-directory representing a label. For instance for building a model for distinguishing flowers (daisy, dandelion, roses, sunflowers, tulip), the data directory looks like this:

|
+- flowers
   |
   +- daisy
   |
   +- dandelion
   |
   +- roses
   |
   +- sunflowers
   |
   +- tulip

Predict

Once you have built a model, you can use it as follows:

  • For making predictions for a single image, use module wai.tfimageclass.predict.label_image or console script tfic-labelimage

  • For polling images in a directory and making continous predictions with CSV companion files, use module wai.tfimageclass.predict.poll or console script tfic-poll

Changelog

0.0.1 (2019-11-01)

  • initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wai.tfimageclass-0.0.1.tar.gz (24.1 kB view details)

Uploaded Source

File details

Details for the file wai.tfimageclass-0.0.1.tar.gz.

File metadata

  • Download URL: wai.tfimageclass-0.0.1.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.3

File hashes

Hashes for wai.tfimageclass-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ce4b283506994877538307bc452b48548b5bcdb72012ce20fe4f146557c2dadd
MD5 52539b7569a3a26d46b0f542b19a7764
BLAKE2b-256 c0fa960acb4f27e0d24a771662da2b6261bf56e36c953f0660e4b97726eb3b3b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page