Questions tagged [tensorflow2.0]
Use this tag when asking about TensorFlow 2.0. You may consider using the [tag: tf.keras] tag for questions specific to that API.
5,766
questions
0
votes
0
answers
4
views
How to remove this Warning of casting imaginary into real values within tape.gradient method of tensorflow?
I am using tape.gradient method for optimising some neural networks. It works as expected but keeps giving this warning when I calculate the gradient using tape.gradients.
WARNING:tensorflow:You are ...
0
votes
0
answers
7
views
Any Tensorflow-text >= 2.11.0 Windows installer available?
From 2.11.0 version there is no Tensorflow-text Windows installer as stated here
Is it any available 3rd-party build for Windows available?
I googled it but even didn't find any mention.
0
votes
0
answers
16
views
AttributeError: module 'tensorflow' has no attribute 'contrib' Tensorflow Object Detection API
when I try to run the verification script for the Tensorflow object detection model api I get the following error: AttributeError: module 'tensorflow' has no attribute 'contrib'.
I have Tensorflow 2....
0
votes
0
answers
15
views
why I am getting the "ValueError: axes don't match array" when trying test the model in tensorflow for Speech emotion Recognition
I am working on SER with model TIMNET. The main coed is here:
authors of the code provided pretrained models and what you have to do is copy and paste the command they provided in the terminal. for ...
0
votes
1
answer
23
views
When training tensorflow, reducing the batch size does not change the GPU memory
When training tensorflow, reducing the batch size does not change the GPU memory.
Server specifications
OS : Ubuntu 22.04 LTS
GPU : TITAN RTX
NVIDIA Diriver : 525.125
CUDA : 11.8
Cudnn : 8.6.0
Python ...
0
votes
0
answers
9
views
how do I quantize with dynamic range a fine-tuned mobilenet V2 model with new classification head
I have been trying all day to quantize a fine-tuned model I have so I can deploy it to an edge TPU device and I have had 0 success.
I have tried quantizing the model with many permutations of the code ...
0
votes
0
answers
7
views
How to use SortPooling layer of Stellargraph in a Keras Model? I have my feature array, but how to give the mask attribute?
I want to use SortPooling layer from Stellargraph library in a Keras-Tensorflow (2.0) model. How to give mask attribute while calling the sortpool? What does it signify?
It gives me an error asking ...
0
votes
0
answers
12
views
How to use nsl.keras.AdversarialRegularization as an output tensor for multibranch models
I have a multi branch model in tensorflow. I have many branches but I simplified the code to provide an example.
def create_multi_branch_model(
num_category_classes, num_subcategory_classes):
...
0
votes
0
answers
3
views
How can I solve an input keras problem in custom class for CNN?
I'm trying to reproduce this code results, which is a semantic segmentation CNN, but I've got trouble instatiating the class in their training.
I've installed tensorflow gpu 2.1.0, cuda release 11.0, ...
-2
votes
0
answers
23
views
TensorFlow does not detect my GTX 1650. How do I fix it?
I'm trying to use my GTX 1650 for deep learning. But the tensorflow module doesnot list my gpu.
I've installed the CUDA drivers version:11.5
CdNN version: 8.3
How do I make my gpu detectable. Please ...
0
votes
0
answers
11
views
How to plot a local volatility surface created with local_volatility_model taken from tensorflow quant_finance.models
I have created a local volatility surface with the local_volatility_model (taken from tensorflow quant_finance.models) using the following code:
lv = tf_quant_finance.experimental.local_volatility....
0
votes
0
answers
14
views
Tensorflow 2.0 - Training model issues
I am currently learning how to train a model object detection using google colab and tensorflow 2.0 based on this website link Link
During training the model process we received this output in the ...
0
votes
0
answers
22
views
why @tensorflow/tfjs-react-native not installing in react-native 0.724?
I want to use bodySegmentation model in react-native(0.72.4) project. I installed expo-gl(13.2.0),expo-gl-cpp(11.4.0),tensorflow/tfjs(4.11.0), react(18.2.0) but when i'm trying to install tensorflow/...
0
votes
0
answers
10
views
How to add Data_augmentation to a CNN Sequential model with CIFAR10 dataset
####New to the stack overflow community. Thank you in advance for everyone's help####
I am trying to add data augmentation to a CNN Sequential Model to see how it affects on generalization. I have ...
0
votes
0
answers
14
views
TensorFlow with shape=<unkown> after tf.data.Dataset.from_generator
I'm trying to generate a tensor from a dataset of the following format:
[
([[101, 4640, 8684, 2443, 3874, 5772, 6388, 1280, 102], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0]], 1),...
0
votes
0
answers
19
views
TensorFlow Linear Regression gives 'NaN' result with larger dataset
I am trying to create model for linear regression, but when I'm using large dataset (1000+ records) my model stops returning values.
Here is example of my dataset
Here is my model
import pandas as pd
...
0
votes
0
answers
15
views
InternalError: Failed copying input tensor from
When I use tensorflow to build a 1D-CNN model, i got this problem.
My GPU is RTX3070Ti and tensorflow version is 2.10.1 and the python environment is 3.9.2 64-bit.
The same code was used in different ...
1
vote
0
answers
11
views
TFRecord Magic Bytes
Does a TFRecord file have any magic bytes that can be used to identify it?
0
votes
0
answers
14
views
Could not broadcast input array from shape (320,320,1,8) into shape (320,320,1)
Hi everyone Really need your help cause I am stuck with this problem for quite sometimes already 🥹
I want to perform multi- class segmentation. My images are in 0 to 255 values, while my masks are ...
0
votes
0
answers
9
views
How to use tensorflow 2.10 with large dataset?
I am using a large dataset to train on tensorflow 2.10.
But I am getting error as GPU memory exhausted.
My thought was that using tf.data.Dataset.from_tensor_slices should resolve the problem. But the ...
0
votes
0
answers
41
views
TypeError: cross_val_score() got an unexpected keyword argument 'validation_batch_size' while trying to calculate and fitting scikeras KC model
I'm stuck at this point where I am unable to calculate cross_val_score() and further unable to fit the model as I keep getting the error 'TypeError: cross_val_score() got an unexpected keyword ...
0
votes
0
answers
17
views
MediaPipe Selfie Segmentation results not working as good as the demo
Hello I am basing myself on this demo
https://storage.googleapis.com/tfjs-models/demos/segmentation/index.html?model=blazepose
It works perfectly when I move my hands and I am far way.
But when I ...
1
vote
0
answers
22
views
How to train a neural network with a custom loss function that is informed by outputs from the input layer in TensorFlow 2?
This seems to be a very commonly asked question, but I am still struggling to find a minimal workable example to solidify my understanding. So here goes another attempt with a MWE.
I am trying to ...
0
votes
0
answers
12
views
Data sharding seems not work properly with tf.distribute.MultiWorkerMirroredStrategy()
I have a model trained under tf.distribute.MultiWorkerMirroredStrategy(), which could be run without errors. However, the training time doesn't decrease as expected compared with training with single-...
-2
votes
0
answers
31
views
CUDA has been installed in WSL2 Ubuntu but nvidia-smi is not found
I´m trying to enable gpu in WSL2 to use it in tensorflow. I followed tensorflow official site instructions and installed the following things in conda environment:
cudatoolkit 11.8,
cudnn 8.6,
...
1
vote
0
answers
33
views
How do I solve a nonlinear Least Squares Error problem using Tensorflow 2 in Python?
From known r, YC and ZC values I generate N (theta,YL) pairs using the equation:
YL = YC + ZC*tan(theta + r) + noise
Having N such (theta,YL) pairs I want to recover r, YC and ZC by minimizing an ...
0
votes
0
answers
12
views
UnicodeDecodeError: 'utf-8' in Tensorflow code
everyone.
I tried to write mnist recognition code.
however, the compiler shows error message
"UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc1 in position 138: invalid start byte"
...
0
votes
0
answers
9
views
How to pass 2 tf datasets to .fit as sequence and tags?
I’ve loaded two datasets with sentences and labels from txt file with TextLineDataset, vectorized them by .map. Now I need to pass this data to model.fit. And I’ve found, that I can’t pass datasets ...
-1
votes
0
answers
66
views
how to install tensorflow(2.4.0) version in Colab(google-colaboratory)?
colab
first i did install python 3.7.0
!tar xvfz Python-3.7.0.tgz
!Python-3.7.0/configure
!make
!sudo make install
and
i checked python and tensorflow version.
python==3.7.0
keras==2.4.0
...
0
votes
1
answer
19
views
problem in use batchNormalization in the first layer with tensorflow 2.2
I need to use batchnormalization in the first layer and still use tensorflow 2.2, as the place where the trained network model will be sent has a tensorflow of 2.2 and cannot be updated.
My code
There ...
0
votes
0
answers
21
views
Tensorfolow error when running %%bash cd /content/models/research python -m pip install
I am following a roboflow tutorial named "Roboflow-TensorFlow2-Object-Detection" on google colabs. But when I run
cd /content/models/research
python -m pip install .
I get the following ...
-1
votes
0
answers
24
views
RuntimeError: Error while calling cudaMalloc.... out of memory
I am trying to run a code on aws ec2 gpu instance. I am able to successfully run this code in google colab. I am getting out of memory error from dlib. My instance has 15306 MiB memory so I think its ...
0
votes
1
answer
31
views
Training custom data set model using mask_rcnn_inception from tensorflow model zoo on Macbook pro M2
Running into GPU related error while working with latest tensorflow ( 2.13 ) . Please note the test model training provided on tensorflow-metal page to verify my setup works fine.
Please advise.
Below ...
0
votes
0
answers
22
views
Tensorflow2.x UnimplementedError: Cast string to float is not supported data in tf.data.dataset format with text, numeric & categorical features
I have beginner/intermediate level knowledge of TensorFlow. I have a deep learning model that has text, numeric & categorical inputs. The target is an empirical distribution with 19 bins. The text ...
0
votes
0
answers
37
views
how to ensure tensorflow gpu version is in use with docker image?
I am using tensorflow 2.13 with help of docker file available within tensorflow models/research/object_detection/dockerfiles folder.
The Docker file contents are
FROM tensorflow/tensorflow:latest-gpu
...
0
votes
0
answers
17
views
TypeError: Layer input_spec must be an instance of InputSpec. Got: InputSpec(shape=(None, 48, 768), ndim=3)
I am doing a multi -class classification task, the TensorFlow version is 2.7.0, and the Python version is 3.9. When I create a model, I reported the following errors:
TypeError: Exception encountered ...
0
votes
0
answers
12
views
Different performance of Mask R-CNN Inception ResNet V2 in TF1 and TF2?
I am trying to migrate my project from TF1 to TF2. However, after certain round of training, I noticed that the training conducted in TF2 was not capable of capturing certain object characteristic (...
1
vote
0
answers
59
views
Parallelize DeepFace on multiple GPUs
I am trying to use the DeepFace python library to do face recognition and analysis on long videos: https://github.com/serengil/deepface.
Using the library out of the box, I am able to get desired ...
0
votes
0
answers
19
views
Pixelwise weighted binary cross entropy?
I am writing a custom loss function in tensorflow to calulate the pixelwise weighted binary cross entropy, for a segmentation network.
I am using TensorFlow 2.12.0, numpy 1.22.3 and keras as my ...
0
votes
0
answers
19
views
How to plot validation loss in tensorboard?
I'd like to see validation loss in tesnorboard along with train loss. However I only see the train loss and the validation loss of the last checkpoint. I'm training a Faster R-CNN for object detection....
0
votes
0
answers
4
views
Tensorflow NN only evaluates for single values
I have a neural network which I want to evaluate and I have a set of numerical values.
t=[(i-1)/(l-1) for i in range(1,l+1)]
bx = normalize([4*math.pi*i*math.cos(4*math.pi*i) for i in t])
by = ...
-2
votes
1
answer
80
views
How can I correct my Time Series LSTM RNN for Binary Classification favoring Class 0?
I am attempting to predict a binary outcome based on 15 continuous sequences (except one which isn't a continuous line, but still a sequence). The dataset contains 933k datapoints for all 15 features ...
0
votes
1
answer
24
views
Tensorflow Scalar Multiplication with Batches
I would like to create a tensorflow layer that takes in n inputs, n-1 are data points and the last is a weight vector of length n-1. Each of the (i in n-1) data points are then multiplied by the value ...
-1
votes
1
answer
54
views
Hello World Neural Network to understand basics
I am trying to build a noob neural net using tensorflow that learns to solve the equation y = 2x - 1
Training data -
xs = [0,1,2,3,4,5]
ys = [-1,1,3,5,7,9]
xs = np.array(xs, dtype=float)
ys = np....
1
vote
0
answers
15
views
Can you explain to me how to apply Policy updates in a Policy Gradient algorithm ? (Python)
I code a Policy Gradient algorithm in python with Tensorflow and I would like to know how to modify the neural network (updating the Policy).
My current code:
import tensorflow as tf
from random ...
0
votes
1
answer
58
views
tf.keras.optimizers.Adam.apply_gradients triggers tf.function retracing
I'm getting a memory leak and I believe it to be linked to the following warning:
WARNING:tensorflow:6 out of the last 6 calls to <function _BaseOptimizer._update_step_xla at 0x7fa9f8074c20> ...
-2
votes
0
answers
22
views
I am getting an error when installing Multiplanar Unet(mpunet) for training the 3d image segmentation of Heart
When I attempt to install MultiPlanarUnet it returns the following error;
pip install -e MultiPlanarUnet
ERROR: Ignored the following versions that require a different python version: 1.11.0
...
2
votes
1
answer
48
views
How to obtain all layers within a custom layer subclassed from keras.layers
I'm trying to get all layers from within a custom layer subclassed from tf.keras.layers but I am having difficulties with this. The end goal is to create a DAG (Directed Acyclic Graph) that has layers ...
0
votes
0
answers
16
views
How to convert Tensorflow Multi-head attention to PyTorch?
I'm converting a Tensorflow transformer model to Pytorch equivalent.
In TF multi-head attention part of the code I have:
att = layers.MultiHeadAttention(num_heads=6, key_dim=4)
and the input shape is [...
0
votes
0
answers
17
views
Trying to run tensorflow graphics home page demo from comamnd line throws an error
I am a bit of a ML / TF / Python noob but have made good progress. i.e. can train basic models and use for inference with TF 2.13 - non gpu version.
While trying to run the example here - TensorFlow ...