HuXiaoling / TopoLoss

Code for the NeurIPS 2019 paper: Topology-Preserving Deep Image Segmentation
MIT License
155 stars 24 forks source link

IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed #28

Open rouchoo opened 5 months ago

rouchoo commented 5 months ago

hi, Dr Hu. Recently, I have been tried to run your Topoloss.py in my own network.

The shape of input tensor is [4, 2, 512, 512], and the shape of label tensor is [4, 512, 512]. I want to traverse four images in a batch and calculate their average loss, so I wrote the following code:

image

At the beginning, i can successfully run the code while the speed was very slow (because it had to be calculated on the CPU). Later, during the 14000 iteration, it suddenly reported the following error:

image

I guess it should be resulted by the certain image calculated homology features only have 0-dimension (points) and not have 1-dimension (loops).

Can you give me some guidance? Thanks!

rouchoo commented 5 months ago

I notice that your team and your boss Chen Chao are focusing on persistent homology and have greatly successes in the top level meetings such as Nips, ICCV, EMNLP. I am also interested in persistent homology theory. I have been reading your articles recently, such as 《Topology-Preserving Deep Image Segmentation》, 《TOPOLOGY-AWARE SEGMENTATION USING DISCRETE MORSE THEORY》,《LEARNING PROBABILISTIC TOPOLOGICAL REPRESENTATIONS USING DISCRETE MORSE THEORY》. If possible, I beg to add your contact information to inquire about some basic questions. My mail is 877858674@qq.com. Thanks!