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
1answer
17 views

Applying standardization using ImageDataGenerator

I have a multiclass image dataset ( 8 classes) that is divided as follows, the main folder is called training and I have 8 subfolders with each subfolder for one class. I know how to perform data ...
0
votes
0answers
7 views

Increasing training accuracy of U-Net segmentation model

I was working with segmentation using u-net and MobileNet. While I trained with input size 256*256 it had an output with Val loss: 0.044 (In this time dense layer was 256, 128, 64, 32 with a learning ...
0
votes
0answers
10 views

Saving and loading a WGAN model weights

I am using the WGAN implementation provided here: https://keras.io/examples/generative/wgan_gp/ And I wanted to save the GAN and its components. When I do wgan.save("my_folder") I get: ...
0
votes
0answers
15 views

ImageDataGenerator for image preprocessing

I'm trying to do a superresolution network, but I am having trouble importing my own data. I have two types of images: resized images (smaller), original images. The first one is going to be used as ...
0
votes
0answers
34 views

how a deep learning network works without using library [closed]

can anybody please provide me the solutions in layman language, how a deep learning network works. ...
0
votes
0answers
13 views

Train LSTM model with similar cyclic sequence

I am using keras LSTM to predict a seq2seq of 2 variables. I have test results for 50 subjects with ±20 tests per subject. the data is a 2 variable sequence with shape (101,2). as you can see, the ...
1
vote
0answers
9 views

Bad accuracy on predicting user ratings upon his reviews

I am trying to predict user ratings based on books he rated(ratings range between 1-10). So I encoded the summary of the books and then tried to train the model with the text encoding(practically the ...
1
vote
1answer
19 views

Does validation_split in tf.keras.preprocessing.image_dataset_from_directory result in Data Leakage?

For a binary image classification problem (CNN using tf.keras). My image data is separated into folders (train, validation, test) each with subfolders for two balanced classes. Borrowing code from ...
2
votes
0answers
15 views

Why does a linear regression in time series forecasting does not provide a line in predictions?

I'm reading the TensorFlow Time Series forecasting Tutorial 1 trying to perform my own time series prediction. However, specifically on single-shot models section for multiple time steps, the Linear ...
0
votes
0answers
9 views

Expected input for time-series transformers

I am trying to create a model starting from the Attention is all you need paper. Specifically I want to setup the Encoder/Decoder architecture to predict time-series. I would like to implement it in ...
0
votes
0answers
21 views

Text Classification for columns with numbers, string and special characters

I have a dataframe with 3 columns and 1 label Here is an example of a row ...
0
votes
0answers
15 views

save and load capsule network model?

Hi i'm working on the deployment of a trained capsule network model into web application and i have a problem loading the model in other .py file to make predictions. i tried get.config() and ...
0
votes
1answer
17 views

Early stopping based on average val_loss of last ten epoches and with some n partiences

I am training a DNN with CNN in Keras. Though, I can write an EarlyStopping criteria based on val_loss but due to minor oscillations in the val_loss, I want to monitor the average validation loss over ...
0
votes
0answers
15 views

ResourceExhaustedError: OOM when allocating tensor [closed]

when i trained my model for the first time, the execution went normally without errors. But when i re-run the same code for the second time, it gave out of memory errors. ...
0
votes
1answer
21 views

How to freeze certain layers in models obtained from keras.applications

I am currrently trainning to use transfer learning on ResNet152 obtained from Keras Applications: ...
1
vote
0answers
9 views

How to treat losses asymmetrically in Keras?

I am developing a Keras NN that predicts three categories: A, B and C. However, the impact of errors is not symmetrical. i.e. If the network predicts A when the label is C, that is much less desirable ...
0
votes
1answer
26 views

What does keras.backend.clip do?

I am trying to create a custom loss function and when looking at other examples of loss functions online, I found this example: ...
1
vote
0answers
10 views

Image Classification: Different Background on Training and Test Set

I am currently working on a challenge for a course at my university. We need to assign the image of a leaf to one of 14 different classes and we are given an unbalanced training set of ~17k pictures (...
1
vote
0answers
24 views

Would it make sense to have an output layer connected to other output layers in a NN?

I'm working with data that has multiple variables which could be predicted, nonetheless I need to predict just one that is directly correlated to all of the others. Would it make sense to have a NN ...
1
vote
0answers
53 views

Could not install packages due to an OSError: No such file or directory: '/usr/local/lib/python3.8/dist-packages/keras-2.7.0.dist-info/RECORD' [closed]

I am trying to downgrade the version of Keras and whenever I try to install or uninstall it, I run into this error. ...
0
votes
1answer
20 views

Optimal batch size and number of epoch for BERT

I use this tutorial https://www.tensorflow.org/text/tutorials/classify_text_with_bert and get different accuracy depend on epoch numbers and batch sizes. What's optimal parameters?
1
vote
0answers
19 views

More training data - Less Memory

I have a training dataset of images common images, there are more than 5K images in this dataset. But I have less memory in Google colab- RAM-12GB. I need to train all the images but due to less ...
0
votes
0answers
17 views

Understanding ELMO Layers output_shape

I'm using the code below to use an ELMO layer and I need a little help understanding how the output_shape is used. Since the input to the model is a string (a full sentence), then is the output_shape ...
0
votes
0answers
14 views

Network to find value of specific point in image

We have an greyscale image. Each pixel represents the intensity in range 0 - 255. This intensity can be linearly remapped to value M in different range (e.g. 20 - 50). The image contains some object ...
0
votes
0answers
10 views

How do I create series of windows for loading into Keras ConvLSTM?

I am trying to replicate the result of Pham et al. (2020) using Keras. The model architecture is built and training converges on a small subset of data, but now I need to feed it the full dataset for ...
0
votes
1answer
12 views

When using Jupyter (R kernel) and the keras library. When a cell is run there is no output. W/no output, there's no way knowing code functions.?

The keras digit object detection code does actually run in Jupyter using the R kernel. But it took three attempts to recognize that there wasn't an issue with Jupyter, or the R kernel, or the code. ...
0
votes
1answer
26 views

Error with MSE in LSTM

I'm trying to fit an LSTM model on my dataset, using also a validation set. My datasets have the following shapes: ...
1
vote
0answers
16 views

Unable to get reproducible results with Keras using random seed

I am having problems in ensuring reproducibility of my Python script using Keras and random seeds. I have followed the guidelines provided here, but everytime I run the scripts I get different results....
2
votes
0answers
16 views

Transfer learning + Selective Fine Tuning

This is a two part question: Background: I have a rather small set (thousands) of medical images. I am using pretrained models off of kersa.applications without ...
1
vote
1answer
14 views

how does zoom out works in data augmentation?

how does zoom out works in data augmentation? I'm reading a doc on data augmentation in Keras ,and it says that randomZoom(0.2) zooms in and out by a factor in rage ...
0
votes
1answer
23 views

How to save the history epochs and plots in files from keras models

I have a question, that maybe is very simple, but I can't do it: I have 3 neural networks which are trained with 100 epochs, and I need to save all the history's train displayed at the end in a .txt ...
0
votes
0answers
8 views

How to reference length of input sequence inside Keras model?

Basically I am trying to implement a "Transformer-like" architecture for physiological time-series classification. One of the specific design criteria is for the model to be able to process ...
1
vote
1answer
19 views

Determining which deep learning model architecture is better

I am solving a specific segmentation task, using two versions of U-net architecture - the first one being classic U-net and the other Attention U-net. Currently, I am trying to determine which one ...
0
votes
0answers
12 views

Keras Custom loss Penalize more when actual and prediction are on opposite sides of Zero

I'm training a model to predict percentage change in prices. Both MSE and RMSE are giving me up to 99% accuracy but when I check how often both actual and prediction are pointing in the same direction ...
0
votes
1answer
49 views

How could you build a Neural Network with the same weights for different nodes in the same layer

The structure I'm imagining is like the one in the image bellow where the output is softmax. For the hidden layer we would have $$Z_1 = W_{11}^{[1]}x_2 + W_{12}^{[1]}x_2$$ $$Z_2 = W_{21}^{[1]}x_2 + ...
0
votes
0answers
32 views

Random predictions from a multi-label image classification model

I am currently trying to create a model for multi-label image classification using Keras. The model has 8 classes, with a slight imbalance in the dataset (some have 300~, whereas some others have 600~)...
0
votes
1answer
43 views

ValueError when trying to split DataFrame into train/test

I am getting ValueError: too many values to unpack (expected 2) from this code: ...
1
vote
1answer
18 views

Optimizers, loss functions and weights: when do they matter?

I'm training an FCN in TF/Keras with sigmoid focal loss (from TF addons) and saving weights in checkpoints. I will need the inference to be done on another computer that, for the moment, does not ...
0
votes
0answers
13 views

What is the difference between dilated convolution and bilinear interpolation?

I started studying semantic segmentation, so I read some papers about image segmentation to clinical images using as main architecture, the u-net. Maybe because I am newer on the field, but I don't ...
0
votes
1answer
23 views

val_sparse_categorical_accuracy

I know the metric sparse_categorical_accuracy ...
0
votes
0answers
11 views

Passing both x_test and y_test to model.predict() in a sequence-to-sequence model?

I have a sequence to sequence model for text summarization like this: model = Model([encoder_inputs, decoder_inputs], decoder_dense) I fit it accordingly: ...
1
vote
1answer
407 views

NameError: name 'model' is not defined Keras with f1_score

I'm having a problem with my Keras model, in the .compile() I use accuracy, loss, precision, recall and AUC, but also I need f1_score, due to Keras doesn´t include f1_score, I tried to calculate by ...
1
vote
0answers
54 views

The channel dimension of the inputs should be defined. Found `None`

Hello I'm trying to use SegNet in my project with tensorflow, for educational purpose. And I'm surely following someone else's code on GitHub: ...
3
votes
1answer
29 views

classification balanced target y [0,1] but imbalanced feature x [many 0 , few 1s] , maximize precision

I have a simple dataset with balanced target y (0 or 1) ,and imbalanced feature (many 0 , few 1's) I aim to get high precision (don't care about recall) I can get high precision of 0.53 if I just ...
1
vote
0answers
11 views

Add noise to categorical data in tf / Keras?

Just being curious about adding noise to categorical variables. I suspect that adding gaussian noise over a one hot encoded variable wouldn't be enough. I was thinking about adding noise after ...
1
vote
1answer
36 views

How to decrease LSTM RMSE?

I am using an LSTM model to predict the next measurement of a sensor. The dataset looks as follows: There are approximately 13000 measurements. My code for the LSTM looks as follows: ...
0
votes
1answer
21 views

ValueError: Layer model_4 expects 1 input(s), but it received 10 input tensors

I've directory structure like this, for my dataset: |--train |--test |--valid In the train folder, these are pairs of images like xyz_sat and xyz_mask. So I've ...
1
vote
1answer
44 views

Should rescaling be used on test images in keras?

I am kind of confused regarding the topic. I have built a CNN architecture for the cat-dog image classification around 6000 images of cat and 6000 images of dog and I am predicting on test images. I ...
1
vote
1answer
23 views

How to load a dataset with a specific structure in tfds library?

I have a dataset that it's classes arranged in the following way: /dataset/train/images/class1/ /dataset/train/images/class2/ . . . /dataset/train/images/classN/ ...
0
votes
0answers
18 views

MNIST trained network tested with my own samples

I trained a Dense Neural Network with MNIST dataset in order to classify 28x28 images of numbers. Now I was trying to make it work with my own samples (I draw the image of a "7" in paint and ...

1
2 3 4 5
52