mahmoodlab / Patch-GCN

Context-Aware Survival Prediction using Patch-based Graph Convolutional Networks - MICCAI 2021
http://mahmoodlab.org
GNU General Public License v3.0
114 stars 28 forks source link

Graph Construction #25

Open pazadimo opened 1 year ago

pazadimo commented 1 year ago

Hi @Richarizardd,

Thanks for sharing the code. I have a question regarding graph construction in latent space: I was wondering why do you pass coords to the query function for latent graph generation as:

model.fit(features)
a = np.repeat(range(num_patches), radius-1)    
b = np.fromiter(chain(*[model.query(coords[v_idx], topn=radius)[1:] for v_idx in range(num_patches)]),dtype=int)
edge_latent = torch.Tensor(np.stack([a,b])).type(torch.LongTensor)

I wonder if it is the way that DGC model requires for the graph to be constructed?

Thanks

Vison307 commented 2 months ago

I encountered with the same problem. I guess it is bug because once I print our the result of [model.query(coords[v_idx], topn=radius)[1:] for v_idx in range(num_patches)], I find all the queried indexes are the same. (Though I have no idea why the code can be executed successfully as coords and features are in different shapes).

image

After I change coords to features, the results seem to be normal.