I am a little confused about the realization of exemplar selection with herding. In main_resnet_tf.py , from line 202 to 217:
print('Exemplars selection starting ...')
for iter_dico in range(nb_cl):
ind_cl = np.where(label_dico == order[iter_dico+itera*nb_cl])[0]
D = Dtot[:,ind_cl]
files_iter = processed_files[ind_cl]
mu = np.mean(D,axis=1)
w_t = mu
step_t = 0
while not(len(files_protoset[itera*nb_cl+iter_dico]) == nb_protos_cl) and step_t<1.1*nb_protos_cl:
tmp_t = np.dot(w_t,D)
ind_max = np.argmax(tmp_t)
w_t = w_t + mu - D[:,ind_max]
step_t += 1
if files_iter[ind_max] not in files_protoset[itera*nb_cl+iter_dico]:
files_protoset[itera*nb_cl+iter_dico].append(files_iter[ind_max])
The key of these codes is w_t = w_t + mu - D[:,ind_max], which lets w_t move in the direction of mu - D[:,ind_max], away from the current nearest sample. However, following Algorithm 4 in the paper, the final object of herding is to select m samples, making the mean of the exemplars closest to the class mean in the feature space. I am not sure whether these codes achieve the same goal by using such an iteration way. Anyone can explain or prove this? Thanks in advance : )
I am a little confused about the realization of exemplar selection with herding. In
main_resnet_tf.py, from line 202 to 217:The key of these codes is
w_t = w_t + mu - D[:,ind_max], which letsw_tmove in the direction ofmu - D[:,ind_max], away from the current nearest sample. However, following Algorithm 4 in the paper, the final object of herding is to select m samples, making the mean of the exemplars closest to the class mean in the feature space. I am not sure whether these codes achieve the same goal by using such an iteration way. Anyone can explain or prove this? Thanks in advance : )