CPC G06F 16/532 (2019.01) [G06V 10/761 (2022.01); G06V 10/774 (2022.01); G06V 10/776 (2022.01); G06V 10/82 (2022.01)] | 9 Claims |
1. A method for rapid retrieval of target images based on artificial intelligence, comprising:
obtaining a template image and a plurality of known labels corresponding to the template image;
extracting an image to be detected from a target image database;
inputting both the image to be detected and the template image into a trained convolutional neural network, and outputting a hash code of the image to be detected and a hash code of the template image; and
obtaining a similarity between the image to be detected and the template image based on a Hamming distance between the hash code of the image to be detected and the hash code of the template image, and the smaller of the Hamming distance indicates the higher of the similarity, then selecting one or more images to be detected with the similarity higher than a set threshold as a retrieval result to output;
based on different situations, different loss functions are used for training, comprising:
when it is required to make prediction scores of all negative samples as low as possible and prediction scores of all positive samples as high as possible, and a range of values of the similarity scores is [−1, 1], then using a unified loss function Lu based on the similarity of hash codes;
when the loss function Lu is required to focus on positive samples with low similarity prediction scores, then using a loss function Lsu that weights an interval of the similarity prediction scores of positive and negative samples;
when it is required to make the prediction scores of all negative samples as low as possible and the prediction scores of all positive samples as high as possible, and the range of values of the used similarity scores is [0, 1], then using a loss function Lc based on the similarity of hash codes;
when the loss function Lc is required to focus on positive samples with low similarity prediction scores, then using a loss function Lsc that weights the interval of the similarity prediction scores of the positive and negative samples;
when the loss function Lsc is required to expect a significant difference between the similarity prediction scores of the negative samples and the similarity prediction scores of the positive samples, then using a loss function Lh;
when the loss function Lsu is required to update a similarity matrix in a process of optimization, then using a unified loss function Lsus, weighted based on an interval of the optimized similarity matrix;
when the loss function Lsc is required to update the similarity matrix in the process of optimization, then using a circular loss function Lscs weighted based on the interval of the optimized similarity matrix; and
when the loss function Lh is required to update the similarity matrix in the process of optimization, then using a loss function Lhs.
|