2
$\begingroup$

I'm very new to the data science and machine learning, so apologies for my ignorance. What I'm trying to understand is how to setup an image classifier system (maybe based on CNN) which will classify my image by multiple params. Most of the examples I found are about classifying by single class, i.e. "cat", "dog", "horse", etc, but what I'd like to have is, for example, {"red", "dog", "tongue"}. Is there a simple way to do it? The best option would be to have a ready setup, so I can just change their test dataset with mine and see the right formatting. Thanks!

UPDATE:

Also please help me understand if it's a complicated task for an experienced machine learning engineer? What'd be the timing and cost given a dataset?

$\endgroup$
0
$\begingroup$

You normally one hot encode your labels so that every possible attribute gets it's own binary representation. So if you have 10 attributes they would be represented as [attr1, attr2, attr3, ..., attr10], with values either 1 if the attribute is present, or 0 if it is not.

Then you train a network with the same number of output neurons as possible categories and use a sigmoid activation function.

$\endgroup$
9
  • $\begingroup$ Thanks for your answer, I though about the same. Can you advise me any guide to similar neural network? What you're talking is that I will have the images set and CSV with their IDs + multiple attributes for each? Can it be only 1/0 for a single attribute or 1/2/3/4/etc? (multiple options for some of attributes) $\endgroup$
    – NikitaFM
    Mar 12 '19 at 5:19
  • $\begingroup$ There are many examples with MNIST that are similiar to what you want. Here is one: kaggle.com/anebzt/mnist-with-cnn-in-keras-detailed-explanation. But you can google "MNIST CNN" and you will find loads more. Change the number of classes to your number of attributes. Your approach with CSV with ID and attribute labels is good. $\endgroup$ Mar 12 '19 at 5:50
  • $\begingroup$ Also change the input dimensions to fit your pictures, change the activation function in the last layer to be sigmoid instead of softmax and use mean squared error instead of accuracy. $\endgroup$ Mar 12 '19 at 6:04
  • $\begingroup$ You have to use binary (0/1) labels when using neural network. There are ways of telling the network that only one label can be true at the time by using softmax, but you seem to have a mix of labels that are mutually exclusive and not mutually exclusive. So I think it is best to treat them all as not mutually exclusive to make it easier for now. $\endgroup$ Mar 12 '19 at 6:08
  • $\begingroup$ Thank you for explanations so much! So if I classify by "cat", "dog", "horse", this'd be not a single attribute "type" with options "cat",etc, but rather three attributes "cat", "dog", "horse" with values 1/0, right? $\endgroup$
    – NikitaFM
    Mar 12 '19 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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