Category : tensorflow2.0

I am training my models and I have written some Keras custom callbacks, which I wrap in a tf.keras.callbacks.CallbackList and call using the .on_train/epoch/batch_begin/end() functions. These functions take two arguments, epoch/batch and logs, which is a dictionary containing some ad hoc values that you would set, as far as I understand, using the high level ..

Read more

belos is my code to ensure that the folder has images, but tf.keras.preprocessing.image_dataset_from_directory returns no images found. What did I do wrong? Thanks. DATASET_PATH = pathlib.Path(‘C:UsersxxxDocumentsimages’) image_count = len(list(DATASET_PATH.glob(‘.*.jpg’))) print(image_count) output = 2715 batch_size = 4 img_height = 32 img_width = 32 train_ds = tf.keras.preprocessing.image_dataset_from_directory( DATASET_PATH.name, validation_split=0.8, subset="training", seed=123, image_size=(img_height, img_width), batch_size=batch_size) output: Found 0 ..

Read more

I keep getting this error when running my python 3.8 code: AttributeError: module ‘tensorflow._api.v2.train’ has no attribute ‘SessionRunHook’ I previously read that this is because the tensorflow version is not correct. How do I use a different version of tensorflow? I have tried: import tensorflow as tf tf.compat.v1.disable_v2_behavior() print(tf.__version__) but it still shows that I ..

Read more

I am currently trying to use a Tensorflow dataset as input to the predict() function of a tensorflow model. For some reason, I always get an error, details are below. I have the following generator: def create_dataset(Q, unary_potentials, features_1, features_2, features_3, kernel_size, depth_image): height, width, _ = np.shape(unary_potentials) Q = np.pad(Q, [[kernel_size, kernel_size], [kernel_size, kernel_size], ..

Read more

In tf 2.5, there are two functions for cropping an image: tf.image.stateless_random_crop, and tf.image.random_crop. The documentation states that stateless_random_crop is deterministic (always returns the same crop given one seed). However, random_crop has a seed parameter and is also deterministic, one would think. What is the actual difference between these two functions? I cannot find information ..

Read more