huxiaoling / topoloss Goto Github PK
View Code? Open in Web Editor NEWCode for the NeurIPS 2019 paper: Topology-Preserving Deep Image Segmentation
License: MIT License
Code for the NeurIPS 2019 paper: Topology-Preserving Deep Image Segmentation
License: MIT License
I can successfully run TDFMain.py using Python 2.7 with the PersistencePython.so file in this repo. However, I'd like to use Python3. When I run the compile_pers_lib.sh I get the following error:
(...)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The "(...)" stands for a long list of frameworks needed. Perhaps you have a Python 3 version you could please share?
Thank you very much for your contribution,
I would like to ask when true 3D code will be released ?
Because most medical images are 3D.
I still can't understand your paper very well due to lack of knowledge of topology.
Have you ever written some blogs or guides about this paper?
I want to understand the paper more clearly.thank you!
Hi Xiaoling!
Thank you for the impressive work! I had some trouble when incorporating the TopoLoss into my model training. Specifically, I have two questions
Thank you in advance!
Can you please provide an example file for calling the executable CubicalPers_gcc?
usage: ./CubicalPers_gcc input_file.ext
it's not very clear in you paper about how to calculate β-error? And I can't find the code in your github too.
Could you release the code?
Thank you.
Hello!
First of all thanks for sharing your code.
Use your topological loss as follows: loss = nn.CrossEntropyLoss() + lambda * getTopoLoss(lh, gt).
In the process of code debugging, there are several questions I would like to ask you:
At present, during the running of the code, I don't know if the topological constraint is not very effective because gt has only one connected domain.
Looking forward to your reply.
Hi, sorry to bother you again. Can you provide the details of computing BETTI error? I saw that in cldice, they computed the betti error on random 64*64 patches. Did you do the experiments under the same setting?
if the tensor have been detached from the CNN-graph in GPU and convert to numpy, then the loss is calculated. How to make sure the topology loss is able to back-propagation.
here also have some comments on this question:
https://discuss.pytorch.org/t/how-to-use-external-libraries-like-opencv-numpy-scipy-etc-in-middle-of-forward-backward-phase/31066
Thanks, looking forward your respond.
Great work,but I wonder the 3d will be released?
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:
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:
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!
hi, I'm running topoloss.py, but I have a problem.
My input image has 7 holes, but the calculation results of len(pairs_lh[0][0]) is only 6, and bcp_lh and dcp_lh are 6 too.
At the same time, note that the starting and ending points of bcp_lh and dcp_lh do not correspond.
No matter how I change pictures, the number will always be one less.
I want to ask, is this a gudhi library problem or a debugging problem?
Hi,
I am interested to incorporate this into a framework I am working on which specializes in medical imaging.
To that end, having this as a pip/conda recipe would be amazing!
Cheers,
Sarthak
The persistent homology feature is specific to the pixel point, but I haven't found a way to match the pixel point to the barcode, can you help me?
The persistent homology feature is specific to the pixel point, but I haven't found a way to match the pixel point to the barcode, can you help me?
I have tried to import the module by placing the .so file in the working directory. I am getting an importerror. I am using windows os and python 3.7. When I run the compile_pers_lib.sh, .so file is getting generated. But still it throws an error saying that it is not a DLL application built on Windows. How to import the module in Windows system?
Hello, how did you get the boundary mask of CREMI dataset? It only provides the neuron_ids. I can extract the boundareis by applying skimage.segmentation.find_boundarys
on neuron_ids. But I got boundaries which seem thinner than what you have shown in paper. Did you add something such as a Gaussian blur? Thanks!
Hi,
how can I implement your loss function in a TensorFlow model?
Thank you for your time.
Any proof? It seems that these are pixel-based metrics that only use 4 basic partitions(TP, FP, TN, FN). And I have not found any related literature before yours claiming that ARI and VOI are related to topology correctness.
In fact, ARI is first used as an acronym for Adapted Rand Index in the CREMI (https://cremi.org/) official metric. On their website, they are also mentioned as pixel-based measures.
In
Line 161 in 5cb9817
y + int(bcp_lh[hole_indx][0]), x + int(bcp_lh[hole_indx][1])
?topo_cp_weight_map
has the same shape as likehood
, and bcp_lh
is the list of the global indices instead of local indices in current patch. x
and y
is the starting global index of current patch. Will this (x + int(bcp_lh[hole_indx][1]
) lead to some "segmentation fault" problem?Hi,
I assume this is the code for "Topology-Preserving Deep Image Segmentation" published at NeurIPS last week. This code only includes specific function and includes python functions rather than pytorch or tensorflow implementations? Would appreciate if you could point on how one is supposed to get started with this code.
Hello,I want to ask if is it availiable in windows system?
您好,我想问下这里的编译的具体过程:直接使用 sh compile_pers_lib.sh 就可以了吗? 是否还需要安装cmake、编译pybind11等操作;
还有这里的cubePers是为了计算持久图吗?我理解这里转成使用C++的代码来加速计算,我是否可以用 https://github.com/scikit-tda/persim来替代呢?
Hello, @HuXiaoling.
Thank you for providing this code! I just have a question about the getTopoLoss function on the topoloss_pytorch.py script:
The lines 220-225:
Lines 220 to 225 in bbf9d26
Line 160 in bbf9d26
Shouldn't they be outside the y for loop to get the total topological loss for the image?
Hello, thanks so much for sharing this decent work. I'm trying to integrate the topoloss_pytorch.py into deeplab_v3 (https://github.com/chenxi116/DeepLabv3.pytorch).
The target tensor is [ 0 1 255] b/c my label only has background (0) and membrane label (1), 255 is ignored when calculating CrossEntropyLoss. The output tensor is a probability map with a value something like [-43.70812 -43.228703 -42.97284 ... 54.40196 54.60862 55.549427].
When I tried to input the target and output tensor into the topoloss, the whole pipeline crashed with the following error.
Error in constructor Bitmap_cubical_complex_base ( std::vector<std::size_t> sizes_in_following_directions, std::vector<T> top_dimensional_cells ). Number of top dimensional elements that follow from sizes_in_following_directions vector is different than the size of top_dimensional_cells vector.
terminate called after throwing an instance of 'char const*'
Aborted
It seems that the error is from
# Get the critical points of predictions and ground truth
pd_lh, bcp_lh, dcp_lh, pairs_lh_pa = getCriticalPoints(lh_patch)
but there is no further instruction. Have you ever seen this exception? Many thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.