Skip to main content

TensorFlow IO

Project description




TensorFlow I/O

GitHub CI PyPI License Documentation

TensorFlow I/O is a collection of file systems and file formats that are not available in TensorFlow's built-in support. A full list of supported file systems and file formats by TensorFlow I/O can be found here.

The use of tensorflow-io is straightforward with keras. Below is an example to Get Started with TensorFlow with the data processing aspect replaced by tensorflow-io:

import tensorflow as tf
import tensorflow_io as tfio

# Read the MNIST data into the IODataset.
dataset_url = "https://storage.googleapis.com/cvdf-datasets/mnist/"
d_train = tfio.IODataset.from_mnist(
    dataset_url + "train-images-idx3-ubyte.gz",
    dataset_url + "train-labels-idx1-ubyte.gz",
)

# Shuffle the elements of the dataset.
d_train = d_train.shuffle(buffer_size=1024)

# By default image data is uint8, so convert to float32 using map().
d_train = d_train.map(lambda x, y: (tf.image.convert_image_dtype(x, tf.float32), y))

# prepare batches the data just like any other tf.data.Dataset
d_train = d_train.batch(32)

# Build the model.
model = tf.keras.models.Sequential(
    [
        tf.keras.layers.Flatten(input_shape=(28, 28)),
        tf.keras.layers.Dense(512, activation=tf.nn.relu),
        tf.keras.layers.Dropout(0.2),
        tf.keras.layers.Dense(10, activation=tf.nn.softmax),
    ]
)

# Compile the model.
model.compile(
    optimizer="adam", loss="sparse_categorical_crossentropy", metrics=["accuracy"]
)

# Fit the model.
model.fit(d_train, epochs=5, steps_per_epoch=200)

In the above MNIST example, the URL's to access the dataset files are passed directly to the tfio.IODataset.from_mnist API call. This is due to the inherent support that tensorflow-io provides for HTTP/HTTPS file system, thus eliminating the need for downloading and saving datasets on a local directory.

NOTE: Since tensorflow-io is able to detect and uncompress the MNIST dataset automatically if needed, we can pass the URL's for the compressed files (gzip) to the API call as is.

Please check the official documentation for more detailed and interesting usages of the package.

Installation

Python Package

The tensorflow-io Python package can be installed with pip directly using:

$ pip install tensorflow-io

People who are a little more adventurous can also try our nightly binaries:

$ pip install tensorflow-io-nightly

Docker Images

In addition to the pip packages, the docker images can be used to quickly get started.

For stable builds:

$ docker pull tfsigio/tfio:latest
$ docker run -it --rm --name tfio-latest tfsigio/tfio:latest

For nightly builds:

$ docker pull tfsigio/tfio:nightly
$ docker run -it --rm --name tfio-nightly tfsigio/tfio:nightly

R Package

Once the tensorflow-io Python package has been successfully installed, you can install the development version of the R package from GitHub via the following:

if (!require("remotes")) install.packages("remotes")
remotes::install_github("tensorflow/io", subdir = "R-package")

TensorFlow Version Compatibility

To ensure compatibility with TensorFlow, it is recommended to install a matching version of TensorFlow I/O according to the table below. You can find the list of releases here.

TensorFlow I/O Version TensorFlow Compatibility Release Date
0.17.1 2.4.x Apr 16, 2021
0.17.0 2.4.x Dec 14, 2020
0.16.0 2.3.x Oct 23, 2020
0.15.0 2.3.x Aug 03, 2020
0.14.0 2.2.x Jul 08, 2020
0.13.0 2.2.x May 10, 2020
0.12.0 2.1.x Feb 28, 2020
0.11.0 2.1.x Jan 10, 2020
0.10.0 2.0.x Dec 05, 2019
0.9.1 2.0.x Nov 15, 2019
0.9.0 2.0.x Oct 18, 2019
0.8.1 1.15.x Nov 15, 2019
0.8.0 1.15.x Oct 17, 2019
0.7.2 1.14.x Nov 15, 2019
0.7.1 1.14.x Oct 18, 2019
0.7.0 1.14.x Jul 14, 2019
0.6.0 1.13.x May 29, 2019
0.5.0 1.13.x Apr 12, 2019
0.4.0 1.13.x Mar 01, 2019
0.3.0 1.12.0 Feb 15, 2019
0.2.0 1.12.0 Jan 29, 2019
0.1.0 1.12.0 Dec 16, 2018

Performance Benchmarking

We use github-pages to document the results of API performance benchmarks. The benchmark job is triggered on every commit to master branch and facilitates tracking performance w.r.t commits.

Contributing

Tensorflow I/O is a community led open source project. As such, the project depends on public contributions, bug-fixes, and documentation. Please see:

Build Status and CI

Build Status
Linux CPU Python 2 Status
Linux CPU Python 3 Status
Linux GPU Python 2 Status
Linux GPU Python 3 Status

Because of manylinux2010 requirement, TensorFlow I/O is built with Ubuntu:16.04 + Developer Toolset 7 (GCC 7.3) on Linux. Configuration with Ubuntu 16.04 with Developer Toolset 7 is not exactly straightforward. If the system have docker installed, then the following command will automatically build manylinux2010 compatible whl package:

#!/usr/bin/env bash

ls dist/*
for f in dist/*.whl; do
  docker run -i --rm -v $PWD:/v -w /v --net=host quay.io/pypa/manylinux2010_x86_64 bash -x -e /v/tools/build/auditwheel repair --plat manylinux2010_x86_64 $f
done
sudo chown -R $(id -nu):$(id -ng) .
ls wheelhouse/*

It takes some time to build, but once complete, there will be python 3.5, 3.6, 3.7 compatible whl packages available in wheelhouse directory.

On macOS, the same command could be used. However, the script expects python in shell and will only generate a whl package that matches the version of python in shell. If you want to build a whl package for a specific python then you have to alias this version of python to python in shell. See .github/workflows/build.yml Auditwheel step for instructions how to do that.

Note the above command is also the command we use when releasing packages for Linux and macOS.

TensorFlow I/O uses both GitHub Workflows and Google CI (Kokoro) for continuous integration. GitHub Workflows is used for macOS build and test. Kokoro is used for Linux build and test. Again, because of the manylinux2010 requirement, on Linux whl packages are always built with Ubuntu 16.04 + Developer Toolset 7. Tests are done on a variatiy of systems with different python3 versions to ensure a good coverage:

Python Ubuntu 18.04 Ubuntu 20.04 macOS + osx9 Windows-2019
2.7 :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: N/A
3.7 :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
3.8 :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:

TensorFlow I/O has integrations with many systems and cloud vendors such as Prometheus, Apache Kafka, Apache Ignite, Google Cloud PubSub, AWS Kinesis, Microsoft Azure Storage, Alibaba Cloud OSS etc.

We tried our best to test against those systems in our continuous integration whenever possible. Some tests such as Prometheus, Kafka, and Ignite are done with live systems, meaning we install Prometheus/Kafka/Ignite on CI machine before the test is run. Some tests such as Kinesis, PubSub, and Azure Storage are done through official or non-official emulators. Offline tests are also performed whenever possible, though systems covered through offine tests may not have the same level of coverage as live systems or emulators.

Live System Emulator CI Integration Offline
Apache Kafka :heavy_check_mark: :heavy_check_mark:
Apache Ignite :heavy_check_mark: :heavy_check_mark:
Prometheus :heavy_check_mark: :heavy_check_mark:
Google PubSub :heavy_check_mark: :heavy_check_mark:
Azure Storage :heavy_check_mark: :heavy_check_mark:
AWS Kinesis :heavy_check_mark: :heavy_check_mark:
Alibaba Cloud OSS :heavy_check_mark:
Google BigTable/BigQuery to be added
Elasticsearch (experimental) :heavy_check_mark: :heavy_check_mark:
MongoDB (experimental) :heavy_check_mark: :heavy_check_mark:

References for emulators:

Community

Additional Information

License

Apache License 2.0

Release history Release notifications | RSS feed

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

tensorflow_io_nightly-0.18.0.dev20210505040519-cp39-cp39-win_amd64.whl (20.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

tensorflow_io_nightly-0.18.0.dev20210505040519-cp39-cp39-manylinux2010_x86_64.whl (24.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

tensorflow_io_nightly-0.18.0.dev20210505040519-cp39-cp39-macosx_10_14_x86_64.whl (21.1 MB view details)

Uploaded CPython 3.9 macOS 10.14+ x86-64

tensorflow_io_nightly-0.18.0.dev20210505040519-cp38-cp38-win_amd64.whl (20.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

tensorflow_io_nightly-0.18.0.dev20210505040519-cp38-cp38-manylinux2010_x86_64.whl (24.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

tensorflow_io_nightly-0.18.0.dev20210505040519-cp38-cp38-macosx_10_14_x86_64.whl (21.1 MB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

tensorflow_io_nightly-0.18.0.dev20210505040519-cp37-cp37m-win_amd64.whl (20.6 MB view details)

Uploaded CPython 3.7m Windows x86-64

tensorflow_io_nightly-0.18.0.dev20210505040519-cp37-cp37m-manylinux2010_x86_64.whl (24.1 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

tensorflow_io_nightly-0.18.0.dev20210505040519-cp37-cp37m-macosx_10_14_x86_64.whl (21.1 MB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

tensorflow_io_nightly-0.18.0.dev20210505040519-cp36-cp36m-win_amd64.whl (20.6 MB view details)

Uploaded CPython 3.6m Windows x86-64

tensorflow_io_nightly-0.18.0.dev20210505040519-cp36-cp36m-manylinux2010_x86_64.whl (24.1 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

tensorflow_io_nightly-0.18.0.dev20210505040519-cp36-cp36m-macosx_10_14_x86_64.whl (21.1 MB view details)

Uploaded CPython 3.6m macOS 10.14+ x86-64

File details

Details for the file tensorflow_io_nightly-0.18.0.dev20210505040519-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for tensorflow_io_nightly-0.18.0.dev20210505040519-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 31b1654c4a6b0ac593cdceae10534102e9e304d32020c0694351fb4a588c850c
MD5 fcca8ec666187b988f6cd5c7ae73c2bd
BLAKE2b-256 c6827379454e6e8121507bb3e1255f181d441ffe775221d846c6c2cfeb9119a2

See more details on using hashes here.

File details

Details for the file tensorflow_io_nightly-0.18.0.dev20210505040519-cp39-cp39-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for tensorflow_io_nightly-0.18.0.dev20210505040519-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f848b8b0de0018139f1367800f20ac3aff8a341588b3cf40250690c2da1f6119
MD5 d2a372edf9c12230ba1f189298311052
BLAKE2b-256 63f7906ecc21461d53a95cd2c2f0b41530d7e908ae03cfba8f2def5681a65bb4

See more details on using hashes here.

File details

Details for the file tensorflow_io_nightly-0.18.0.dev20210505040519-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for tensorflow_io_nightly-0.18.0.dev20210505040519-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 c2d098ba28a69f172a61396b4152b754eadcbb87e2922334514d9a1507b6fa8d
MD5 7927b042c28609d9fe1c750897a3e258
BLAKE2b-256 7140dacebe71e1ecd3f0b2b732fcd11d960ddb81b5c615d8a3137ef0f1c0d25a

See more details on using hashes here.

File details

Details for the file tensorflow_io_nightly-0.18.0.dev20210505040519-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for tensorflow_io_nightly-0.18.0.dev20210505040519-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 65fb7ed706207426d03fdbb1ff8c0bf09c783bd580b8dafcd5e00e02ec040791
MD5 86f62bac434ced5063aa9284deff92a0
BLAKE2b-256 ca862f3af0b56577b31fbd577148fb93a41e6ee64d1ac3b435f4d67379bfc980

See more details on using hashes here.

File details

Details for the file tensorflow_io_nightly-0.18.0.dev20210505040519-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for tensorflow_io_nightly-0.18.0.dev20210505040519-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 624f9c4083568a52caea995b6e5bc829ddc014271b9b3515212fc6c6513decf3
MD5 c616c9524db52d81aa4cb3dbc82e46cd
BLAKE2b-256 d1211abfb92d374b06cbfef0952b9f886b39b0b28bce2888c1292a681bf58ea4

See more details on using hashes here.

File details

Details for the file tensorflow_io_nightly-0.18.0.dev20210505040519-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for tensorflow_io_nightly-0.18.0.dev20210505040519-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 863dedde7c5d9bd8b2e8561276132b7dfe4109f1d5dacf8683c5a1a171e2ab0d
MD5 248e9d880cedc87d2191819c2e7cd24a
BLAKE2b-256 c0d49ede1cfdd8177be2f3b5151e1bd0c0714bf616a176cbc5d9a597538daf8b

See more details on using hashes here.

File details

Details for the file tensorflow_io_nightly-0.18.0.dev20210505040519-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for tensorflow_io_nightly-0.18.0.dev20210505040519-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 ec217d7562854552a9a163e0416d665da09eb7e1e298a6a3ed5bb0004b34d667
MD5 f949f0aae40d88a07ce84df67a69d0ea
BLAKE2b-256 6273fb14e71c3110ece8ce50542f2e6cf578cebe04bc998ddd7f697bfb6583ef

See more details on using hashes here.

File details

Details for the file tensorflow_io_nightly-0.18.0.dev20210505040519-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for tensorflow_io_nightly-0.18.0.dev20210505040519-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ee35effbba190e5d8ffc22e51c579ed09e35456feaed6773f67dbf5877020eb1
MD5 51b7f46bcb9906888ac313c48c370fa2
BLAKE2b-256 c5b47db546bf9dd43f8d6db850ff80e5722a3c63fb7ef054a9cbc2b23d8613e1

See more details on using hashes here.

File details

Details for the file tensorflow_io_nightly-0.18.0.dev20210505040519-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for tensorflow_io_nightly-0.18.0.dev20210505040519-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 99eefa945876fe71af6431b5c92d9ad275979b5b13f43e9ddc01cc8515b8bddb
MD5 3d0e3a1816ed0f6f022962ca6b8eac46
BLAKE2b-256 59af7a9d243caabce3713f925e6fdf8126c7799ff4992bb4cc89d880429e49a7

See more details on using hashes here.

File details

Details for the file tensorflow_io_nightly-0.18.0.dev20210505040519-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for tensorflow_io_nightly-0.18.0.dev20210505040519-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 1dcf503a045a368074e1cda00e7ca1a9dc5a7109ffbef3b9138e4ca473c23689
MD5 5fadc1cfee935dee3364ec3160e1e0c5
BLAKE2b-256 45c3fdc67f012e4e28dd293569772474a32801cba831884c3aabfa35c029550c

See more details on using hashes here.

File details

Details for the file tensorflow_io_nightly-0.18.0.dev20210505040519-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for tensorflow_io_nightly-0.18.0.dev20210505040519-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d58f133a46b063a309222c44f0774f41f5e9117704e578b9d368bbe933aaee64
MD5 5dd933a4d7a8c5811cd0c9b96bc53d58
BLAKE2b-256 ee8981b6f9af7bccbc7cbb86b9da6dc16f61dd2e2e5b70f1ec1e7e2897009485

See more details on using hashes here.

File details

Details for the file tensorflow_io_nightly-0.18.0.dev20210505040519-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for tensorflow_io_nightly-0.18.0.dev20210505040519-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 19a7471849225a80a0abc719d49573069790ca9cc47824d6a5446b7928f1886e
MD5 225b9c759edd608698c23f020d22d380
BLAKE2b-256 8a25ec5b5d5d600aa7dc001401a08e62343d03890fd9a9f74e7f3485711b0923

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