I am currently making this dataset which looks something like this:
[ [x, y], # ground truth for a coordinate
[0], # 1-hot encodings for class identification, there are 4 of these
[1],
[0],
[0] ]
For example, I am going to input some images and I want a vector output like above. I consider predicting coordinate as a regression problem and the 1 hot-encoding as a classification problem. Can I use MSEloss or L1loss on the first value and use cross-entropy for the bottom 4 values? I am self-taught so there is a lot that I don’t know sorry if this is a stupid question. Code example welcome.
Edited:
I found this while doing some research,
b = nn.MSELoss()
a = nn.CrossEntropyLoss()
loss a = a(output_x, x_labels)
loss_b = b(output_y, y_labels)
loss = loss_a + loss_b loss.backward()
So in theory can I make a prediction with my network, eg y_hat and slice off the coordinates prediction and call it output_x and do the same thing for output_y for classification? Will this work with my problem?