keras

TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string

你离开我真会死。 提交于 2020-12-30 07:56:39
问题 I am running this code from the tutorial here: https://keras.io/examples/vision/image_classification_from_scratch/ with a custom dataset, that is divided in 2 datasets as in the tutorial. However, I got this error: TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string. I made this casting. I tried this: is_jfif = str(tf.compat.as_bytes("JFIF")) in fobj.peek(10) but nothing changed as far as the error I am trying all day to figure out how to

TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string

这一生的挚爱 提交于 2020-12-30 07:56:11
问题 I am running this code from the tutorial here: https://keras.io/examples/vision/image_classification_from_scratch/ with a custom dataset, that is divided in 2 datasets as in the tutorial. However, I got this error: TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string. I made this casting. I tried this: is_jfif = str(tf.compat.as_bytes("JFIF")) in fobj.peek(10) but nothing changed as far as the error I am trying all day to figure out how to

Keras Sequential without providing input shape

你说的曾经没有我的故事 提交于 2020-12-30 07:00:06
问题 I currently have a keras model that looks like this: model = keras.Sequential() model.add(keras.layers.Dense(100, activation=tf.nn.relu)) model.add(keras.layers.Dense(100, activation=tf.nn.relu)) model.add(keras.layers.Dense(len(labels), activation=tf.nn.softmax)) The Keras documentation tells me: The model needs to know what input shape it should expect. For this reason, the first layer in a Sequential model (and only the first, because following layers can do automatic shape inference)

In Keras “ImageDataGenerator”, is “validation_split” parameter a kind of K-fold cross validation?

隐身守侯 提交于 2020-12-30 03:59:06
问题 I am trying to do K-fold cross validation on Keras model (with ImageDataGenerator and flow_from_directory for training and validation data), I want to know if the argument "validation_split" in "ImageDataGenerator" test_datagen = ImageDataGenerator( rescale=1. / 255, rotation_range = 180, width_shift_range = 0.2, height_shift_range = 0.2, brightness_range = (0.8, 1.2), shear_range = 0.2, zoom_range = 0.2, horizontal_flip = True, vertical_flip = True, validation_split = 0.1 ) train_datagen =

Compatibility between keras and tf.keras models

怎甘沉沦 提交于 2020-12-29 18:17:54
问题 I am interested in training a model in tf.keras and then loading it with keras. I know this is not highly-advised, but I am interested in using tf.keras to train the model because tf.keras is easier to build input pipelines I want to take advantage of the tf.dataset API and I am interested in loading it with keras because I want to use coreml to deploy the model to ios. I want to use coremltools to convert my model to ios, and coreml tools only works with keras, not tf.keras. I have run into

Compatibility between keras and tf.keras models

北战南征 提交于 2020-12-29 18:17:18
问题 I am interested in training a model in tf.keras and then loading it with keras. I know this is not highly-advised, but I am interested in using tf.keras to train the model because tf.keras is easier to build input pipelines I want to take advantage of the tf.dataset API and I am interested in loading it with keras because I want to use coreml to deploy the model to ios. I want to use coremltools to convert my model to ios, and coreml tools only works with keras, not tf.keras. I have run into

Compatibility between keras and tf.keras models

扶醉桌前 提交于 2020-12-29 18:16:37
问题 I am interested in training a model in tf.keras and then loading it with keras. I know this is not highly-advised, but I am interested in using tf.keras to train the model because tf.keras is easier to build input pipelines I want to take advantage of the tf.dataset API and I am interested in loading it with keras because I want to use coreml to deploy the model to ios. I want to use coremltools to convert my model to ios, and coreml tools only works with keras, not tf.keras. I have run into

Implementing custom loss function in keras with condition

杀马特。学长 韩版系。学妹 提交于 2020-12-29 10:45:44
问题 I need some help with keras loss function. I have been implementing custom loss function on keras with Tensorflow backend. I have implemented the custom loss function in numpy but it would be great if it could be translated into keras loss function. The loss function takes dataframe and series of user id. The Euclidean distance for same user_id are positive and negative if the user_id are different. The function returns summed up scalar distance of the dataframe. def custom_loss_numpy

Implementing custom loss function in keras with condition

情到浓时终转凉″ 提交于 2020-12-29 10:45:08
问题 I need some help with keras loss function. I have been implementing custom loss function on keras with Tensorflow backend. I have implemented the custom loss function in numpy but it would be great if it could be translated into keras loss function. The loss function takes dataframe and series of user id. The Euclidean distance for same user_id are positive and negative if the user_id are different. The function returns summed up scalar distance of the dataframe. def custom_loss_numpy

Issue with add method in tensorflow : AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike'

若如初见. 提交于 2020-12-29 09:37:12
问题 import keras as K from keras.models import Sequential from keras.layers import Dense from tensorflow import set_random_seed for hidden_neuron in hidden_neurons: model = Sequential() model.add(Dense(hidden_neuron, input_dim=61, activation='relu')) -> i am getting error at this line. I am not really sure what am i missing here. Traceback (most recent call last): File "PycharmProjects/HW2/venv/bin/hw3q4.py", line 46, in model.add(Dense(hidden_neuron, input_dim=61, activation='relu')) File "