Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aebruno committed Apr 18, 2018
1 parent dedf546 commit 1f11182
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
10 changes: 10 additions & 0 deletions ChangeLog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@
ChangeLog
===============================================================================

`v0.0.2`_ (2018-04-18)
---------------------------

* Build now supports cli option to convert to JPEG otherwise build uses the
original image data
* Performance improvements
* Added some Read/Writer examples
* Added python tensorflow script for validating TFRecord files created in terf

`v0.0.1`_ (2018-04-17)
---------------------------

* Initial release

.. _v0.0.1: https://github.com/ubccr/terf/releases/tag/v0.0.1
.. _v0.0.2: https://github.com/ubccr/terf/releases/tag/v0.0.2
18 changes: 16 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,22 @@ Extract the raw image data from a dataset::
Go
~~~~~~~~~~~~~~~~~~~~~~

Parse TFRecords file in Go::
Parse TFRecords file in Go:

in, err := os.Open("train-00001-of-01024")
.. code-block:: go
// Open TFRecord file
in, err := os.Open("train-000")
if err != nil {
log.Fatal(err)
}
defer in.Close()
r := terf.NewReader(in)
count := 0
for {
// example will be a Tensorflow Example proto
example, err := r.Next()
if err == io.EOF {
break
Expand All @@ -158,8 +163,17 @@ Parse TFRecords file in Go::
}
// Do something with example
id := terf.ExampleFeatureInt64(example, "image/id")
labelID := terf.ExampleFeatureInt64(example, "image/class/label")
labelText := string(terf.ExampleFeatureBytes(example, "image/class/text"))
fmt.Printf("Image: %d Label: %s (%d)\n", id, labelText, labelID)
count++
}
fmt.Printf("Total records: %d\n", count)
-------------------------------------------------------------------------------
License
-------------------------------------------------------------------------------
Expand Down

0 comments on commit 1f11182

Please sign in to comment.