tensorflow

How to fix ' module 'keras.backend.tensorflow_backend' has no attribute '_is_tf_1''

狂风中的少年 提交于 2021-01-02 05:37:03
问题 While training the yolov3 framework, there's always this module error I have tried reinstalling keras and tensorflow, and the version of keras is 2.3.0 and the version of tensorflow is 1.14.0. Traceback (most recent call last): File "train.py", line 6, in <module> import keras.backend as K File "F:\Anacoda\lib\site-packages\keras\__init__.py", line 3, in <module> from . import utils File "F:\Anacoda\lib\site-packages\keras\utils\__init__.py", line 27, in <module> from .multi_gpu_utils import

keras (tensorflow backend) conditional assignment with K.switch()

╄→гoц情女王★ 提交于 2021-01-01 13:35:18
问题 I'm trying to implement something like if np.max(subgrid) == np.min(subgrid): middle_middle = cur_subgrid + 1 else: middle_middle = cur_subgrid Since the condition can only be determined at run-time, I'm using Keras syntax as following middle_middle = K.switch(K.max(subgrid) == K.min(subgrid), lambda: tf.add(cur_subgrid,1), lambda: cur_subgrid) But I'm getting this error: <ipython-input-112-0504ce070e71> in col_loop(j, gray_map, mask_A) 56 57 ---> 58 middle_middle = K.switch(K.max(subgrid) ==

keras (tensorflow backend) conditional assignment with K.switch()

断了今生、忘了曾经 提交于 2021-01-01 13:34:30
问题 I'm trying to implement something like if np.max(subgrid) == np.min(subgrid): middle_middle = cur_subgrid + 1 else: middle_middle = cur_subgrid Since the condition can only be determined at run-time, I'm using Keras syntax as following middle_middle = K.switch(K.max(subgrid) == K.min(subgrid), lambda: tf.add(cur_subgrid,1), lambda: cur_subgrid) But I'm getting this error: <ipython-input-112-0504ce070e71> in col_loop(j, gray_map, mask_A) 56 57 ---> 58 middle_middle = K.switch(K.max(subgrid) ==

Are there any hidden layers in the following model, or just Input and output layers?

試著忘記壹切 提交于 2021-01-01 09:19:20
问题 Are there any hidden layers in the following model, or just Input and output layers? model = tf.keras.models.Sequential() model.add(tf.keras.layers.Dense(1024, activation='relu', input_dim=1)) model.add(tf.keras.layers.Dense(1,)) 回答1: The first Dense layer is the hidden layer. Keras internally assigns an input layer for the model, with 1 input unit (the parameter of input_dim ) 回答2: there is one hidden dense layer with 1024 neuron and relu activation function. can plot model with: tf.keras

Custom loss function not improving with epochs

白昼怎懂夜的黑 提交于 2021-01-01 09:08:43
问题 I have created a custom loss function to deal with binary class imbalance, but my loss function does not improve per epoch. For metrics, I'm using precision and recall. Is this a design issue where I'm not picking good hyper-parameters? weights = [np.array([.10,.90]), np.array([.5,.5]), np.array([.1,.99]), np.array([.25,.75]), np.array([.35,.65])] for weight in weights: print('Model with weights {a}'.format(a=weight)) model = keras.models.Sequential([ keras.layers.Flatten(), #input_shape=[X

Custom loss function not improving with epochs

最后都变了- 提交于 2021-01-01 09:08:33
问题 I have created a custom loss function to deal with binary class imbalance, but my loss function does not improve per epoch. For metrics, I'm using precision and recall. Is this a design issue where I'm not picking good hyper-parameters? weights = [np.array([.10,.90]), np.array([.5,.5]), np.array([.1,.99]), np.array([.25,.75]), np.array([.35,.65])] for weight in weights: print('Model with weights {a}'.format(a=weight)) model = keras.models.Sequential([ keras.layers.Flatten(), #input_shape=[X

Using tensorflow.keras model in pyspark UDF generates a pickle error

最后都变了- 提交于 2021-01-01 07:02:47
问题 I would like to use a tensorflow.keras model in a pysark pandas_udf. However, I get a pickle error when the model is being serialized before sending it to the workers. I am not sure I am using the best method to perform what I want, therefore I will expose a minimal but complete example. Packages: tensorflow-2.2.0 (but error is triggered to all previous versions too) pyspark-2.4.5 The import statements are: import pandas as pd import numpy as np from tensorflow.keras.models import Sequential

No OpKernel was registered to support Op 'PyFunc' when loading model in Java

两盒软妹~` 提交于 2021-01-01 04:42:32
问题 Here is the question. I am using tensorflow:1.8.0-rc0 Java to load the model saved by python ( tf.saved_model.builder.SavedModelBuilder ). The model is saved and I can see the variables files. However, when I try to load this model in Java. using SavedModelBundle.load(featureExtractionModel,"foo-tag"); I get the following issue Exception in thread "main" java.lang.IllegalArgumentException: No OpKernel was registered to support Op 'PyFunc' with these attrs. Registered devices: [CPU],

No OpKernel was registered to support Op 'PyFunc' when loading model in Java

时光毁灭记忆、已成空白 提交于 2021-01-01 04:39:50
问题 Here is the question. I am using tensorflow:1.8.0-rc0 Java to load the model saved by python ( tf.saved_model.builder.SavedModelBuilder ). The model is saved and I can see the variables files. However, when I try to load this model in Java. using SavedModelBundle.load(featureExtractionModel,"foo-tag"); I get the following issue Exception in thread "main" java.lang.IllegalArgumentException: No OpKernel was registered to support Op 'PyFunc' with these attrs. Registered devices: [CPU],

No OpKernel was registered to support Op 'PyFunc' when loading model in Java

此生再无相见时 提交于 2021-01-01 04:39:34
问题 Here is the question. I am using tensorflow:1.8.0-rc0 Java to load the model saved by python ( tf.saved_model.builder.SavedModelBuilder ). The model is saved and I can see the variables files. However, when I try to load this model in Java. using SavedModelBundle.load(featureExtractionModel,"foo-tag"); I get the following issue Exception in thread "main" java.lang.IllegalArgumentException: No OpKernel was registered to support Op 'PyFunc' with these attrs. Registered devices: [CPU],