Questions tagged [keras]

Keras is a popular, open-source deep learning API for Python built on top of TensorFlow and is useful for fast implementation. Topics include efficient low-level tensor operations, computation of arbitrary gradients, scalable computations, export of graphs, etc.

Filter by
Sorted by
Tagged with
0 votes
1 answer
21 views

Define a custom distance between classes in Keras

How is it possible to make a classification with custom distance between classes in Keras? For example, let's say I need to classify betweenA1,...
  • 289
0 votes
1 answer
20 views

What is the math behind the Keras Tokenizer() function?

I am doing an essay on the mathematics behind a text classifier with NLP and neural networks and I would like to know how exactly the TOKENIZER function of Keras works. Whether cosine similarity is ...
  • 3
0 votes
1 answer
11 views

Difference between class_weight and loss_weights arguments in TensorFlow/Keras

I am creating a neural network using TensorFlow (v2.9.2) for an imbalanced image dataset. While doing so, I noticed that model.compile() method has an argument <...
0 votes
0 answers
9 views

how to get the extracted feature vector from transfer learning models python?

I am trying to implement a classification model with ResNet50. I know, CNN or transfer learning models extract the features themselves. How can I get the extracted feature vector from the image ...
0 votes
0 answers
25 views

Custom loss function for binary classificatio in Keras gets error: No gradients provided for any variable

I have a binary classification problem. However, I don't really care about fp and fn values. What I want to achieve is that the <...
  • 43
-1 votes
0 answers
36 views

What models should I use? [closed]

I'm new to machine learning and I've encountered some problems. I got training data include NumPeriod NumMachine α β δ ε Max_t, BatchOfMachine, and I want to predict the sequence of batch(job) ...
  • 1
0 votes
1 answer
14 views

Not able to understand Transfer Learning with Vgg16

So, I have to work with Vgg16 in my semester group project, and was following this to do transfer learning. I don't understand CNN much, but am learning currently. The very first problem was that ...
-1 votes
0 answers
38 views

How should I increase the accuracy of churn prediction model from 80% to 95% using neural network? [closed]

I am working on a churn prediction model and I am getting an accuracy of nearly about 80% using a neural network. Below is the link to exactly what I am doing = https://www.analyticsvidhya.com/blog/...
0 votes
0 answers
7 views

Unstable loss in binary classification for time-series data - extremely imbalanced dataset

I am working on deep learning model to detect regions of timesteps with anomalies. This model should classify each timestep as possessing the anomaly or not. My labels are something like this: ...
  • 73
1 vote
1 answer
18 views

Feed output of neural networks into other network in tensorflow

I have two well trained neural networks, shown as: ...
0 votes
0 answers
34 views

LSTM with multiple entries per month

I'm trying to solve a problem that has this structure: Date ID feature1 feature2 Y Month1 1 1 2 1 Month2 1 3 4 0 Month3 1 5 6 1 Month1 2 7 8 1 Month2 2 9 10 0 Month3 2 11 12 1 I need to ...
  • 1
0 votes
0 answers
12 views

How to test TensorFlow model for single input file?

I am new in TensorFlow. Code above is a python code, which trains NN for spoken language identification task. How can I add ability to predict a single audio file and give predictes class(label) name, ...
  • 1
0 votes
0 answers
11 views

(Python, MNIST) how to load/import my own img for AI to train

Questions like these are difficult to debug, but you'll hopefully find more help on datascience.stackexchange.com than here I see the suggestion, that post my questionin Data science is also a good ...
0 votes
0 answers
7 views

Embedding performing unexpectedly worse than multi-hot encoding

I'm pretty new to ML and have set up a Keras model with a number of categorical features of users & items to predict positive reactions. Each feature is a list of IDs from a database - i.e. ...
  • 1
1 vote
1 answer
32 views

Using python AI mnist to recognize my picture, trained accuracy is 97.99%, but accuracy to my img is less than 20%

Questions like these are difficult to debug, but you'll hopefully find more help on datascience.stackexchange.com than here I see the suggestion that post in Data science is also a good option Using ...
  • 11
0 votes
0 answers
17 views

Why is there such a difference in final accuracy between 700x700 px image and the same split up into 140x140 px in TensorFlow

I have a relatively simple TF script for a convolutional neural network to classify microscopy images good or bad - manually this is done via the clarity of the image with bad images appearing blurry. ...
  • 1
0 votes
0 answers
16 views

how do i explain my model using shap

I am trying to explain my shap using shape tools, but it doesn't work. I am using ImageDataGenerator to augments my dataset images. ...
  • 27
0 votes
0 answers
131 views

` TypeError: int() argument must be a string, a bytes-like object or a number ` raised when fitting a multi input Keras model

I'm currently building a U-net model handling multiple input streams of data with Keras/Tensorflow's Functional API. Even though my model compiles, it raises a TypeError when I try to fit it. This ...
2 votes
1 answer
162 views

Keras model does not construct the layers in sequence

Every time I print the model summary it prints out the convlstm first and then batchnormalization at the end. ...
  • 23
0 votes
1 answer
15 views

Conversion of DataFrame into array for Keras sequential Conv 1D model

I am new in the area of Sequential Conv 1D models. My question is the following: When I am converting the DataFrame (X_train) into an array, doesn't that impact ...
0 votes
1 answer
21 views

Strange results from CNN in Keras

I have a binary classification problem. I designed a model with convolution kernels in first layers and then dense layers. As the output layer, however, I used a softmax layer with size 2, and then ...
  • 43
0 votes
0 answers
25 views

CNN-BERT Text Classification good results on train and val, but bad prediction on testing

I built a Keras model to predict hoax news and true news using the CNN-BERT Text Classification algorithm with Categorical Classification, with label 1 indicating a hoax and 0 indicating true news. ...
0 votes
0 answers
12 views

Multi-class classification MLP not working as it should

I'm trying to building a MLP. After executing the accuracy is 87,35%. I thought i was having good results. However, when painting the confussion matrix and the classification report i see the accuracy ...
0 votes
0 answers
12 views

Understanding stacked LSTM architecture

Consider the following RNN architecture : ...
  • 35
0 votes
0 answers
28 views

How to use MinMaxScaler when X_train and X_test are different sizes

I'm using an LSTM through Keras to predict a time series. My inputs are the previous measurements of one time series(v1) at time 0-59 seconds and the goal is to predict the measurement of a different ...
0 votes
0 answers
9 views

why first layer need to add augmented data in keras model

I am new in DL and stuyding this deep learning, I just working on one project is called emotion recognition. I have created data augmented. My question is why we are adding augmented data into first ...
0 votes
0 answers
9 views

Reshaping the target variable for LSTM in Keras

Consider that we have the stock prices of a certain company collected daily for 5 years. Now, we need to build an lstm to predict the stock price for future days. Consider that we take a timestep of ...
0 votes
0 answers
45 views

Input 0 of layer "lstm_6" is incompatible with the layer: expected ndim=3, found ndim=4. Full shape received: (None, 7, 7, 512)

...
  • 1
1 vote
0 answers
16 views

Problem with dimension of multiclass classification

I'm building a MLP and after executing I obtained a 87.35 accuracy value, with is really good. However, when painting the confussion matrix and the classification report i see the accuracy is just for ...
0 votes
0 answers
16 views

How to balance an imbalanced dataset

I'm using the UNSW-NB15 dataset, which is really imbalanced, to train a Multi-class classificationMLP. I encode the categorical features of the dataset which leads to a 2+ million x 205 columns ...
0 votes
0 answers
20 views

Proper way to reshape a image for training using CNN

I am new to Keras and facing some problems figuring out how to reshape the input image data properly. I have $16 x 16$ images, each with three layers, i.e., R, G, and B. The image data is in the form ...
0 votes
0 answers
22 views

High loss value in Multi-class classification with MLP

I am building a Multi-class classification MLP and when i execute the code the loss value is really high. What do i need to change? I am using the UNSW-NB15 dataset. After encoding the categorical ...
0 votes
0 answers
9 views

Efficient range loss function

I'm looking for an efficient loss function, that instead of value would provide me with a range for the value. The function I've written for this looks like follows: ...
0 votes
1 answer
18 views

Model does not learn when using Keras 'flow_from_directory', but learns fine with 'image_dataset_from_directory'?

When classifying images with Keras, I am able to achieve a validation accuracy around 90-95%, however, I am trying to improve with the use of augmentation so have switched from ...
  • 1
0 votes
0 answers
16 views

Keras Custom Layer Aware of Position in Network

I'm writing a custom Layer in TF/Keras (tf.keras.layers.Layer) for a CNN, and I need each layer to know its own depth in the model. Is there any way I can do this, ...
1 vote
1 answer
21 views

No improvement in test and training accuracy when training different optimizers

I am currently testing 5 different optimizers to see their training loss, and their testing accuracy. The optimizers are: AdaGrad, AdaDelta, RMSprop, Adam, Nadam. I am using a quite simple model with ...
0 votes
1 answer
22 views

Setting shape of RaggedTensor with Known Shape

I'm working with RaggedTensors to manipulate a dense tensor. Something like this : ...
0 votes
0 answers
23 views

Supervided anomaly detection for time series sensor data with LSTM

I have a supervised anomaly detection problem which involves time series sensor data. The structure of data is as follows: I have several industrial machines (say 100). Each machine is equipped with ...
  • 43
0 votes
0 answers
22 views

How to get prediction labels with Tensorflow Serving Predict API?

I have a keras classification model saved remotely, and I use RESTful API to call the model on my site and make predictions. The JSON request is done as follows URL: ...
0 votes
1 answer
50 views

image_dataset_from_directory using a subset of sub-directories

I have downloaded the MINC dataset for material classification which consists of 23 cateogories. However, I am only interested in a subset of the categories (e.g. [wood, foliage, glass, hair]) Is it ...
0 votes
0 answers
16 views

Warning for input shape in LSTM model

I have timeseries data of electricity consumption per hour with length (17544, 1) in the following format: ...
  • 101
1 vote
1 answer
198 views

Failed to convert a NumPy array to a Tensor (Unsupported object type float) in Python

I am trying to build a MLP with Keras and an error appears. I do not have experience with neural networks so it is difficult for me. When I run the code for the NN after some time it says: ...
0 votes
0 answers
510 views

Keras Graph Execution Error When fitting the model

I am using this https://keras.io/examples/vision/conv_lstm/ code and providing my own dataset, which consists of frame size 550x775. But When I try to execute the ...
0 votes
0 answers
42 views

Determine batch size during `tensorflow.keras` Custom Class `call` method

I'm building a custom keras Layer similar to an example found here. I want the call method inside the class to be able to know what the ...
  • 111
0 votes
0 answers
4 views

looking for datasets to build multi-output models

I am looking for beginner friendly datasets(of any type) that can be used to train a deep neural network with multiple outputs. I tried looking on places like Kaggle but there is so many datasets that ...
  • 1
0 votes
0 answers
13 views

Manipulating weights after Keras concatenation

I'm trying to initialize the Autoencoder in the diagram as follows: At the beginning, I want all weights and biases to be zero except those that go directly from the input to the bottleneck, and ...
  • 113
0 votes
0 answers
10 views

Image Classification | High loss

i am working on image classifiaction. With keras, tensorflow. ...
0 votes
0 answers
23 views

Is it possible to have the variable input channel size in a Tensorflow/Keras model?

I would like to build a single Tensorflow model with the variable channel size. My goal is to have this single model to take the input data with 1, 2 or 3 channels. Is this possible? I tried on the ...
  • 11
0 votes
2 answers
88 views

Accuracy decreases after adding more samples

I'm working on a multiclass text classification task (5 classes). I've 2 types of datasets: regular (~22000 samples) dataset of duplicates (~19000 samples) I've written a logic that labels them all. ...
  • 167
0 votes
0 answers
19 views

LSTM accuracy VS F1-score

I am trying to do multi-classification on imbalanced data with 3 classes. The imbalance is something like 6:1:3. The total amount of samples is 7000. I use LSTM, and Word2Vec to vectorize the data. ...

1
2 3 4 5
54