Open wangfuli opened 10 months ago
@wangfuli Hello, I have a question for you. In the process of debugging this code, the fuzzy_c_means function after a few iterations, the elements inside membership matrix all become the same. This doesn't seem to make sense. Do you meet the same situation?
@wangfuli Hello, I have a question for you. In the process of debugging this code, the fuzzy_c_means function after a few iterations, the elements inside membership matrix all become the same. This doesn't seem to make sense. Do you meet the same situation?
Hello, in your problem, if the elements inside the membership matrix all become the same, the weights and centers will not change at all, and this would lead to the convergence break before i hits max_iter -1. This situation didn't happen to me, I was able to run the updating process until the max_iter.
However, some images, especially images with many common pixel values could lead to the problem you encountered. For one of my images (with most pixel values are 0), I found 16145/ 16384 rows are the same in its corresponding membership matrix(torch.Size([16384, 9])), and this makes sense because these 0-value pixels (nodes) should all have the same membership allocation.
@wangfuli Hello, have you debugged with the HypergraphConv2d function, I have met tensor mismatch issues when "Adding the hyperedge center features to the aggregated hyperedge features" with following code
aggregated_hyperedge_features += centers
Do you meet this issue? How to solve it?
Actually, the whole function seems weried, many issues.
Hello authors of ViHGNN,
When I tried to run the fuzzy c-means to form hypergraphs, I found the hyperedge matrix is suspiciously dense, so I went back to check the actual implementation and found that the resulting membership tensor (batch_size, num_points, n_clusters) might not be computed appropriately, because the entries of membership[b, p, :] are not fractions and 'torch.sum(membership, dim=2)' does not yield 1's.
I have tried to replace the following code
inv_dist = 1.0 / (dist_to_centers + 1e-10) power = 2 / (m - 1) membership = (inv_dist / inv_dist.sum(dim=-1, keepdim=True).pow(power)).pow(power) # (batch_size, num_points, n_clusters)
with my implementation:
y = dist_to_centers.unsqueeze(-1).expand(-1, -1,-1, dist_to_centers.size(2)) # (batch_size, num_points, n_clusters, n_clusters) z = y.transpose(-1, -2) # (batch_size, num_points, n_clusters, n_clusters) power = 2 / (m - 1) membership = 1.0 / torch.sum((y / z).pow(power), dim=-1) # (batch_size, num_points, n_clusters)
and it fixed the problem.
It might be me misunderstanding the code, so please let me know what you think. Thank you so much.
hello,Have you successfully implemented this paper, I found that there are a lot of errors in the construct_hyperedges function
@wangfuli Hello, I have a question for you. In the process of debugging this code, the fuzzy_c_means function after a few iterations, the elements inside membership matrix all become the same. This doesn't seem to make sense. Do you meet the same situation?
@jerryzhu1229 hi, I meet the same issue, have you fixed it?
Hello authors of ViHGNN,
When I tried to run the fuzzy c-means to form hypergraphs, I found the hyperedge matrix is suspiciously dense, so I went back to check the actual implementation and found that the resulting membership tensor (batch_size, num_points, n_clusters) might not be computed appropriately, because the entries of membership[b, p, :] are not fractions and 'torch.sum(membership, dim=2)' does not yield 1's.
I have tried to replace the following code
inv_dist = 1.0 / (dist_to_centers + 1e-10) power = 2 / (m - 1) membership = (inv_dist / inv_dist.sum(dim=-1, keepdim=True).pow(power)).pow(power) # (batch_size, num_points, n_clusters)
with my implementation:
y = dist_to_centers.unsqueeze(-1).expand(-1, -1,-1, dist_to_centers.size(2)) # (batch_size, num_points, n_clusters, n_clusters) z = y.transpose(-1, -2) # (batch_size, num_points, n_clusters, n_clusters) power = 2 / (m - 1) membership = 1.0 / torch.sum((y / z).pow(power), dim=-1) # (batch_size, num_points, n_clusters)
and it fixed the problem.
It might be me misunderstanding the code, so please let me know what you think. Thank you so much.