Skip to main content

All Questions

1 vote
3 answers
5k views

RuntimeError: weight tensor should be defined either for all 1000 classes or no classes but got weight tensor of shape: [5]

I'm trying to use VGG16 for ** 5 classes data set**. I've already added 5 new layers to adjust the output for logit as 5. model = models.vgg16(pretrained=True) #Downloads the vgg16 model which is ...
sharktooth's user avatar
0 votes
1 answer
358 views

1. Weighted Loss in CrossEntropyLoss() 2. Combination of WeightedRandomSampler and subsampler

I wanted to implement class weights to my 3 class classification problem. Tried by just directly adding the weights, which gives me an error when passing my model output and the labels to my loss ...
patrick823's user avatar
0 votes
0 answers
101 views

AttributeError when trying to calculate Spare Categorical Crossentropy loss on predictions

I'm building a deep learning model in python with keras with multiple inputs, but only one categorical output. The data is suffering class imbalance so I need to use integer coded output categories ...
Dnorious's user avatar
-1 votes
1 answer
814 views

Tensorflow image classification binary crossentropy loss is negative

I'm new to Tensorflow. I followed some tutorials with a provided dataset and wanted to try something on my own. I decided I'd try to classify Magic the Gathering sets. Each card has a symbol in ...
c111's user avatar
  • 59
1 vote
1 answer
186 views

What model (loss function, etc) can be used in Keras regarding to categorical training with probability labels instead of one-hot encoding

I came to a problem when designing my keras model. The training data(input) to the model is 2 sequential character-encoded lists and a non-sequential normal feature list. The output is a list of ...
Jingwu's user avatar
  • 11
8 votes
2 answers
12k views

Why does sigmoid & crossentropy of Keras/tensorflow have low precision?

I have the following simple neural network (with 1 neuron only) to test the computation precision of sigmoid activation & binary_crossentropy of Keras: model = Sequential() model.add(Dense(1, ...
syeh_106's user avatar
  • 1,187
2 votes
1 answer
391 views

What is the difference between CrossEntropy and NegativeLogLikelihood in MXNet?

I was trying to evaluate my classification models with log-loss metric using mxnet.metric module. I came across two classes: CrossEntropy and NegativeLogLikelihood which have the same definition and ...
Wojciech K's user avatar
11 votes
3 answers
13k views

Keras: binary_crossentropy & categorical_crossentropy confusion

After using TensorFlow for quite a while I have read some Keras tutorials and implemented some examples. I have found several tutorials for convolutional autoencoders that use keras.losses....
daniel451's user avatar
  • 11k