wassdistance icon indicating copy to clipboard operation
wassdistance copied to clipboard

Question about using it as a loss function

Open Namelessness5 opened this issue 2 years ago • 1 comments

I applied the loss function in layers.py in my training, but I found it doesn't work. When I was trying to train a simple CNN with MNIST dataset, I checked the dataset's formate and yours and I found there's a difference.

Assuming there's 4 classes, like 0, 1, 2 ,3. The output of my network is like [0.1, 0.2, 0.3, 0.4] and the target is like [3], but yours is like [[0, 0.1], [1, 0.2], [2, 0.3], [3, 0.4]] and [[0, 0], [1, 0], [2, 0], [3, 1]]. So I made a transformation and here's my code. loss.txt

Namelessness5 avatar Sep 11 '22 10:09 Namelessness5

我在训练中应用了 layers.py 中的损失函数,但我发现它不起作用。当我尝试用MNIST数据集训练一个简单的CNN时,我检查了数据集的formate和你的格式,我发现两者之间存在差异。

假设有 4 个类,例如 0、1、2、3。我的网络的输出类似于 [0.1, 0.2, 0.3, 0.4],目标类似于 [3],但您的网络类似于 [[0, 0.1]、[1, 0.2]、[2, 0.3]、[3, 0.4]] 和 [[0, 0]、[1, 0]、[2, 0]、[3, 1]]。所以我做了一个转换,这是我的代码。 loss.txt

Have you solved the input dimension problem?

ZhaiJiaKai avatar Mar 26 '24 16:03 ZhaiJiaKai