Skip to main content
. 2021 Jan 5;21(1):310. doi: 10.3390/s21010310
Algorithm 1. Method to construct multi-constraint image sets.
Input: Training set with place labels (xi,yi),i=1,2,,n;
Output: Multi-constraint image sets X;
1: Extract the feature vector for each training image;
2: for each i in {1, 2, ……, n} do
3:  Find u images from the same place with xi;
4:  Calculate the center point cp;
5:  for each j in {1, 2, ……, n} and ji do
6:    Find images from the same place & satisfy the distance relationship f(xjp)cp22>γ. Add these images into positive image set Xtemp;
7:    Find images from different places & satisfy the distance relationship f(xj)cp22<γ. Add these images into negative image set Xtemn;
8:  end for
9:  if len(Xtemn)>B then
10:    Randomly select B images from Xtemn;
11:  end if
12:  if 0<len(Xtemn)<B or (len(Xtemn)=0 and len(Xtemp)0) then
13:    Randomly select (Blen(Xtemn)) images from different places.
14:  end if
15:  if len(Xtemp)>A then
16:    Randomly select A images from Xtemp;
17:  end if
18:  if 0<len(Xtemp)<A or (len(Xtemp)=0 and len(Xtemn)0) then
19:    Randomly copy (Alen(Xtemp)) images from the same place.
20:  end if
21:  if Xp and Xn exist then
22:    Add Xp,Xn into X;
23:  end if
24: end for
25: return X