All Questions
Tagged with pythontensorflow
20,580 questions with no upvoted or accepted answers
22votes
1answer
3kviews
Resolving differences between Keras and scikit-learn for simple fully-connected neural network
I have built a fully-connected neural network in both scikit-learn (v 0.20.0) and Keras (v 2.2.4) with TensorFlow backend (v 1.12.0). There are 10 units in the single hidden layer. In both cases I ...
15votes
1answer
3kviews
How to use a CRF layer in Tensorflow 2 (using tfa.text)?
model= Sequential() model.add(keras.layers.Embedding(vocab_size,output_dim=100,input_length=input_len,weights=[embedding_matrix],trainable=False)) model.add(keras.layers.Bidirectional(keras.layers....
12votes
1answer
2kviews
Unable to see keras model graph in Tensorboard when using TensorFlow 2.0 Alpha
I am trying custom training on TensorFlow 2.0 alpha and at the same time I am trying to add some metrics and my training graph to TensorBoard. Consider the following contrived example import ...
12votes
0answers
582views
How to force PyCharm to evaluate tensorflow.contrib LazyLoader so it auto-completes?
Python novice here... If I only import TensorFlow's root package, auto-complete doesn't seem to work for tf.contrib due to that module being loaded through LazyLoader: However, if I import tensorflow....
12votes
1answer
4kviews
Does tensorflow or python have memory cleanup issues when using multiple models in loop?
I am working on a tensorflow model which takes pretty much RAM. It is executed iteratively to process given tasks. However, with increasing time the whole process starts consuming more and more RAM ...
11votes
1answer
3kviews
How to get sample weights and class weights for multi-label classification problem?
I'm trying to build a neural network for a multi-label classification problem. Situation In an input image there could be multiple output classes (and they're not mutually exclusive). There are ...
11votes
1answer
6kviews
Using Tensorflow 2.0 and eager execution without Keras
So this question might stem from a lack of knowledge about tensorflow. But I am trying to build a multilayer perceptron with tensorflow 2.0, but without Keras. The reason being that it is a ...
11votes
2answers
1kviews
Tensorflow Eager Execution - Compute gradient between two layers of a sequential model
I am trying to follow along with the guide at http://www.hackevolve.com/where-cnn-is-looking-grad-cam/, using Tensorflow's new eager execution mode. One line in particular has me stumped: grads = K....
11votes
0answers
2kviews
Set static shapes in an existing tensorflow graph where dynamic shapes are used for input
I have been given a frozen (.pb) graph that has dynamic shapes for input (e.g. "None, None, None, 3" or "?x?x?x3"). I want to set these to a static shape (e.g. "1, 320, 320, 3"), however I am unsure ...
11votes
0answers
643views
Jointly training custom model with Tensorflow Object Detection API
I am trying to use Tensorflow object detection API models in another custom model I built (in the same codebase). Specifically, I am trying to figure out how below can be handled (mutually exclusive ...
11votes
0answers
1kviews
Is it possible to save the class/label mapping directly inside a keras model.h5 file?
Using model.save() I am able to save the trained model. However, upon using the model for predictions, I still need to recover the respective class/label mappings (0: 'cat', 1: 'dog' ... etc.). ...
11votes
0answers
2kviews
How to decode Unicode string in Tensorflow's graph pipeline
I have created a tfRecord file to store data. I have to store Hindi text so, I have saved it in the bytes using string.encode('utf-8'). But, I am stuck at the time of reading the data. I am reading ...
11votes
0answers
7kviews
How to properly reduce the size of a tensorflow savedmodel?
I have a tensorflow pre-trained model in a checkpoint form, and I intended to deploy the model for serving by converting the model into the savedmodel form. The size of the saved model is kind of too ...
11votes
0answers
867views
how to get top-k best candidate sequences when using CRF for decoding in tensorflow
CRF++ allows us to get marginal probabilities for each tag (a kind of confidece measure for each output tag) and a conditional probably for the output (confidence measure for the entire output). % ...
11votes
1answer
899views
TensorFlow Example vs SequenceExample
Theres not that much information given in the TensorFlow documentation: https://www.tensorflow.org/api_docs/python/tf/train/Example https://www.tensorflow.org/api_docs/python/tf/train/SequenceExample ...