Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
0 answers
31 views

How to set non-trainable weights?

The method keras.Model.set_weights seems to only take trainable weights. Non-trainable weights such as those from normalization layers cannot be imported this way. This is problematic, since in Keras ...
Value_Investor's user avatar
0 votes
0 answers
17 views

adapt() doesn't work within tf.data.Dataset.map() while building a preprocessing pipeline using keras preprocessing layers

I'm trying to create a neural network that assigns tasks to employees based on their skills (https://www.kaggle.com/datasets/umerfarooq09/skill-based-task-assignment). The data contains categorical ...
Jatin Rathour's user avatar
0 votes
0 answers
143 views

Image-to-Image with U-Net with no Skip-connections. Is it real?

In general, U-Net is needed to create another style image, but preserve the structure. For example, a full-fledged drawing from a sketch. Right? I want to preserve the style, but change the structure. ...
Pavel No's user avatar
0 votes
0 answers
150 views

"Only input tensors may be passed as positional arguments" error in the artificial neural network model in Python

I am performing hyperparameter tuning on a ANN model in Python. While I have successfully received the optimized parameters, the final model fit isn't executing. Parameters optimization: params_reg=...
Sneha's user avatar
  • 3
0 votes
0 answers
36 views

How to understand NN input and Output

I have a project where I want to do feature extraction in images. I have this CNN layer: model = keras.Sequential( [ layers.Input((2*imsize,imsize,3)), layers.Reshape((2,imsize,imsize,3)), #...
Squish's user avatar
  • 457
0 votes
0 answers
51 views

Input shape argument isn't recognized for cvnn with cvnn libary

I have a problem with my little code project, where I want to program a complex valued neural network, which can take real number and complex numbers as inputs and approximate a simple function f(x,y) ...
Multi2_0's user avatar
0 votes
0 answers
261 views

Problem with Keras class weights and KeyError

I anticipate that I have seen the question: Keras class_weight error dictionary keys/values referring to the same problem, but the solution does not seem to help me. With this code, where I just added ...
Pinguiz's user avatar
  • 113
0 votes
0 answers
41 views

Feed Forward Network regression predict almost the same value

I built a simple feed forward network, but it predict almost the same value for all test sample. I fine-tuned many parameters, the prediction are almost the same. Hope to hear some suggestions! ...
Jinlan's user avatar
  • 1
0 votes
0 answers
75 views

Why does 4-layer feed_forward_network regression predict a fixed number for all test samples?

I built a 4-layer feed forward network. However the prediction for the test sample are all the same.They are a fixed number. I have standardized the data into [-1,1]. I am not sure if there is ...
Jinlan's user avatar
  • 1
0 votes
0 answers
53 views

Serious delays in Keras before training the neural network

I'm creating a NN that has 2 levels. At the first level, there are several small neural networks that should have a good generalizing ability for the data being fed to them. At the second level there ...
user21272702's user avatar
1 vote
0 answers
46 views

How do I map the outputs of my Keras CNN to something that I can understand?

I've been getting into Neural Networks recently and I understand a lot of the basics. As of recent I wrote a CNN with Keras that sorts images of cats and dogs into 37 different breeds. Making the ...
Crystal's user avatar
  • 11
0 votes
0 answers
27 views

Using SAM-LSTM-RESNET

I was using the SAM-LSTM-RESNET package and i had a this shape problem. It is also happenning with the examples pics that come with the package, so it's very wierd that it does not work as it should. ...
damian antonio gonzo's user avatar
0 votes
1 answer
413 views

Is there any way to speed up the prediction of a model?

We are currently building Neural Network using keras and tensorflow for evaluating chess positions. And we have encountered the problem with speed of prediction on a single sample, which is used in ...
Jan Hrdina's user avatar
0 votes
0 answers
67 views

nan loss in keras when working on a semantic segmentation model to segment brain tumor brats 2021 task 1

some context: The input has 4 images and i combined them in to 4 channels and the output has 1 images the input shape is (sample,240,240,4) output shape: (sample,240,240,1) The loss of my model for 50 ...
Fabio Canavarro's user avatar
0 votes
1 answer
241 views

Division by neural network; fixed value produced each time

I'm trying to develop a neural network to multiply and divide two numbers using this method. The multiplication part goes well, but the division doesn't - each time the program is run, for each pair ...
harry's user avatar
  • 101
0 votes
0 answers
75 views

Signal processing Conv1D Keras

I am learning Keras using signal classification where all values are binary (0 or 1). The input data is a vector of [,32] and the output is [,16]. I have a large dataset more then 400K samples. This ...
stevGates's user avatar
  • 952
1 vote
1 answer
387 views

Inconsistency in input shape to neural network

I coded two simple neural networks to add two numbers, and to square a number. I used them to create a program to multiply two numbers. import tensorflow as tf import numpy as np model_add = tf.keras....
harry's user avatar
  • 101
0 votes
0 answers
82 views

How to do multi-class and for several target variables with neural network?

I would like to do classification using Neural Network. I have several features that are mostly categorical and multiple targets (15 targets) that are also categorical. each feature and target ...
user369273's user avatar
0 votes
1 answer
122 views

Why does my pruned model have a larger file size than my initial model?

I'm exploring pruning a neural network using this example. My pruning code, using a pre-trained model, looks like this: prune_low_magnitude = tfmot.sparsity.keras.prune_low_magnitude # Compute end ...
Barney_Dinosaur's user avatar
0 votes
0 answers
23 views

'KerasClassifier' object has no attribute '__call__'

I am makinga Neural Network for a stomach tissue dataset. The idea is that I want to optimize parameters for my model, so I run KerasClassifier to change parameters for model. So I was trying to run ...
Kaeki Cookie's user avatar
-1 votes
1 answer
40 views

Confusion about training and prediction images' shape

I'm doing semantic segmentation task in Keras - classifying trees from background. My images are initially of shape (256, 256, 3). However, I want to resize them to (128, 128) to speed up the training....
Snork Maiden's user avatar
0 votes
0 answers
40 views

Keras neural network model performance changes after saving and loading

I have a neural network model that I build with Keras and TF. When I save the model with a .keras extension and then re-load it during the same session (I'm using Spyder) it works as expected. However,...
JT Kennedy's user avatar
0 votes
1 answer
273 views

Division by neural network: Cannot take the length of shape with unknown rank

I am trying to code a neural network to multiply and divide two numbers by using a method similar to the one outlined here. First, I coded models for adding and subtracting two numbers, and squaring a ...
harry's user avatar
  • 101
0 votes
1 answer
85 views

Neural network to approximate the square function gives 0 output

I'm trying to build a neural network to approximate the squares of numbers from -50 to 50. I've referred to the code in this answer to write mine: import tensorflow as tf import numpy as np from ...
harry's user avatar
  • 101
0 votes
1 answer
225 views

My test loss is increasing but train loss is decreasing for Neural Network. What should i do? [closed]

My Neural Network def buildModel(optimizer): model = tf.keras.models.Sequential([ Dense(100, activation = 'relu'), Dense(82, activation = 'relu'), Dense(20, activation = 'relu'), ...
Whitedevil4648's user avatar
2 votes
0 answers
45 views

Neural network works but erratically

I'm coding a neural network to add and subtract numbers. Below is the code: import tensorflow as tf from keras.models import Sequential from keras.layers import Dense import numpy as np num_train = ...
harry's user avatar
  • 101
0 votes
0 answers
55 views

Tile function in numpy not working properly

I am trying to build a neural network to add two numbers. This is the code: import tensorflow as tf from keras.models import Sequential from keras.layers import Dense import numpy as np num_train = ...
harry's user avatar
  • 101
0 votes
0 answers
121 views

Can't load pre-trained h5 model

I am trying to load a model saved as h5 and written in python 3.6, tensorflow 1.4.0 and keras 2.0 However, when loading it up, I get the error with load_model: ValueError: Could not interpret ...
IceAndFire's user avatar
0 votes
0 answers
41 views

Test Generator ValueError: Asked to retrieve element 0, but the Sequence has length 0

So I have built and trained a neural network that looks at xray data with 1177 unique classes. However, I would now like to test my model against the test/validation data but seem to be getting the ...
Dylan Ndengu's user avatar
0 votes
1 answer
54 views

Keras metrics do not work with custom loss function

I am working on a neural network model with keras. My y values have a shape like: (..., 2) So my y_pred is going to have the same shape. The problem is that the values of y represent a range of values ...
BrainlessPOMO's user avatar
1 vote
0 answers
97 views

RuntimeError when using keras 3 with pytorch backend

I am trying to reproduce the VAE model demonstrated in the document of Keras3: https://keras.io/examples/generative/vae/ and https://keras.io/guides/making_new_layers_and_models_via_subclassing/#...
Belter's user avatar
  • 3,807
0 votes
1 answer
48 views

Neural Network Model Weight Matrix

I was trying to make the all values in my trained neural network model to zero's. The initial model file size nearly 330 MB. But when I modified the values of weight matrix to zero's it becomes double ...
Uvindu Bimsara's user avatar
2 votes
2 answers
1k views

GridSearchCV error: ValueError: Sequential model 'sequential' has no defined outputs yet

I am trying to fine tune the hyperparameters for my deep learning neural network on a dataset which I have done feature engineering on. I have kept only relevant features and have standardized the ...
vishv's user avatar
  • 21
1 vote
1 answer
141 views

Why does my plot_model() look like this? (Tensorflow, Keras)

I made a very simple model, so I could practise using the plot_model() function, but for some reason my plot model looks like this? enter image description here import tensorflow as tf import numpy as ...
ScuffedJoey's user avatar
0 votes
1 answer
81 views

How to do a multi outputs regressiong using Keras Functional API and tf.Dataset without getting the error "Iterating over a symbolic `tf.Tensor`"?

I want to build a neural network which will looks at an image and gives me 64 floats. At first I had pandas data frames. The target frame looks like this (I have 64 number per images) : a1 a2 ...
Samael's user avatar
  • 13
0 votes
0 answers
77 views

Recommended way to use Gymnasium with neural networks to avoid overheads in model.fit and model.predict

I'm trying the Episodic Semi-Gradient Sarsa from Sutton & Barto Chapter 10 (second edition) for the CartPole problem using Gymnasium. For function approximation, I'm using neural networks with ...
digikar's user avatar
  • 588
0 votes
1 answer
87 views

high val-loss and MSE

I have a really big dataset on energy waves and I'm practicing the Neural Network on it, but my MSE and Val-loss are extremely high. i tried to use correlation matrix and having two step for splitting ...
Hadis Yousefi's user avatar
0 votes
0 answers
54 views

How to use WindowGenerator to train a time-series model with multple inputs?

I'm new to Keras and still learning about machine learning. I'm currently following the Tensorflow's time series forecasting tutorial. The model is something like and idk if something is wrong with it:...
Firate's user avatar
  • 159
-4 votes
1 answer
56 views

Neural network unable to predict y=2x relationship

I am getting a loss of 13332936704 and with every epoch tje loss is not decreasing very much. The output is 0.74. Import tensorflow as tf x=[] y=[] For i in range(10000): x.append(i) y append(i*2) ...
Krishan _13's user avatar
2 votes
1 answer
3k views

AttributeError: module 'keras.src.backend' has no attribute 'Variable' with Dropout layer

I'm trying to re-use a neural network for sound classification but keras give an error: AttributeError: module 'keras.src.backend' has no attribute 'Variable'. May it be a compatibility problem? I'm ...
Giuseppe Ricci's user avatar
1 vote
1 answer
125 views

Ensuring Deterministic Outputs in Neural Network Training

I am new to neural networks and currently working with TensorFlow. For an experiment, I would like to build a model that consistently produces the same output for identical inputs. However, my initial ...
hasanghaforian's user avatar
0 votes
0 answers
8 views

Rafial Basis Function ANN: grid search error

I am triying to develop a RBF ANN model to predict a continuous variable. I am implementing the model with the iris dataset as a test. When I try to find the best hyperparameters for my rb function (...
Lucas's user avatar
  • 1
0 votes
0 answers
223 views

AttributeError: module 'keras.api._v2.keras' has no attribute 'models' when using tf.keras.models.Sequential() for Neural Network

I'm using Jupyter Notebook and am trying to follow along this example for Siamese NN with Triplet Loss: https://github.com/13muskanp/Siamese-Network-with-Triplet-Loss/blob/master/Siamese%20Network%...
Anthony's user avatar
  • 331
0 votes
0 answers
37 views

Keras struggles to model simple algebraic function

My original problem was building a NN for a fairly large dataset, but I ran into an issue where after training the model insistently produces the exact same output for any input so to debug I've moved ...
lemmox's user avatar
  • 11
-1 votes
1 answer
87 views

Animal detection using neural network in TensorFlow

When i run the last part to train model, i am not able to it is getting Intrupted Check the image for the error. As you see i want to detect whether i am able to train my model to detect the animal e....
harish soni's user avatar
0 votes
1 answer
46 views

Same seed number & package versions & python version but different neural net result from laptop and desktop

I'm using a simple vanilla neural network like this, reset_seeds(42) model = Sequential() model.add(Dense(64, input_shape = (train_X_arr.shape[1], ), activation = 'sigmoid')) model.add(Dense(16, ...
Inundata's user avatar
-1 votes
1 answer
46 views

Neural networks - unable to understand the behaviour of the output layer

I'd like to know why this works (look for the comment "# This is the output layer and this is what I am talking about"): model = Sequential() # Not talking about this model.add(Dense(32, ...
Anonymous Person's user avatar
0 votes
0 answers
173 views

Neural network always outputs the average of target values no matter the input

I have a neural network made with Keras (python) with a numerical input and a text input converted to encoded integers. It consistently outputs the same value no matter the input. The reason I think ...
flexorcist's user avatar
0 votes
1 answer
36 views

Shapes (None, 16, 3) and (None,) are incompatible - Model not fitting

So i have my X_train which is a numpy array of shape (13878, 16) containing vectorized comments, and their corresponding labels in Y_train with shape (13878,) containing an int from 0 to 2 stating if ...
Victor Lozano's user avatar
-1 votes
1 answer
63 views

Suggestions about optimal way to run neural networks in parallel

I started in the last days of 2023 a personal project just for fun - I recreated the classical "Snake Game" (from old Nokia mobiles) in Python and I wanted to integrate it with some Machine ...
Matheus Felipe's user avatar

1
2 3 4 5
56