Skip to content

error al ejecutar el jupiter TransferLearning(VGG16).ipynb #5

@newtonPascal

Description

@newtonPascal

Buenos dias a todos
siguiendo la linea del ejercicio que alex propone, ademas es muy interesante y se le agradece mucho compartir con nosotros. me sale el siguiente error cuando ejecuto el script

##CREAR LA RED VGG16

cnn=modelo()

cnn.compile(loss='categorical_crossentropy',
optimizer=optimizers.Adam(lr=lr),
metrics=['accuracy'])

Alguien mas sabe la solucion? como dice el error el esta esperando shape (224, 224, 3) pero le estoy mandado shape (150, 150, 3)

gracias

El error es el siguiente cuando ejecuto toda la linea de cuaderno
Found 999 images belonging to 3 classes.
Found 2051 images belonging to 3 classes.
Epoch 1/20

ValueError Traceback (most recent call last)
in
72 epochs=epocas,
73 validation_data=validacion_generador,
---> 74 validation_steps=validation_steps)
75
76 target_dir = './modelo/'

~\Anaconda3\envs\animales_tf\lib\site-packages\tensorflow_core\python\keras\engine\training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, validation_freq, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
1294 shuffle=shuffle,
1295 initial_epoch=initial_epoch,
-> 1296 steps_name='steps_per_epoch')
1297
1298 def evaluate_generator(self,

~\Anaconda3\envs\animales_tf\lib\site-packages\tensorflow_core\python\keras\engine\training_generator.py in model_iteration(model, data, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, validation_freq, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch, mode, batch_size, steps_name, **kwargs)
263
264 is_deferred = not model._is_compiled
--> 265 batch_outs = batch_function(*batch_data)
266 if not isinstance(batch_outs, list):
267 batch_outs = [batch_outs]

~\Anaconda3\envs\animales_tf\lib\site-packages\tensorflow_core\python\keras\engine\training.py in train_on_batch(self, x, y, sample_weight, class_weight, reset_metrics)
989 x, y, sample_weights = self._standardize_user_data(
990 x, y, sample_weight=sample_weight, class_weight=class_weight,
--> 991 extract_tensors_from_dataset=True)
992
993 # If self._distribution_strategy is True, then we are in a replica context

~\Anaconda3\envs\animales_tf\lib\site-packages\tensorflow_core\python\keras\engine\training.py in _standardize_user_data(self, x, y, sample_weight, class_weight, batch_size, check_steps, steps_name, steps, validation_split, shuffle, extract_tensors_from_dataset)
2469 feed_input_shapes,
2470 check_batch_axis=False, # Don't enforce the batch size.
-> 2471 exception_prefix='input')
2472
2473 # Get typespecs for the input data and sanitize it if necessary.

~\Anaconda3\envs\animales_tf\lib\site-packages\tensorflow_core\python\keras\engine\training_utils.py in standardize_input_data(data, names, shapes, check_batch_axis, exception_prefix)
570 ': expected ' + names[i] + ' to have shape ' +
571 str(shape) + ' but got array with shape ' +
--> 572 str(data_shape))
573 return data
574

ValueError: Error when checking input: expected input_1 to have shape (224, 224, 3) but got array with shape (150, 150, 3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions