2
$\begingroup$

Newbie here. This is a generic question.

Let's imagine I'm trying to identify fish from phone pictures, using CNN.

In some cases, there are fish species/group that look similar, but one is exclusively from marine habitats while the other one is found solely in freshwater. Therefore, if I could include "marine" or "freshwater" together with the picture, the classification would be, I guess, much more accurate, because the universe of possible outcomes is significantly reduced. Makes sense?

So, how do I include this "context" information into the CNN? For example, what about an additional neuron in the 1st layer which has a value of 1 for marine, 2 for freshwater and 0 for unknown?

Thanks

$\endgroup$

2 Answers 2

1
$\begingroup$

what about an additional neuron in the 1st layer

Yes, that's a sensible approach. But you probably want to take those values, {marine, fresh, unknown}, and one-hot encode them. Think of it as representing the concept with a few dedicated pixels.

Your primary target feature, Y, is fish species. But training your model against additional targets, like types of seaweed, may help it to identify whether we have a marine or freshwater image, and thus might help with identifying fish species.

$\endgroup$
0
0
$\begingroup$

You can put an additional neuron in the first layer, but since you are using a CNN, it feels more natural to include this additional info via a neuron closer to the output of your network. Specifically, after all your convolutional layers are done and you flatten their output, you could add the context info and feed everything through a fully connected layer. This also adds some modularity to your network.

And as mentioned by J_H already, think about one-hot-encoding your info.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.