FSCE
FSCE copied to clipboard
Ask for some details about proposals used in drawing t-SNR images
You can use the code below to visualize the features.
def plot_embedding(data, label, title,show=None):
# param data:data
# param label:label
# param title:title of output
# param show:(int) if you have too much proposals to draw, you can draw part of them
# return: tsne-image
if show is not None:
temp = [i for i in range(len(data))]
random.shuffle(temp)
data = data[temp]
data = data[:show]
label = torch.tensor(label)[temp]
label = label[:show]
label.numpy().tolist()
x_min, x_max = np.min(data, 0), np.max(data, 0)
data = (data - x_min) / (x_max - x_min) # norm data
fig = plt.figure()
# go through all the samples
data = data.tolist()
label = label.squeeze().tolist()
for i in range(len(data)):
plt.text(data[i][0], data[i][1], ".",fontsize=18, color=plt.cm.tab20(label[i] / 20))
plt.title(title, fontsize=14)
return fig
# weight:(n proposals * 1024-D) input of the classifier
# label: the label of the proposals/ground truth
# we only select foreground proposals to visualize
# you can try to visualize the weight of different classes by extracting weight during training or testing stage
ts = TSNE(n_components=2,init='pca', random_state=0)
weight = ts.fit_transform(weight)
fig = plot_embedding(weight, label, 't-SNE feature child')
plt.show()
Originally posted by @Chauncy-Cai in https://github.com/MegviiDetection/FSCE/issues/3#issuecomment-802534849
Hi, I'm trying to draw t-SNE images and this code helps me a lot. But I came up with a problem that I don't know which proposals should be used. There is only one proposal can be matched with one gt which is tp according to cocoAPI, and others are regarded as fp. For example, if 300 proposals are generated in one image and there are 10 gt in this image, no more than only 10 proposals can be matched with gt, and other 290 proposals match nothing. How do you handle the 290 proposals which is not matched with gt? More specific, how do you decide the label of the 290 proposals? Does "we only select foreground proposals to visualize" means that 290 proposals are discarded?