in build_graph/localization_network/dataset.py [0:0]
def far_interaction_same_kitchen_visually_dissimilar(self, indexA, T, pdist, threshold):
entryA = self.data[indexA]
candidates = [entry for entry in self.data if entryA['v_id'].split('_')[0] in entry['v_id']]
indexA_new = [idx for idx in range(len(candidates)) if candidates[idx]['uid']==entryA['uid']][0]
if len(candidates)<2*T+2:
# print ('Not enough candidates: OOPS')
return self.far_interaction(indexA, T)
uidxA = pdist['uid_to_idx'][self.data[indexA]['uid']]
timeout = 100
for t in range(timeout):
indexB = self.get_far_idx(indexA_new, T, len(candidates))
uidxB = pdist['uid_to_idx'][self.data[indexB]['uid']]
if pdist['pdist'][uidxA, uidxB] == 0 or pdist['pdist'][uidxA, uidxB]>threshold:
break
if t==timeout-1:
# print ('Timeout: OOPS')
return self.far_interaction(indexA, T)
entryB = candidates[indexB]
frameB = self.rs.randint(0, len(entryB['frames']))
frameB = entryB['frames'][frameB]
return frameB, f'T: {pdist["pdist"][uidxA, uidxB]:3f}'