Skip to main content
. 2021 Mar 8;21(5):1894. doi: 10.3390/s21051894
Algorithm1: Unsupervised trademark retrieval method based on attention mechanism
Input: Retrieved image I, Trademark database M.
Output: Image sequence R which is similar to I.
Step1:
for i←1 to maximum_epochs do
      1.  Select training samples from M to obtain the training batches as X={Xi},i=1,2n.
      2. Feature extraction obtains vi to form feature set V={vi}, put V into the instance discrimination module.
      3.  Calculate the loss from vi and optimize loss, update V iteratively.
      4. Backpropagate the loss and update the parameters.
      5. Repeat the above steps until the algorithm converges to get the feature extraction network N.
   end for
step2:
      1. Put M into the N, form a database of trademark image feature as F={f1,f2fN},FRN×128, store F in the retrieval module.
      2. Put I into the N, get a image feature as f0R1×128, store f0 in the retrieval module.
      3.  Measure similarity between F and f0, output similar image sequence R.