[Python] tensorflow/core/framework/local_rendezvous.cc:407] Local rendezvous is aborting with...

Discussão em 'Python' iniciado por Stack, Maio 10, 2025.

  1. Stack

    Stack Membro Participativo

    I am experiencing an issue with an image classification model.

    After extracting frames from videos, saving them in a suitable folder structure for creating an image dataset from a directory using tf.keras.utils.image_dataset_from_directory, and verifying the size of the created dataset, I am encountering an error message – though I believe it might be a warning – stating: 'tensorflow/core/framework/local_rendezvous.cc:407] Local rendezvous is aborting with status: OUT_OF_RANGE: End of sequence'.

    I have added programming logic to the code to print the shape of the images and the shape of the labels once the dataset is created. However, I have observed in the execution log that the aforementioned message continues to appear.

    Does anyone know why this message is occurring?

    Here is the programming logic code:

    def create_image_dataset(directory, img_size, batch_size, seed=None):
    """Creates a tf.data.Dataset from a main directory.

    Args:
    directory: Main directory containing subdirectories with the images.
    img_size: Size to which the images will be resized.
    batch_size: Batch size.
    seed: Random seed.

    Returns:
    A tf.data.Dataset.
    """
    directory = os.path.abspath(directory)
    directory = os.path.normpath(directory) # Normalize the path
    print(f"Creating dataset from: {directory}")
    try:
    dataset = tf.keras.utils.image_dataset_from_directory(
    directory,
    labels='inferred',
    label_mode='categorical',
    image_size=img_size,
    batch_size=batch_size,
    shuffle=True,
    seed=seed
    )
    print(f"Dataset created successfully from: {directory}")
    return dataset
    except ValueError as e:
    print(f"Error creating dataset from: {directory}. Error: {e}. Directory: {directory}")
    return None

    # Create the dataset
    print(f"Creating dataset from the directory: {DATASET_DIR}") # Path debugging
    dataset = create_image_dataset(DATASET_DIR, IMG_SIZE, BATCH_SIZE, seed=SEED)

    # Print the dataset size
    if dataset:
    print("Dataset size:", len(list(dataset.as_numpy_iterator())))
    # Get one batch from the dataset to inspect its shape
    for images, labels in dataset.take(1):
    print("Shape of the images:", images.shape)
    print("Shape of the labels:", labels.shape)


    And here is a portion of the code execution log:

    Found 9108 files belonging to 4 classes.
    025-05-09 18:29:36.880956: I tensorflow/core/framework/local_rendezvous.cc:407] Local rendezvous is aborting with status: OUT_OF_RANGE: End of sequence
    Tama�o del dataset: 285
    Forma de las im�genes: (32, 224, 224, 3)
    Forma de las etiquetas: (32, 4)
    2025-05-09 18:29:37.102376: I tensorflow/core/framework/local_rendezvous.cc:407] Local rendezvous is aborting with status: OUT_OF_RANGE: End of sequence

    Continue reading...

Compartilhe esta Página