keras

Training a tf.keras model with a basic low-level TensorFlow training loop doesn't work

冷暖自知 提交于 2021-02-06 09:55:28
问题 Note: All code for a self-contained example to reproduce my problem can be found below. I have a tf.keras.models.Model instance and need to train it with a training loop written in the low-level TensorFlow API. The problem: Training the exact same tf.keras model once with a basic, standard low-level TensorFlow training loop and once with Keras' own model.fit() method produces very different results. I would like to find out what I'm doing wrong in my low-level TF training loop. The model is a

Keras, TensorFlow : “TypeError: Cannot interpret feed_dict key as Tensor”

余生颓废 提交于 2021-02-06 09:22:14
问题 I am trying to use keras fune-tuning to develop image classify applications. I deployed that application to a web server and the image classification is succeeded. However, when the application is used from two or more computers at the same time, the following error message appears and the application doesn't work. TypeError: Cannot interpret feed_dict key as Tensor: Tensor Tensor("Placeholder:0", shape=(3, 3, 3, 64), dtype=float32) is not an element of this graph. Here is my code for image

Keras, TensorFlow : “TypeError: Cannot interpret feed_dict key as Tensor”

╄→гoц情女王★ 提交于 2021-02-06 09:20:32
问题 I am trying to use keras fune-tuning to develop image classify applications. I deployed that application to a web server and the image classification is succeeded. However, when the application is used from two or more computers at the same time, the following error message appears and the application doesn't work. TypeError: Cannot interpret feed_dict key as Tensor: Tensor Tensor("Placeholder:0", shape=(3, 3, 3, 64), dtype=float32) is not an element of this graph. Here is my code for image

Quantize a Keras neural network model

拈花ヽ惹草 提交于 2021-02-06 01:45:23
问题 Recently, I've started creating neural networks with Tensorflow + Keras and I would like to try the quantization feature available in Tensorflow. So far, experimenting with examples from TF tutorials worked just fine and I have this basic working example (from https://www.tensorflow.org/tutorials/keras/basic_classification): import tensorflow as tf from tensorflow import keras fashion_mnist = keras.datasets.fashion_mnist (train_images, train_labels), (test_images, test_labels) = fashion_mnist

Quantize a Keras neural network model

自作多情 提交于 2021-02-06 01:27:31
问题 Recently, I've started creating neural networks with Tensorflow + Keras and I would like to try the quantization feature available in Tensorflow. So far, experimenting with examples from TF tutorials worked just fine and I have this basic working example (from https://www.tensorflow.org/tutorials/keras/basic_classification): import tensorflow as tf from tensorflow import keras fashion_mnist = keras.datasets.fashion_mnist (train_images, train_labels), (test_images, test_labels) = fashion_mnist

CV学习笔记(二十二):CRNN+CTC

☆樱花仙子☆ 提交于 2021-02-05 14:27:28
作者:云时之间 来源:知乎 链接: https://zhuanlan.zhihu.com/p/142269888 编辑:王萌 上次的一篇文章说了下DenseNet,这一篇文章来说一下CRNN+CTC的识别原理以及实现过程。这篇文章原理部分主要参考于白裳老师的“一文读懂CRNN+CTC文字识别”,其中的CTC原理的讲解部分是我见过最清晰易懂的,值得好好读一下。 一:OCR识别流程 通常我们做文本识别主要做上图中的三件事,检测的方法比较多,这里说一下识别,之前我们传统的识别过程是将检测到的数字划分为单字符(投影法等),然后扔到CNN里去分类, 但是深度学习的发展,出现了end2end的识别方式,简单的来说就是我们不需要将检测到的数字划分为单字符,无论你检测的数字长度多长,尺寸多宽,直接从头到尾给你识别出来。 比如上图的银行卡号,传统的方式要分割成 这样单个字符,现在直接从左到右识别完整,这样一来,我们就将单个字符的识别问题转化为序列的识别问题。 现在端到端的识别主要有两种比较流行的方式,以银行卡OCR识别为例: CRNN+CTC,CNN+Seq2Seq+Attention是比较流行的方式,CRNN用的会更广泛些,因为Attention机制限制会比较大些,而这两者最主要的区别也就在这,两者都抛弃了softmax,而CRNN用了CTC来最后文本对齐,而CNN用了Attention机制

Keras: weighted binary crossentropy

旧时模样 提交于 2021-02-05 13:13:28
问题 I tried to implement a weighted binary crossentropy with Keras, but I am not sure if the code is correct. The training output seems to be a bit confusing. After a few epochs I just get an accuracy of ~0.15. I think thats much too less (even for a random guess). There are in general about 11% ones in the output and 89% zeros, therefore the weights are w_zero=0.89 and w_one=0.11. My code: def create_weighted_binary_crossentropy(zero_weight, one_weight): def weighted_binary_crossentropy(y_true,

Keras: weighted binary crossentropy

╄→гoц情女王★ 提交于 2021-02-05 13:12:08
问题 I tried to implement a weighted binary crossentropy with Keras, but I am not sure if the code is correct. The training output seems to be a bit confusing. After a few epochs I just get an accuracy of ~0.15. I think thats much too less (even for a random guess). There are in general about 11% ones in the output and 89% zeros, therefore the weights are w_zero=0.89 and w_one=0.11. My code: def create_weighted_binary_crossentropy(zero_weight, one_weight): def weighted_binary_crossentropy(y_true,

Keras NN regression model gives low loss, and 0 acuracy

送分小仙女□ 提交于 2021-02-05 12:30:15
问题 I am having a problem with this NN regression model in keras. I am working on a cars dataset to predict the price based on 13 dimensions. In short, I have read it as pandas dataframe, converted numeric values to float, scaled the values, and then used one-hot encoding for categorical values, which has created a lot of new columns, but that does not concern me much at this point. What concerns me is that the accuracy is practically 0%, and I cannot figure out why. Dataset can be found here:

Keras NN regression model gives low loss, and 0 acuracy

邮差的信 提交于 2021-02-05 12:22:19
问题 I am having a problem with this NN regression model in keras. I am working on a cars dataset to predict the price based on 13 dimensions. In short, I have read it as pandas dataframe, converted numeric values to float, scaled the values, and then used one-hot encoding for categorical values, which has created a lot of new columns, but that does not concern me much at this point. What concerns me is that the accuracy is practically 0%, and I cannot figure out why. Dataset can be found here: