Method and system for classifying images using image embedding
There is described a computer-implemented method and system for classifying images, the computer-implemented method comprising: receiving an image to be classified, generating a vector representation of the image to be classified using an image embedding method, comparing the vector representation of the image to predefined vector representations of the predefined image categories, and identifying a relevant category amongst the predefined image categories based on the comparison, the relevant category being associated with the image to be classified and outputting the relevant category.
1. A method for classifying an image amongst predefined image categories, the method being executed by at least one processor, the method comprising:
receiving an image to be classified;
generating a vector representation of the image to be classified using an image embedding method;
comparing the vector representation of the image to predefined vector representations of the predefined image categories;
identifying a relevant category amongst the predefined image categories based on the comparison, the relevant category being associated with the image to be classified and outputting the relevant category; and
wherein for each one of the predefined image categories, the predefined vector representation is generated using:
receiving at least one reference image associated with the predefined image category;
generating a first vector representation of the at least one reference image;
receiving semantic information about the predefined image category;
generating a second vector representation of the semantic information using a word embedding method; and
combining the first vector representation and the second vector representation to obtain the predefined vector representation.
2. The method of claim 1 , wherein said generating the vector representation of the image to be classified and said generating the first vector representation of the at least one image comprises using a convolutional neural network.
3. The method of claim 1 , wherein said generating the second vector representation of the semantic information comprises using a language model pre-trained on unsupervised text corpora.
4. The method of claim 3 , wherein for said generating the second vector representation of the semantic information comprises using a fully connected neural network.
5. The method of claim 1 , wherein said combining first vector representation and the second vector representation to obtain the predefined vector representation comprises performing a convex combination of the first vector representation and the second vector representation to obtain the predefined vector representation.
6. The method of claim 5 , wherein the first vector representation lies in a visual metric space and the second vector representation lies in a semantic space.
7. The method of claim 1 , wherein the at least one reference image comprises at least two reference images each associated with the predefined image category, the first vector having been generated by:
generating a vectorial representation for each one of the at least two reference images using the image embedding method; and
averaging the vectorial representations to obtain the first vector representation.
8. The method of claim 1 , further comprising a transformer network for, when the second vector representation does not lie on a dimensional space of the first vector representation, applying a transformation to the second vector representation of the semantic information to obtain a transformed vector representation of the semantic information, the transformed vector representation lying on the dimensional space of the first vector representation; and combining the first vector representation and the transformed vector representation together.
9. A system for classifying an image amongst predefined image categories, the system comprising:
a processor; and
a non-transitory storage medium operatively connected to the processor, the non-transitory storage medium comprising computer-readable instructions, the non-transitory storage medium comprising:
predefined vector representations of the predefined image categories,
the processor, upon executing the computer-readable instructions, being configured for:
receiving an image to be classified;
generating a vector representation of the image to be classified using an image embedding method;
comparing the vector representation of the image to predefined vector representations of the predefined image categories;
identifying a relevant category amongst the predefined image categories based on the comparison, the relevant category being associated with the image to be classified and outputting the relevant category; and
wherein for each one of the predefined image categories, the predefined vector representation is generated using:
receiving at least one reference image associated with the predefined image category;
generating a first vector representation of the at least one reference image;
receiving semantic information about the predefined image category;
generating a second vector representation of the semantic information using a word embedding method; and
combining the first vector representation and the second vector representation to obtain the predefined vector representation.
10. The system of claim 9 , wherein said generating the vector representation of the image to be classified and said generating the first vector representation of the at least one image comprises using a convolutional neural network.
11. The system of claim 9 , wherein generating the second vector representation of the semantic information comprises using a language model pre-trained on unsupervised text corpora.
12. The system of claim 11 , wherein for said generating the second vector representation of the semantic information comprises using a fully connected neural network.
13. The system of claim 9 , wherein said combining first vector representation and the second vector representation to obtain the predefined vector representation comprises performing a convex combination of the first vector representation and the second vector representation to obtain the predefined vector representation.
14. The system of claim 13 , wherein the first vector representation lies in a visual metric space and the second vector representation lies in a semantic space.
15. The system of claim 9 , wherein the at least one reference image comprises at least two reference images each associated with the predefined image category, the processor being further configured for:
generating a vectorial representation for each one of the at least two reference images using the image embedding method; and
averaging the vectorial representations to obtain the first vector representation.
16. The system of claim 9 , wherein the processor is further configured for: using a transformer for, when the second vector representation does not lie on a dimensional space of the first vector representation, applying a transformation to the second vector representation of the semantic information to obtain a transformed vector representation of the semantic information, the transformed vector representation lying on the dimensional space of the first vector representation; and
combining the first vector representation and the transformed vector representation together.