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

Added lowercase split value and passing tests#42 #67

Open
wants to merge 12 commits into
base: dev
Choose a base branch
from
Open
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -165,7 +165,7 @@ on your local machine.
import tfrecorder

dataset_dict = tfrecorder.load('/path/to/tfrecord_dir')
train = dataset_dict['TRAIN']
train = dataset_dict['train']
```

### Verifying data in TFRecords generated by TFRecorder
Expand All @@ -176,7 +176,7 @@ import tfrecorder

tfrecorder.inspect(
tfrecord_dir='/path/to/tfrecords/',
split='TRAIN',
split='train',
num_records=5,
output_dir='/tmp/output')
```
Expand All @@ -189,7 +189,7 @@ Using the command line:
```bash
tfrecorder inspect \
--tfrecord-dir=/path/to/tfrecords/ \
--split='TRAIN' \
--split='train' \
--num_records=5 \
--output_dir=/tmp/output
```
Expand Down
543 changes: 248 additions & 295 deletions samples/Basic-TFRecorder-Usage.ipynb

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions samples/Convert-image-directory.ipynb
Expand Up @@ -23,10 +23,14 @@
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Error importing tfx_bsl_extension.arrow.array_util. Some tfx_bsl functionalities are not available"
"ename": "ModuleNotFoundError",
"evalue": "No module named 'tfrecorder'",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-2-e4ffec2f858b>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mpandas\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mtensorflow\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mtf\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 9\u001b[1;33m \u001b[1;32mimport\u001b[0m \u001b[0mtfrecorder\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'tfrecorder'"
]
}
],
Expand Down Expand Up @@ -171,7 +175,7 @@
}
],
"source": [
"for x in datasets['TRAIN'].take(1):\n",
"for x in datasets['train'].take(1):\n",
" print(x.keys())"
]
}
Expand All @@ -192,9 +196,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
}
6 changes: 3 additions & 3 deletions samples/Convert-structured-data.ipynb
Expand Up @@ -221,7 +221,7 @@
}
],
"source": [
"df['split'] = 'TRAIN'\n",
"df['split'] = 'train'\n",
"df.head()"
]
},
Expand Down Expand Up @@ -370,7 +370,7 @@
}
],
"source": [
"for x in datasets['TRAIN'].take(1):\n",
"for x in datasets['train'].take(1):\n",
" for k, v in x.items():\n",
" print(f'{k}: {v.dtype}')"
]
Expand All @@ -392,7 +392,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
15 changes: 7 additions & 8 deletions samples/Loading-a-TF-Dataset.ipynb
Expand Up @@ -63,7 +63,7 @@
{
"data": {
"text/plain": [
"dict_keys(['TRAIN', 'VALIDATION', 'TEST'])"
"dict_keys(['train', 'validation', 'test'])"
]
},
"execution_count": 3,
Expand All @@ -88,7 +88,7 @@
"metadata": {},
"outputs": [],
"source": [
"train = datasets['TRAIN']"
"train = datasets['train']"
]
},
{
Expand All @@ -113,14 +113,13 @@
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
Expand All @@ -146,9 +145,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
}
4 changes: 2 additions & 2 deletions samples/Using-TFRecorder-with-Google-Cloud-Dataflow.ipynb
Expand Up @@ -133,9 +133,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
}
12 changes: 6 additions & 6 deletions samples/data.csv
@@ -1,7 +1,7 @@
split,image_uri,label
TRAIN,../tfrecorder/test_data/images/cat/cat-640x853-1.jpg,cat
VALIDATION,../tfrecorder/test_data/images/cat/cat-800x600-2.jpg,cat
TEST,../tfrecorder/test_data/images/cat/cat-800x600-3.jpg,cat
TRAIN,../tfrecorder/test_data/images/goat/goat-640x640-1.jpg,goat
VALIDATION,../tfrecorder/test_data/images/goat/goat-320x320-2.jpg,goat
TEST,../tfrecorder/test_data/images/goat/goat-640x427-3.jpg,goat
train,../tfrecorder/test_data/images/cat/cat-640x853-1.jpg,cat
validation,../tfrecorder/test_data/images/cat/cat-800x600-2.jpg,cat
test,../tfrecorder/test_data/images/cat/cat-800x600-3.jpg,cat
train,../tfrecorder/test_data/images/goat/goat-640x640-1.jpg,goat
validation,../tfrecorder/test_data/images/goat/goat-320x320-2.jpg,goat
test,../tfrecorder/test_data/images/goat/goat-640x427-3.jpg,goat
Binary file added samples/tfrecorder-2.0-py3-none-any.whl
Binary file not shown.
@@ -0,0 +1,163 @@
�
�}
.
Identity

input"T
output"T"
Ttype

NoOp
C
Placeholder
output"dtype"
dtypetype"
shapeshape:" transform*2.3.22v2.3.1-38-g9edbe5075f7�
i
inputs/Age/Age Placeholder*#
_output_shapes
: ���������*
dtype0*
shape: ���������
k
inputs/Fare/Fare Placeholder*#
_output_shapes
: ���������*
dtype0*
shape: ���������
k
inputs/Name/Name Placeholder*#
_output_shapes
: ���������*
dtype0*
shape: ���������
�
:inputs/F_Parents/Children_Aboard/F_Parents/Children_Aboard Placeholder*#
_output_shapes
: ���������*
dtype0 *
shape: ���������
o
inputs/Pclass/Pclass Placeholder*#
_output_shapes
: ���������*
dtype0 *
shape: ���������
i
inputs/Sex/Sex Placeholder*#
_output_shapes
: ���������*
dtype0*
shape: ���������
�
:inputs/F_Siblings/Spouses_Aboard/F_Siblings/Spouses_Aboard Placeholder*#
_output_shapes
: ���������*
dtype0 *
shape: ���������
s
inputs/Survived/Survived Placeholder*#
_output_shapes
: ���������*
dtype0 *
shape: ���������
m
inputs/split/split Placeholder*#
_output_shapes
: ���������*
dtype0*
shape: ���������
d
inputs/inputs/Age/Age_copyIdentityinputs/Age/Age*
T0*#
_output_shapes
: ���������
h
inputs/inputs/Fare/Fare_copyIdentityinputs/Fare/Fare*
T0*#
_output_shapes
: ���������
h
inputs/inputs/Name/Name_copyIdentityinputs/Name/Name*
T0*#
_output_shapes
: ���������
�
Finputs/inputs/F_Parents/Children_Aboard/F_Parents/Children_Aboard_copyIdentity:inputs/F_Parents/Children_Aboard/F_Parents/Children_Aboard*
T0 *#
_output_shapes
: ���������
p
inputs/inputs/Pclass/Pclass_copyIdentityinputs/Pclass/Pclass*
T0 *#
_output_shapes
: ���������
d
inputs/inputs/Sex/Sex_copyIdentityinputs/Sex/Sex*
T0*#
_output_shapes
: ���������
�
Finputs/inputs/F_Siblings/Spouses_Aboard/F_Siblings/Spouses_Aboard_copyIdentity:inputs/F_Siblings/Spouses_Aboard/F_Siblings/Spouses_Aboard*
T0 *#
_output_shapes
: ���������
x
$inputs/inputs/Survived/Survived_copyIdentityinputs/Survived/Survived*
T0 *#
_output_shapes
: ���������
l
inputs/inputs/split/split_copyIdentityinputs/split/split*
T0*#
_output_shapes
: ���������

initNoOp"�*�

transform_signature�
*
Age#
inputs/Age/Age:0 ���������
-
Fare%
inputs/Fare/Fare:0 ���������
-
Name%
inputs/Name/Name:0 ���������
j
Parents/Children AboardO
<inputs/F_Parents/Children_Aboard/F_Parents/Children_Aboard:0  ���������
3
Pclass)
inputs/Pclass/Pclass:0  ���������
*
Sex#
inputs/Sex/Sex:0 ���������
j
Siblings/Spouses AboardO
<inputs/F_Siblings/Spouses_Aboard/F_Siblings/Spouses_Aboard:0  ���������
9
Survived-
inputs/Survived/Survived:0  ���������
0
split'
inputs/split/split:0 ���������6
Age/
inputs/inputs/Age/Age_copy:0 ���������9
Fare1
inputs/inputs/Fare/Fare_copy:0 ���������9
Name1
inputs/inputs/Name/Name_copy:0 ���������v
Parents/Children Aboard[
Hinputs/inputs/F_Parents/Children_Aboard/F_Parents/Children_Aboard_copy:0  ���������?
Pclass5
"inputs/inputs/Pclass/Pclass_copy:0  ���������6
Sex/
inputs/inputs/Sex/Sex_copy:0 ���������v
Siblings/Spouses Aboard[
Hinputs/inputs/F_Siblings/Spouses_Aboard/F_Siblings/Spouses_Aboard_copy:0  ���������E
Survived9
&inputs/inputs/Survived/Survived_copy:0  ���������<
split3
inputs/inputs/split/split_copy:0 ���������tensorflow/serving/predict
Expand Down