Questions tagged [loss]
599 questions
3
votes
0 answers
GitHub Disaster: Undo A Revert?
I was using the visual editor for GitHub and was ready to commit changes to the master branch of my project. However, when starting the visual editor, it would instantly popup with a message that there were conflicts. It gave me the options to…

Mike Sherron
- 31
- 3
3
votes
3 answers
Is there a way to print loss from Flux.train?
I'm trying to train a UNet in Julia with the help of Flux.
Flux.train!(loss, Flux.params(model), train_data_loader, opt)
batch_loss = loss(train_data, train_targets)
where the loss is
logitcrossentropy
and train_data_loader…

h612
- 544
- 2
- 11
3
votes
0 answers
Why does my train loss jump down when a new epoch starts?
When I train a neural network consisting of 2 convolutional and 2 fully connected layers on the MNIST handwritten digits task, I receive the following train loss curve:
The datasets contains 235 batches and I plotted the loss after each batch for…

Philipp D.
- 61
- 3
3
votes
2 answers
Custom loss w weight arrays of batch size in tensorflow/keras
I am creating a custom loss function, which is a MAE(y_true, y_pred), weighted by two arrays, a and b, where all four arrays are of the same size (10000 samples/timesteps).
def custom_loss(y_true, y_pred, a, b):
mae = K.abs(y_true - y_pred)
…

Sebastian
- 45
- 4
3
votes
0 answers
Binarycrossentropy: The lost function does not converge, but rather stagnates at 0.693
The Binarycrossentropy loss function does not converges.
It stagnates at 0.6933 = Binarycrossentropy(1.0,0.5) = Binarycrossentropy(0.0,0.5).
The net takes 8 images of size 224x224x3 representig a 3d object as input with batch_size = 16.
At least I…

Jonny Joker
- 63
- 6
3
votes
1 answer
Tensorflow 2: Customized Loss Function works differently from the original Keras SparseCategoricalCrossentropy
I just started to work with tensorflow 2.0 and followed the simple example from its official website.
import tensorflow as tf
import tensorflow.keras.layers as layers
mnist = tf.keras.datasets.mnist
(t_x, t_y), (v_x, v_y) =…

Chris
- 47
- 5
3
votes
3 answers
Custom keras loss function binary cross entropy giving improper results
Did anyoe have a convincing solution to make custom_binarycrossentropy work?
I tried all possible methods (even making the whole training data size same as the bacth size to eliminate the dependence on global averaging during batch wise…

Seena
- 101
- 1
- 8
3
votes
1 answer
What is the multi-label binary classification?
Reading PyTorch docs BCEWithLogitsLoss:
where c is the class number (c > 1 for multi-label binary classification, c = 1 for single-label binary classification), nn is the number of the sample in the batch and p_cp
c is the weight of the…

Brans Ds
- 4,039
- 35
- 64
3
votes
3 answers
Nan loss in keras with triplet loss
I'm trying to learn an embedding for Paris6k images combining VGG and Adrian Ung triplet loss. The problem is that after a small amount of iterations, in the first epoch, the loss becomes nan, and then the accuracy and validation accuracy grow to…

Ire21
- 41
- 4
3
votes
0 answers
I am using a custom loss function (yolo v2 loss function) , however i am getting loss as nan
The below code is inspired from the repo Keras-Yolo-v2 , i am facing issues with the code i am trying to understand the possible causes of loss Nan.
I have already used techniques like clipnorm but that did not help.
This is the custom loss of yolo…

Ajaysingh Thakur
- 31
- 3
3
votes
1 answer
how to compute binary log loss per sample of scikit-learn ML model
I am attempting to apply binary log loss to Naive Bayes ML model I created. I generated a categorical prediction dataset (yNew) and a probability dataset (probabilityYes), and can't successfully run them in a log loss function.
Simple…

niugrads1999
- 49
- 1
- 5
3
votes
1 answer
The difference between loss in model.compile() and model.add_loss() in Keras
I am puzzled about what is difference between the add_loss and the traditional loss in model.compile()??
My code is like following:
from time import time
import numpy as np
import random
from keras.models import Model
import keras.backend as K
from…

FlightPanda24
- 55
- 1
- 5
3
votes
1 answer
What is pixel-wise softmax loss?
what is the pixel-wise softmax loss? In my understanding, it's just a cross-entropy loss, but I didn't find the formula. Can someone help me? It's better to have the pytorch code.

TaoH
- 39
- 1
- 2
3
votes
1 answer
How to implement an adaptive loss in Keras?
I am trying to use Keras to implement the work done in A General and Adaptive Robust Loss Function. The author provides tensorflow code that works the hard details. I am just trying to use his prebuilt function in Keras.
His custom loss function is…

Nick Merrill
- 104
- 9
3
votes
1 answer
Minimizing and maximizing the loss
I would like to train an autoencoder in such a way that the reconstruction error will be low on some observations, and high on the others.
from keras.model import Sequential
from keras.layers import Dense
import keras.backend as K
def…

ian
- 399
- 2
- 15