42,105 questions
-4
votes
0
answers
71
views
How to Enahnce the predictions of LSTM model [closed]
I'm working on small project using the modern portfolio theory for portfolio optimization, the final required output is a recommendations on which assets to buy and how much to buy.
to achive that ...
Advice
0
votes
2
replies
50
views
TensorFlow models DoS via input-controlled tensor sizes?
Running untrusted TensorFlow models and noticed this:
import tensorflow as tf
import time
class TestLayer(tf.keras.layers.Layer):
def call(self, inputs):
n = tf.cast(inputs[0][0], tf....
1
vote
2
answers
97
views
tensorflow time series mode training : Only one input size may be -1, not both 0 and 1
I was trying to do a tutorial on time series model with tensorflow and I got an error regarding reshaping presumably coming from a reshape layer.
train_dataset = tf.keras.utils....
Advice
1
vote
4
replies
108
views
Can I create a layer in Keras that de-scales my output?
I am working on a keras regression network that takes about 60 input variables and outputs 35 variables. For both the input and output, about half of the variables are in the range of ±10, while the ...
1
vote
1
answer
34
views
How to apply SHAP explanations to a CNN+BiLSTM model trained on severely imbalanced network intrusion detection data?
I am building an explainable Intrusion Detection System for IoT networks using a hybrid CNN+BiLSTM+Multi-Head Self-Attention architecture in Keras/TensorFlow. My dataset is CIC-BoT-IoT which has ...
Advice
0
votes
2
replies
71
views
How to correctly extract the CLS token from a Keras Hub ViT backbone, and clarify preprocessor usage and pretraining dataset?
I’m working with a Vision Transformer (ViT) backbone from Keras Hub and building my own classification head. My code looks like this:
python
def get_vit_model(model_variant='vit_base',
...
2
votes
1
answer
99
views
Tensorflow Keras CV tutorials incorrectly working [closed]
I'm starting learning Machine Learning by Tensorflow Keras CV tutorials and two of my tutorial projects are not working correctly.
I use these tutorials:
https://www.tensorflow.org/tutorials/load_data/...
3
votes
1
answer
83
views
Keras ImageDataGenerator width_shift_range moving vertically despite correct input shape (H, W, C)
I am experiencing a very strange issue with Keras ImageDataGenerator.
I have a landscape image with shape (1056, 2000, 3).
Height (Axis 0): 1056
Width (Axis 1): 2000
When I use plt.imshow(), the ...
Best practices
0
votes
0
replies
103
views
ODIR-5K: Should I train a Dual-Input CNN (Left/Right) or split images for Patient-Level Multi-Label Classification?
I am working with the ODIR-5K (Ocular Disease Intelligent Recognition) dataset. The goal is multi-label classification of 8 ocular diseases (Normal, Diabetes, Glaucoma, Cataract, etc.).
The Data ...
2
votes
0
answers
183
views
Keras Loss from multiple output layers [closed]
I have a Keras model with multiple output layers. I want to have a loss function, that computes a loss based on two of the model output layers.
Can I do this in a simple way, without using a custom ...
1
vote
1
answer
51
views
TFModel weights do not appear in model.trainable_weights
I wrote a custom TensorFlow model shown below. My issue is that the backbone is not appearing in model.summary() and not in model.trainable_weights().
However I does work if I go into model.backbone....
1
vote
2
answers
87
views
LSTM time series using Keras Sequential, .predict() explanation
I fit a model using Keras sequential with LSTM layers. The LSTM model will have certain aspects of the state carry forward from one period t to the next, besides the the input sequence of values for ...
0
votes
1
answer
67
views
Cant Serialize and Deserialize ViT in Keras When Setting Classification = True
I have created ViT as follows:
@keras.utils.register_keras_serializable(package="ViT", name="ViT")
class ViT(keras.Model):
"""
Vision Transformer (ViT), ...
3
votes
1
answer
98
views
Problem with DWT3D with Custom Keras Layer
I'm trying to integrate the TFDWT library's DWT3D layer into a custom Keras layer.
import tensorflow as tf
import keras
from TFDWT.DWT3DFB import DWT3D
class DWTLayer(keras.layers.Layer):
def ...
0
votes
0
answers
59
views
Keras to_categorical results in different memory allocation error every re-run
I'm working on a semantic segmentation model through U-net for classifying 11 categories. After splitting my image and label data into training and testing arrays, I turn the arrays into Unsigned ...