I would like to train a multi label classifier by gluoncv, let me use examples to explain the results I want to achieve
input output_0:color output_1:type
img_0 red jeans
img_1 blue shirt
…
…
The model should not need each combination of categories I would like to predict.
Ex : Train with blue jeans, red shirt, but the model should be able to predict blue shirt.
The solutions I found are combine multiple loss criteria together
criterian1 = gloss.SoftmaxCrossEntropyLoss()
criterian2 = gloss.SoftmaxCrossEntropyLoss()
.............
with autograd.record():
outputs = model(input)
loss1 = criterian1(outputs[0], targets[0])
loss2 = criterian2(outputs[1], targets[1])
autograd.backward([loss1, loss2])
My questions are :
- Could I achieve the results by this solution?
- If I could, what kind of caveats I should pay attentions?
- What are the advantages/disadvantages compare with another solutions
a. multi-labelsolutions–Train the model with every combinations of categories I want to predict(ex : red jean, blue jean, red shirt, blue shirt)
b. Train two classifier for each output, in this case they will be color and type, I guess this solutions is the easiest to train but the slowest.
Thanks
Edit : I confirm I could achieve the results by this solution, as long as I split the network to two branches.