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
1,016 changes: 41 additions & 975 deletions samples/Basic-TFRecorder-Usage.ipynb

Large diffs are not rendered by default.

107 changes: 12 additions & 95 deletions samples/Convert-image-directory.ipynb
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -19,17 +19,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Error importing tfx_bsl_extension.arrow.array_util. Some tfx_bsl functionalities are not available"
]
}
],
"outputs": [],
"source": [
"import os\n",
"import pathlib\n",
Expand All @@ -51,7 +43,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -61,76 +53,9 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": [
"\n",
" if (typeof window.interactive_beam_jquery == 'undefined') {\n",
" var jqueryScript = document.createElement('script');\n",
" jqueryScript.src = 'https://code.jquery.com/jquery-3.4.1.slim.min.js';\n",
" jqueryScript.type = 'text/javascript';\n",
" jqueryScript.onload = function() {\n",
" var datatableScript = document.createElement('script');\n",
" datatableScript.src = 'https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js';\n",
" datatableScript.type = 'text/javascript';\n",
" datatableScript.onload = function() {\n",
" window.interactive_beam_jquery = jQuery.noConflict(true);\n",
" window.interactive_beam_jquery(document).ready(function($){\n",
" \n",
" });\n",
" }\n",
" document.head.appendChild(datatableScript);\n",
" };\n",
" document.head.appendChild(jqueryScript);\n",
" } else {\n",
" window.interactive_beam_jquery(document).ready(function($){\n",
" \n",
" });\n",
" }"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" var import_html = () => {\n",
" ['https://raw.githubusercontent.com/PAIR-code/facets/1.0.0/facets-dist/facets-jupyter.html'].forEach(href => {\n",
" var link = document.createElement('link');\n",
" link.rel = 'import'\n",
" link.href = href;\n",
" document.head.appendChild(link);\n",
" });\n",
" }\n",
" if ('import' in document.createElement('link')) {\n",
" import_html();\n",
" } else {\n",
" var webcomponentScript = document.createElement('script');\n",
" webcomponentScript.src = 'https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.3.3/webcomponents-lite.js';\n",
" webcomponentScript.type = 'text/javascript';\n",
" webcomponentScript.onload = function(){\n",
" import_html();\n",
" };\n",
" document.head.appendChild(webcomponentScript);\n",
" }"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'job_id': 'DirectRunner', 'metrics': {'rows': 6, 'good_images': 6, 'bad_images': None}, 'tfrecord_dir': '/tmp/tfrecords/tfrecorder-20201027-173455-create-tfrecords'}\n"
]
}
],
"outputs": [],
"source": [
"output_dir = pathlib.Path('/tmp/tfrecords')\n",
"results = tfrecorder.convert(str(image_dir), output_dir)\n",
Expand All @@ -146,7 +71,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -155,23 +80,15 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"dict_keys(['image', 'image_channels', 'image_height', 'image_name', 'image_width', 'label', 'split'])\n"
]
}
],
"outputs": [],
"source": [
"for x in datasets['TRAIN'].take(1):\n",
"for x in datasets['train'].take(1):\n",
" print(x.keys())"
]
}
Expand All @@ -192,9 +109,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
}