Question

If I am building a model where I need to predict the vehicle, color of it, and make of it, then can I use all the labels for a single image and build my model around it.

Like for a single image of a vehicle which is a car (car1.jpg) will have labels like - Sedan(Make), Blue(Color) and Car(Type of vehicle). Can I make a single model for this or I will have to make 3 separate models for this problem.

Was it helpful?

Solution

One model will work in this case. Lets put it this way, let's say we are trying to solve multi-class(lets say 5) classification problem in neural networks we will have 5 neurons in the final dense layer and ideally use softmax as activation function and categorical_crossentrophy as loss function. Now coming back to multi-label classification lets take an example: Your car1 has labels like Sedan,Blue,and Type(Good). Your car2 has labels like SUV,Black, and type(Bad). You will these many neurons in your final layer lets say here we have 6 different types of labels for 2 cars, and we do one hot encoding for the target variables.

The difference is we use sigmoid and binary_crossentrophy as activation and loss functions. This will give probabilities of the labels for which each image belong to. Any questions, please post.

Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange
scroll top