Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tf.io.read_file loads indefinitely #52587

Open
masterholdy opened this issue Oct 20, 2021 · 4 comments
Open

tf.io.read_file loads indefinitely #52587

masterholdy opened this issue Oct 20, 2021 · 4 comments
Assignees
Labels
comp:ops OPs related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 2.9 Issues found in the TF 2.9 release (or RCs) type:bug Bug

Comments

@masterholdy
Copy link

masterholdy commented Oct 20, 2021

Please make sure that this is a bug. As per our
GitHub Policy,
we only address code/doc bugs, performance issues, feature requests and
build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: -
  • TensorFlow installed from (source or binary): Binary
  • TensorFlow version (use command below): v2.4.0-49-g85c8b2a817f 2.4.1
  • Python version: 3.8.5
  • Bazel version (if compiling from source): -
  • GCC/Compiler version (if compiling from source): -
  • CUDA/cuDNN version: -
  • GPU model and memory: -

You can collect some of this information using our environment capture
script
You can also obtain the TensorFlow version with:

  1. TF 1.0: python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
  2. TF 2.0: python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"

Describe the current behavior
Splitting a Dataset and then reading the first item of the Validation Dataset loads indefinitely.

train_dataset = dataset.take(n_train_items)
val_dataset = dataset.skip(n_train_items)

Calling next(iter(train_dataset .take(1))) works calling next(iter(val_dataset .take(1))) loads indefinitely.

Describe the expected behavior
I want my Validation Dataset to just return Data as expected.

Contributing

  • Do you want to contribute a PR? (yes/no): -
  • Briefly describe your candidate solution(if contributing): -

Standalone code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate
the problem. If possible, please share a link to Colab/Jupyter/any notebook.

Other info / logs Include any logs or source code that would be helpful to
diagnose the problem. If including tracebacks, please include the full
traceback. Large logs and files should be attached.

Notebook, that Produces the Issue: https://colab.research.google.com/drive/1w5RQDp6W3Zyu4p1kEBRlHT2Vl9zvxVOk?usp=sharing

Stackoverflow Post: https://stackoverflow.com/questions/69634758/reading-validation-dataset-takes-indefinitely-long
The Problem is withing prep_image, when i just return the Filename without opening the Data everything works as expected:

def prep_image(filename, img_shape=(144,144), channels=3, dtype=tf.float32):
    return filename
#    image_string = tf.io.read_file(filename)
#    image = tf.image.decode_jpeg(image_string, channels=channels)
#    image = tf.image.convert_image_dtype(image, dtype)
#    image = tf.image.resize(image, img_shape)
#    return image

If i just return the Output of tf.io.read_file the first item of the Validation-Dataset already loads indefinitely:

def prep_image(filename, img_shape=(144,144), channels=3, dtype=tf.float32):
    return tf.io.read_file(filename)

Edit:// Loading the First Train-Dataset Item Takes:
0:00:00.063014 HH:MM:SS:ms
and getting the first Validation item takes:
0:31:09.717694

@masterholdy masterholdy added the type:bug Bug label Oct 20, 2021
@tilakrayal tilakrayal added comp:ops OPs related issues TF 2.4 for issues related to TF 2.4 labels Oct 20, 2021
@tilakrayal
Copy link
Contributor

@Saduf2019 ,
I was able to reproduce the issue in tf v2.6, v2.5 and nightly.Please find the gist.

@tilakrayal tilakrayal assigned Saduf2019 and unassigned tilakrayal Oct 20, 2021
@masterholdy
Copy link
Author

Any ideas on how I can work around the problem in the meantime?

@sachinprasadhs sachinprasadhs added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Nov 3, 2021
@masterholdy
Copy link
Author

?

@mohantym
Copy link
Contributor

Hi @masterholdy !
It is still replicating in 2.9 and nightly.

@mohantym mohantym added TF 2.9 Issues found in the TF 2.9 release (or RCs) and removed TF 2.4 for issues related to TF 2.4 labels Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:ops OPs related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 2.9 Issues found in the TF 2.9 release (or RCs) type:bug Bug
Projects
None yet
Development

No branches or pull requests

5 participants