82,212 questions
-7
votes
0
answers
56
views
How can I project the 3D bounding boxes on an image [closed]
I am trying to project 3d bounding boxes on vehicles and pedestrians using a detector model. I ran the inference with 6 images and got output in the below format. Now i want to project the boxes on ...
0
votes
0
answers
30
views
TensorArray read when size is 0
num_items function throws
in user code:
File "/Users/anu/PycharmProjects/Siglip/KVCache.py", line 12, in num_items *
tf.cond( self.key_cache.size() > 0,
OutOfRangeError: Tried to read ...
1
vote
1
answer
49
views
ValueError: Can't convert non-rectangular Python sequence to Tensor in text-classification problem
I am building a text classification system which requires a large preprocessing and training script. The script reads variable-length token sequences and attempts to build a tf.data.Dataset using ...
1
vote
1
answer
51
views
EfficientNet-B7 Shape mismatch
working on project of image classification using efficientnet-B7 what is wrong in this code? why is the error showing when i run this line of code? the error state
Shape mismatch in layer #1 (named ...
3
votes
1
answer
43
views
How to fix ValueError: Only instances of keras.Layer can be added to a Sequential model when adding tensorflow_hub.KerasLayer?
I am learning TensorFlow and transfer learning, and I am trying to add a TensorFlow Hub feature extractor to a Keras Sequential model. But I get this error:
ValueError: Only instances of keras.Layer ...
0
votes
0
answers
40
views
Why is the wall time from the full trace different from the timer in the compute function?
In my custom operator(runs on cpu), I use butil::Timer to measure the time taken as shown below:
void Compute(OpKernelContext* ctx) override {
butil::Timer total_timer;
total_timer.start();
...
1
vote
1
answer
65
views
TPU Initialization Fails (OpKernel Missing) Despite Active TPU Runtime in Kaggle
I am facing a persistent issue when trying to initialize the TPU in my notebook. I have already confirmed that:
My account is Verified.
The Notebook Accelerator is set to TPU.
My TPU quota is ...
1
vote
0
answers
36
views
Compatibility between streamlit and protobuf
I am unable to use the print(tf.version.VERSION) to check the tensorflow version. Reason being tensorflow looks for runtime_version in protobuf (from what I have learnt) and that is only supported in ...
2
votes
0
answers
66
views
Issue Replicating TF-Lite Conv2D Quantized Inference Output
I am trying to reproduce the exact layer-wise output of a quantized EfficientNet model (TFLite model, TensorFlow 2.17) by re-implementing Conv2D, DepthwiseConv2D, FullyConnected, Add, Mul, Sub and ...
-4
votes
0
answers
31
views
Tensorflow GPU use in python 3.13 [duplicate]
Im trying to use tensorflow with gpu on my windows device, i have python 3.13 venv. Is newer version of tensorflow support gou acceleration on windows. Ive read that it stopped in tensorflow version 2....
0
votes
1
answer
101
views
PyInstaller - It does'nt generate an .exe file
I'm using pyinstaller main.spec command. The main.spec file is the next:
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['main.py', 'flujo.py', 'flujo_if.py', 'descarga_manual.py', '...
0
votes
1
answer
56
views
TensorFlow throws cuDNN/cuBLAS/cuFFT and MessageFactory errors on Kaggle
I am working on a Kaggle notebook where I am trying to import TensorFlow/Keras to build a simple neural network for tabular data.
However, even with Accelerator = None (CPU only), TensorFlow fails ...
0
votes
1
answer
164
views
Why does TFLite INT8 quantization decompose BatchMatMul (from Einsum) into many FullyConnected layers?
I’m debugging a model conversion using onnx2tf and post-training quantization issue involving Einsum, BatchMatMul, and FullyConnected layers across different model formats.
Pipeline:
ONNX → TF ...
Advice
1
vote
0
replies
39
views
Transfer Learning: How do I only save the parameter I trained to save disk space?
So, I am having a transfer learning project using VGG16, however as we all know its model size is over 500MB. I somply don't have enough disk space to save more than 200 instance of said model, ...
3
votes
1
answer
62
views
Unable to import_model .h5 in an attemp to try classification because of "BatchNormalization could not be deserialized properly"
I've got a very small python script using a Model.h5 which should be loaded in order to classify some pictures.
Here's my python script :
import tensorflow as tf
from os import walk
from keras.models ...
0
votes
1
answer
58
views
Tensor Flow -No attribute Contribute
I am trying to duplicate the code found here which says tested with TensorFlow 1.6.
I am using TF version 2.20.0 and really don't want to downgrade to 1.6 so I tried:
import tensorflow.compat.v1 as tf ...
Tooling
1
vote
2
replies
56
views
Is using TRT in Tensorflow 2.18+ possible?
I am aware that TensorFlow has announced that they will no longer support TRT. A while back the announced "Starting with TensorFlow 2.18, support for TensorRT will be dropped. TensorFlow 2.17 ...
0
votes
1
answer
103
views
multi output forcast shape prob. with keras.preprocessing.timeseries_dataset_from_array
The model was fuctioinnal with only one output, now I try to use multi output forcasting one timestep, but got this error:
Epoch 1/10
2025-11-04 16:20:09.341769: W tensorflow/core/framework/op_kernel....
0
votes
1
answer
50
views
How is cosine-similarity loss working together with a masking layer? Visualisation
I have batches containing windows containing embeddings/vectors. To keep it simple let's not assume sentence embeddings (actual case) but 1hot encoded vectors. They are padded. So in the example below ...
2
votes
1
answer
110
views
Will tf.keras.Sequential containing multiple custom layers be correctly fully serializable and deserializable in my case?
I am implementing a U-Net variant in TensorFlow/Keras with custom layers. In one of my layers custom layers UPDoubleConv, I have a Sequential self.blocks containing a repeated pattern of UpSampling2D ...
5
votes
1
answer
166
views
Implementing a LoRA wrapper for Conv2D in Tensorflow
I have recently been trying to port a LoRA for CNN method originally implemented in PyTorch to TensorFlow, but my implementation did not work well, and I require assistance in making it work.
My code ...
2
votes
2
answers
120
views
getting a tensor of shape (32,) instead of a single value as a label
when i try to print/plt.tile the label of an image, its printing the tensor(32,) instead of a single label value. When i tried to print before the resizing, it was printing fine.
Code:
####
# ...
2
votes
0
answers
42
views
what is the purpose of training=True argument? Is it an argument of keras.sequential() or not? [duplicate]
What is the purpose of training=True argument in the last line. I called help(tf.keras.Sequential) but could not find anything related to it. Also is it the argument of tf.keras.Sequential() or not
...
3
votes
1
answer
78
views
Tensorflow images guide not working in Google Colab
I'm trying to run the first guide from Tensorflow in Google Colab.
I import the dataset with
import pathlib
dataset_url = "https://storage.googleapis.com/download.tensorflow.org/example_images/...
2
votes
0
answers
91
views
ImportError: cannot import name 'model_lib_v2' from 'object_detection'
I'm attempting to train a model on TensorFlow, and I've used Nick's video as reference:
https://youtu.be/yqkISICHH-U?si=IYW6Jsqhs0gCwMyc&t=8267
I've experienced following error:
Traceback (most ...
0
votes
0
answers
23
views
Unable to install tensorflow in mac [duplicate]
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
1
vote
1
answer
57
views
TensorFlow Custom Training Loop with Mixed Precision Causing NaN Loss After Epoch 15
I am implementing a custom training loop in TensorFlow 2.18 with mixed precision (float16) for a large vision transformer model. The training runs fine for about 15 epochs, but then the loss suddenly ...
1
vote
1
answer
49
views
How to display the basic tensorflow Graph with trace_on() and trace_export() by tensorboard without the 'profiler' error?
I would like to learn the tensorflow. While, when I run the code in my google-colab, I had the error message:
'UnavailableError: Cannot export profiling results. No profiler is running.'.
The code is ...
0
votes
1
answer
307
views
TensorFlow not detecting NVIDIA GPU (RTX 3050, CUDA 12.7, TF 2.20.0) [duplicate]
I’ve been trying to get TensorFlow to use my GPU on Windows, and even though everything seems installed correctly, it shows 0 available GPUs.
System setup
Windows 11
RTX 3050 Laptop GPU
NVIDIA driver ...
1
vote
1
answer
77
views
Why GenPareto from Scipy and Tensorflow-Probability show difference?
I'm trying to understand why the Generalized Pareto distribution shows different results for the same parameters. The results from SciPy make sense, while the results from TensorFlow Probability do ...
-1
votes
1
answer
41
views
Pretrained ESRGAN (.pb) gives reddish or purple image — is this a preprocessing issue or model issue?
I'm trying to use a pretrained ESRGAN model that I downloaded in .pb format.
The model runs without errors, but the output image has a noticeable reddish/purple tint instead of the correct colors.
...
3
votes
0
answers
84
views
@tensorflow-models/face-landmarks-detection no longer works with tfjs. 403 error in network request for model
I get an error while trying to run tfjs. It was working last week but it seems that the url for model is no longer available. Any suggestions for working model url/refactor?
import {
createDetector,
...
2
votes
1
answer
373
views
Play Console warning: “Library that does not support 16 KB: base/lib/x86_64/libtensorflowlite_jni.so” when uploading AAB with TensorFlow Lite
I’m uploading my Android App Bundle (AAB) to Google Play Console and getting this warning:
Library that does not support 16 KB:
base/lib/x86_64/libtensorflowlite_jni.so after upgrading the lib
...
2
votes
1
answer
136
views
ERROR: No matching distribution found for tensorflow==2.12
I use macOS. I have to use LibRecommender in my code.
Python Version: 3.8.13
According to this link, the 2.10 is a suitable tensorflow version.
This is what's in my requirements.txt file I install ...
0
votes
0
answers
67
views
Streamlit app throwing "NotFittedError: idf vector is not fitted" even though TF-IDF pipeline is fitted and works locally
I trained a sentiment classification model using a scikit-learn Pipeline that includes a TfidfVectorizer and LogisticRegression classifier.
Everything works perfectly on my local machine, but when I ...
1
vote
1
answer
38
views
Do I need .repeat() or steps_per_epoch when training on a finite TFRecord dataset in Keras?
I’m following this tutorial on 3D brain tumor segmentation using MedicAI and Keras
In the tutorial:
dataset = dataset.batch(batch_size).prefetch(tf.data.AUTOTUNE)
The author does not use .repeat(...
1
vote
0
answers
54
views
Can I convert .keras model to .h5 so that tensorflow 2.10 can use it for prediction?
I trained a keras sequential model while working in colab. Now I shifted to a PC with Windows 11. jupyter notebook with Tensorflow 2.10 is unable to read that model. it needs a model in the old .h5 ...
0
votes
2
answers
63
views
Tensorflow gradient returns None
I am being implementing a custom layer that returns both the transformed output and an auxiliary loss term. The forward pass works fine, but when I try to compute gradients, I get None for the main ...
1
vote
0
answers
91
views
TensorFlow 2.18.0 (conda-forge) fails on macOS with down_cast assertion in casts.h
For several months, I have encountered this issue but postponed a thorough investigation due to the complexity introduced by multiple intervening layers, such as Positron, Quarto, and Conda.
Recently, ...
0
votes
0
answers
124
views
Transforming tensorflow v1 graph and weights into saved model
I defined model (mnist digits recognition) using tensorflow 2.15.0 and tensorflow.compat.v1. Model was **not ** trained and the graph was exported using following code:
init = tf....
1
vote
0
answers
111
views
Unable to load an hdf5 model file in TensorFlow / Keras
I was given an hdf5 model file that was build with tensorflow / keras. Training data is no more available.
Note: all Python code snippets shown hereunder are run against Python 3.9.23 inside a ...
0
votes
1
answer
118
views
ValueError: Only instances of keras.Layer can be added to a Sequential model when using TensorFlow Hub KerasLayer
I’m trying to build a Keras Sequential model using a feature extractor from TensorFlow Hub, but I’m running into this error:
ValueError: Only instances of `keras.Layer` can be added to a Sequential ...
1
vote
1
answer
126
views
Keras Model throwing Error while integrating with frontend [closed]
I trained a model on Colab for my final year project EfficientNetB0. After all the layer training, I tested it and its result was excellent, but now I want to integrate the model to the frontend web ...
3
votes
0
answers
78
views
Multimodel for image captioning with CNN and LSTM over flickr30k does not learn. How to fuse image features and word embeddings?
I'm working on an image captioning project using a simple CNN + LSTM architecture, as required by the course I'm studying. The full code is available here on GitHub (note: some parts are memory-...
1
vote
1
answer
73
views
Mask image in tensorflow
Can I use keras.Layers to build custom layer to mask to whole dataset and return masked dataset. That is
class AttnMask(Layer):
def __init__(self, img_size, attention_map):
super()....
-1
votes
1
answer
108
views
How to install a compatible version of TensorFlow Federated on Google Colab (Python 3.12 + TensorFlow 2.19)?
I am using Google Colab, which comes with:
Python 3.12.11
TensorFlow 2.19.0
When I try:
!pip uninstall -y numpy jax jaxlib
!pip install tensorflow_federated
Pip starts backtracking and tries to ...
-3
votes
1
answer
97
views
Can I visualize a neural network’s loss landscape to see if it’s stuck in a bad minimum? Any code example for this? [closed]
So, I’m trying to understand why sometimes neural networks get stuck during training. I heard people talk about ‘local minima’ and ‘saddle points,’ but I can’t really picture them. I want to actually ...
0
votes
0
answers
84
views
How to load a model while ignoring unbuilt head layers? (`expected 2 variables, received 0`)
I’m loading a costume ViT backbone saved via MLflow’s TensorFlow flavor (Keras 3). The artifact includes backbone parts I want (patch_embed, encoder) a couple of layers in the encoder were saved in a ...
1
vote
0
answers
70
views
How do I convert TensorFlow SavedModel into TensorFlow.js format?
I’m trying to convert my TensorFlow SavedModel into a TensorFlow.js format using tensorflowjs_converter.
tensorflowjs_converter --input_format=tf_saved_model --output_format=tfjs_graph_model --...
0
votes
0
answers
73
views
Tensorflow lite sample code does not work from the tutorials
https://ai.google.dev/edge/litert/models/signatures#java
I have the model generated, I have the model loaded. I verified this because I can see the signatures that are available:
I don't know what ...