-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
InvalidArgumentError: Graph execution error: #20006
Comments
Hi @iwqculrbud - Thanks for reporting this issue. Currently I am to find the dataset directory to reproduce this issue. If possible Can you help me to with your dataset? Thanks..!! |
https://kaggle.com/datasets/e26fb9d642838aaf211ab8e41238df185bb60f6199ce07eafffae86085759d89 |
Hi @iwqculrbud - Thanks for the dataset. Actually "InvalidArgumentError: Graph execution error" error cause by there were corrupt images are there in your dataset. To resolve this error remove corrupt images and apply some preprocessing will resolve this error. Here is the solution you can try to create train_ds and val_ds and then train your model:
|
hello This doesn't work for me, thank you |
Hi @iwqculrbud - Your dataset images are corrupted hence, we need to do preprocessing for corrupted images. You can find attached gist with detailed solution. |
This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you. |
Hi @iwqculrbud - Does the issue is still reproduce to you ? |
This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you. |
This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further. |
Can anyone help me
import keras
from keras import layers
import matplotlib.pyplot as plt
from keras.utils import image_dataset_from_directory
epochs = 30
image_size = (373, 454)
train_ds, val_ds = image_dataset_from_directory("/kaggle/input/fractured-images/images",
validation_split=0.4,
subset="both",
image_size=image_size,
seed=1337,
batch_size=128)
def model_function(shape):
inputs = keras.Input(shape)
w = layers.Rescaling(1.0 /255)(inputs)
for size in [256, 512, 728, 1024]:
w = layers.Conv2D(size, 3, activation="relu")(w)
w = layers.MaxPooling2D(pool_size=2)(w)
w = layers.Conv2D(1024, 3, activation="relu")(w)
w = layers.Flatten()(w)
outputs = layers.Dense(1, activation="sigmoid")(w)
return keras.Model(inputs=inputs, outputs=outputs)
model = model_function(shape=image_size + (3,))
model.summary()
keras.utils.plot_model(model,
f"fractures_test_{epochs}1.png",
show_shapes=True)
callbacks = [
keras.callbacks.ModelCheckpoint(
filepath=f"fractured_model_test{epochs}_1.keras",
save_best_only=True,
monitor="val_loss"
)
]
model.compile(
loss="binary_crossentropy",
optimizer="rmsprop",
metrics=["accuracy"]
)
history = model.fit(
train_ds,
epochs=epochs,
validation_data=val_ds,
callbacks=callbacks
)
2024-07-17 16:02:44.093403: E tensorflow/core/lib/jpeg/jpeg_mem.cc:327] Premature end of JPEG data. Stopped at line 382/454
2024-07-17 16:02:44.133631: E tensorflow/core/lib/jpeg/jpeg_mem.cc:327] Premature end of JPEG data. Stopped at line 430/454
InvalidArgumentError Traceback (most recent call last)
Cell In[16], line 48
34 callbacks = [
35 keras.callbacks.ModelCheckpoint(
36 filepath=f"fractured_model_test_{epochs}_1.keras",
(...)
39 )
40 ]
42 model.compile(
43 loss="binary_crossentropy",
44 optimizer="rmsprop",
45 metrics=["accuracy"]
46 )
---> 48 history = model.fit(
49 train_ds,
50 epochs=epochs,
51 validation_data=val_ds,
52 callbacks=callbacks
53 )
55 history_dict = history.history
56 loss_valus = history_dict["loss"]
File /opt/conda/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py:122, in filter_traceback..error_handler(*args, **kwargs)
119 filtered_tb = _process_traceback_frames(e.traceback)
120 # To get the full stack trace, call:
121 #
keras.config.disable_traceback_filtering()
--> 122 raise e.with_traceback(filtered_tb) from None
123 finally:
124 del filtered_tb
File /opt/conda/lib/python3.10/site-packages/tensorflow/python/eager/execute.py:53, in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
51 try:
52 ctx.ensure_initialized()
---> 53 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
54 inputs, attrs, num_outputs)
55 except core._NotOkStatusException as e:
56 if name is not None:
InvalidArgumentError: Graph execution error:
Detected at node decode_image/DecodeImage defined at (most recent call last):
jpeg::Uncompress failed. Invalid JPEG data or crop window.
[[{{node decode_image/DecodeImage}}]]
[[IteratorGetNext]] [Op:__inference_one_step_on_iterator_11223]
2024-07-17 16:02:44.259599: E tensorflow/core/lib/jpeg/jpeg_mem.cc:327] Premature end of JPEG data. Stopped at line 446/454
2024-07-17 16:02:44.441775: E tensorflow/core/lib/jpeg/jpeg_mem.cc:327] Premature end of JPEG data. Stopped at line 350/454
The text was updated successfully, but these errors were encountered: