Giter VIP home page Giter VIP logo

tensorflow-input-pipeline's Introduction

TensorFlow-Input-Pipeline

Input Pipeline Examples based on multi-threads and FIFOQueue in TensorFlow, including mini-batching training.

Graphs

Graph for small dataset example code

image

Graph for big dataset example code

image

Usage

If your dataset is too large to load once, you can first convert your dataset to TFRecords files, my example code shows how to write data into TFRecords and how to read data from TFRecords correctly. You can run the example code python big_input.py:

usage: small_input.py [-h] [--scale SCALE] [--logdir LOGDIR]
                      [--samples_num SAMPLES_NUM] [--time_length TIME_LENGTH]
                      [--feature_size FEATURE_SIZE] [--num_epochs NUM_EPOCHS]
                      [--batch_size BATCH_SIZE] [--num_classes NUM_CLASSES]

optional arguments:
  -h, --help            show this help message and exit
  --scale SCALE         specify your dataset scale
  --logdir LOGDIR       specify the location to store log or model
  --samples_num SAMPLES_NUM
                        specify your total number of samples
  --time_length TIME_LENGTH
                        specify max time length of sample
  --feature_size FEATURE_SIZE
                        specify feature size of sample
  --num_epochs NUM_EPOCHS
                        specify number of training epochs
  --batch_size BATCH_SIZE
                        specify batch size when training
  --num_classes NUM_CLASSES
                        specify number of output classes

Well, if your dataset is not large enough, you can totally load your dataset once and then use FIFOQueue to improve training. You can also run the example code python small_input.py:

usage: big_input.py [-h] [--scale SCALE] [--logdir LOGDIR]
                    [--samples_num SAMPLES_NUM] [--time_length TIME_LENGTH]
                    [--feature_size FEATURE_SIZE] [--num_epochs NUM_EPOCHS]
                    [--batch_size BATCH_SIZE] [--num_classes NUM_CLASSES]

optional arguments:
  -h, --help            show this help message and exit
  --scale SCALE         specify your dataset scale
  --logdir LOGDIR       specify the location to store log or model
  --samples_num SAMPLES_NUM
                        specify your total number of samples
  --time_length TIME_LENGTH
                        specify max time length of sample
  --feature_size FEATURE_SIZE
                        specify feature size of sample
  --num_epochs NUM_EPOCHS
                        specify number of training epochs
  --batch_size BATCH_SIZE
                        specify batch size when training
  --num_classes NUM_CLASSES
                        specify number of output classes

Contact Me

If my code is helpful to you, please give me a star and fork to encourage me to keep updating. Thank you.

For any questions, welcome to send email to :[email protected]. If you use wechat, you can follow me by searching wechat public media id:deeplearningdigest, I would push several articles every week to share my deep learning practices with you. Thanks!

tensorflow-input-pipeline's People

Contributors

nq555222 avatar zzw922cn avatar

Stargazers

Elon avatar

Watchers

James Cloos avatar Elon avatar  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.