hi~ I want to train CSQ on a person reid task.
the class num is more than 40,000
the code which was used to set the hash target center can be extremly time consumming,
do you have any suggestion?
@yuanli2333
`
if H_2K.shape[0] < n_class:
hash_targets.resize_(n_class, bit)
for k in range(20):
for index in range(H_2K.shape[0], n_class):
ones = torch.ones(bit)
# Bernouli distribution
sa = random.sample(list(range(bit)), bit // 2)
ones[sa] = -1
hash_targets[index] = ones
# to find average/min pairwise distance
c = []
for i in range(n_class):
for j in range(n_class):
if i < j:
TF = sum(hash_targets[i] != hash_targets[j])
c.append(TF)
c = np.array(c)
# choose min(c) in the range of K/4 to K/3
# see in https://github.com/yuanli2333/Hadamard-Matrix-for-hashing/issues/1
# but it is hard when bit is small
if c.min() > bit / 4 and c.mean() >= bit / 2:
print(c.min(), c.mean())
break
hi~ I want to train CSQ on a person reid task. the class num is more than 40,000 the code which was used to set the hash target center can be extremly time consumming, do you have any suggestion? @yuanli2333
`
`