Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit f8c1a40

Browse files
committed
Rename TFRUtil to TFRecorder.
Change-Id: I1c3f66fc7564428790aa7db1532e7816d442a2f8
1 parent f8fc727 commit f8c1a40

37 files changed

+86
-80
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ persistent=no
1616
# usually to register additional checkers.
1717
load-plugins=
1818
# Use multiple processes to speed up Pylint.
19-
jobs=4
19+
jobs=1
2020
# Allow loading of arbitrary C extensions. Extensions are imported into the
2121
# active Python interpreter and may run arbitrary code.
2222
unsafe-load-any-extension=no

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ init:
22
pip install -r requirements.txt
33

44
test:
5-
nosetests --with-coverage --nocapture -v --cover-package=tfrutil
5+
nosetests --with-coverage --nocapture -v --cover-package=tfrecorder
66

77
pylint:
8-
pylint tfrutil
8+
pylint tfrecorder
99

10-
.PHONY: init glint coverage test
10+
.PHONY: init glint coverage test

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# TFRecord Utilities (TFRUtil)
1+
# TFRecorder
22

3-
TFRUtil makes it easy to create TFRecords from images and labels in
3+
TFRecorder makes it easy to create TFRecords from images and labels in
44
Pandas DataFrames or CSV files.
5-
Today, TFRUtil supports data stored in 'image csv format' similar to
5+
Today, TFRecorder supports data stored in 'image csv format' similar to
66
GCP AutoML Vision.
7-
In the future TFRUtil will support converting any Pandas DataFrame or CSV
7+
In the future TFRecorder will support converting any Pandas DataFrame or CSV
88
file into TFRecords.
99

1010
## Installation
@@ -23,7 +23,7 @@ pip install .
2323

2424
```bash
2525
import pandas as pd
26-
import tfrutil
26+
import tfrecorder
2727
df = pd.read_csv(...)
2828
df.tensorflow.to_tfrecord(output_dir="gs://my/bucket")
2929
```
@@ -41,12 +41,14 @@ df.tensorflow.to_tfrecord(
4141
### Command-line interface
4242
4343
```bash
44-
tfrutil create-tfrecords --output_dir="gs://my/bucket" data.csv
44+
tfrecorder create-tfrecords --output_dir="gs://my/bucket" data.csv
4545
```
4646
4747
## Input format
4848
49-
TFRUtil currently expects data to be in the same format as [AutoML Vision](https://cloud.google.com/vision/automl/docs/prepare). This format looks like a pandas dataframe or CSV formatted as:
49+
TFRecorder currently expects data to be in the same format as
50+
[AutoML Vision](https://cloud.google.com/vision/automl/docs/prepare).
51+
This format looks like a pandas dataframe or CSV formatted as:
5052
5153
| split | image_uri | label |
5254
|-------|---------------------------|-------|

kokoro/gcp_ubuntu/kokoro_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ echo $(python -V) # should be Python 3
6565
# Code under repo is checked out to ${KOKORO_ARTIFACTS_DIR}/git.
6666
# The final directory name in this path is determined by the scm name specified
6767
# in the job configuration.
68-
cd ${KOKORO_ARTIFACTS_DIR}/git/tfrutil
68+
cd ${KOKORO_ARTIFACTS_DIR}/git/tfrecorder
6969

7070
./build.sh

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838

3939

4040
setup(
41-
name='tfrutil',
41+
name='tfrecorder',
4242
version='0.1',
4343
install_requires=REQUIRED_PACKAGES,
4444
packages=find_packages(),
4545
include_package_data=True,
46-
description='TFRUtil creates TensorFlow Records easily.',
46+
description='TFRecorder creates TensorFlow Records easily.',
4747
entry_points = {
48-
'console_scripts': ['tfrutil=tfrutil.cli:main'],
48+
'console_scripts': ['tfrecorder=tfrecorder.cli:main'],
4949
},
5050
)

tfrutil/__init__.py renamed to tfrecorder/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
# limitations under the License.
1616

1717
"""Imports."""
18-
from tfrutil import accessor
19-
from tfrutil import client
18+
from tfrecorder import accessor
19+
from tfrecorder import client

tfrutil/accessor.py renamed to tfrecorder/accessor.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,24 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
"""Creates a pandas DataFrame accessor for TFRUtil.
17+
"""Creates a pandas DataFrame accessor for TFRecorder.
1818
19-
accessor.py contains TFRUtilAccessor which provides a pandas DataFrame
19+
accessor.py contains TFRecorderAccessor which provides a pandas DataFrame
2020
accessor. This accessor allows us to inject the to_tfr() function into
2121
pandas DataFrames.
2222
"""
23+
2324
from typing import Any, Dict, Optional, Union
2425
import pandas as pd
2526
from IPython.core import display
2627

27-
from tfrutil import client
28-
from tfrutil import constants
28+
from tfrecorder import client
29+
from tfrecorder import constants
2930

3031

3132
@pd.api.extensions.register_dataframe_accessor('tensorflow')
32-
class TFRUtilAccessor:
33-
"""DataFrame Accessor class for TFRUtil."""
33+
class TFRecorderAccessor:
34+
"""DataFrame Accessor class for TFRecorder."""
3435

3536
def __init__(self, pandas_obj):
3637
self._df = pandas_obj
@@ -46,15 +47,15 @@ def to_tfr(
4647
job_label: str = 'to-tfr',
4748
compression: Optional[str] = 'gzip',
4849
num_shards: int = 0) -> Dict[str, Any]:
49-
"""TFRUtil Pandas Accessor.
50+
"""TFRecorder Pandas Accessor.
5051
51-
TFRUtil provides an easy interface to create image-based tensorflow records
52-
from a dataframe containing GCS locations of the images and labels.
52+
TFRecorder provides an easy interface to create image-based tensorflow
53+
records from a dataframe containing GCS locations of the images and labels.
5354
5455
Usage:
55-
import tfrutil
56+
import tfrecorder
5657
57-
df.tfrutil.to_tfr(
58+
df.tfrecorder.to_tfr(
5859
output_dir='gcs://foo/bar/train',
5960
runner='DirectRunner',
6061
compression='gzip',

tfrutil/accessor_test.py renamed to tfrecorder/accessor_test.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
"""Tests for pandas accessor."""
17+
"""Tests for Pandas accessor."""
1818

1919
import os
2020
import unittest
2121

2222
# pylint: disable=unused-import
23+
import tfrecorder
2324

24-
import tfrutil
25-
from tfrutil import test_utils
25+
from tfrecorder import test_utils
2626

2727

2828
class DataFrameAccessor(unittest.TestCase):
@@ -40,5 +40,6 @@ def test_accessor(self):
4040
runner='DirectRunner', output_dir=self.output_dir)
4141
self.assertTrue('metrics' in r)
4242

43+
4344
if __name__ == '__main__':
4445
unittest.main()
File renamed without changes.

tfrutil/beam_image_test.py renamed to tfrecorder/beam_image_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
from PIL import Image
2727
import tensorflow_transform as tft
2828

29-
from tfrutil import beam_image
30-
from tfrutil import constants
31-
from tfrutil import test_utils
29+
from tfrecorder import beam_image
30+
from tfrecorder import constants
31+
from tfrecorder import test_utils
3232

3333

3434
class BeamImageTests(unittest.TestCase):
@@ -37,7 +37,7 @@ class BeamImageTests(unittest.TestCase):
3737
def setUp(self):
3838
self.pipeline = test_utils.get_test_pipeline()
3939
self.df = test_utils.get_test_df()
40-
self.image_file = 'tfrutil/test_data/images/cat/cat-640x853-1.jpg'
40+
self.image_file = 'tfrecorder/test_data/images/cat/cat-640x853-1.jpg'
4141

4242
def test_load(self):
4343
"""Tests the image loading function."""
@@ -47,7 +47,7 @@ def test_load(self):
4747
def test_file_not_found_load(self):
4848
"""Test loading an image that doesn't exist."""
4949
with self.assertRaises(OSError):
50-
_ = beam_image.load('tfrutil/test_data/images/cat/food.jpg')
50+
_ = beam_image.load('tfrecorder/test_data/images/cat/food.jpg')
5151

5252
def test_mode_to_channel(self):
5353
"""Tests `mode_to_channel`."""

0 commit comments

Comments
 (0)