Giter Site home page Giter Site logo

Comments (12)

josedolz avatar josedolz commented on May 11, 2024

Hi,sorry for my late reply. I am currently on holidays in the countryside with very limited internet access. It seems to me that this error (from (19,19,19) to (19,19) shape broadcast problem comes from some conversion from 3D to 2D either in the data or in the filters you defined. As you mentioned, FCN can get images of arbitrary size. Actually images in the paper using this network have different sizes, so this is not an issue. For the generation of patches, the network takes care of that, so you only have to give the images and specify the patch sizes. What should be of same size is input image and ground truth. I will be back in around 10 days. If you do not solve the problem by that time I can have a look to your configuration.

Best

from livianet.

YilinLiu97 avatar YilinLiu97 commented on May 11, 2024

Thanks so much for the reply! That's fine I just want to post my question first so you may reply whenever you can:)

Yeah I think so too. But I didn't modify the settings for filters at all: kernelshapes = [[3, 3, 3], [3, 3, 3], [3, 3, 3], [1]]. It is 3D so should not cause this issue?
I can't think of where the 3D->2D conversion takes place as I only modified the # of classes, pre-trained weights(yours) and input dataset(of course).

Thanks again!

from livianet.

josedolz avatar josedolz commented on May 11, 2024

Hi @YilinLiu97 Jus back from holidays. Could you send me just one sample with its corresponding ground truth (and ROI in case you use it) to try to reproduce the error? Thanks.

from livianet.

YilinLiu97 avatar YilinLiu97 commented on May 11, 2024

Hi @josedolz, thanks for contacting me:) I have solved the problem. It is simply because the data files do not match with their ground truths. However, I do have some new questions:

  1. How am I supposed to segment 25 classes, when the ground true contains around 140 classes? Are ROIs used for that reason?
  2. If the ground true contains no label for the background, do I still need to include it when I specify the # of classes for segmentation in the config file? (i.e. numOfClasses - 25 or 26 in my case?)

Thank you!

from livianet.

josedolz avatar josedolz commented on May 11, 2024

Nice to hear that you solved that problem. It was strange because I have tried several times several configurations that might crash the algorithm and it always worked. Anyway, good news..:)

For your questions:
1- The number of classes should be the same both in training and testing. When you define the number of classes for the network, that is the output (one probability map per class) that you will get at the output of the network. Therefore it must be the same. ROIs are used first, to prone the search area, so that you only get patches inside the ROI, and for the sampling strategy, being sure that you get patches containing labels of interest (inside ROI) and also background (outside ROI). In segmentation it is only used to constrain the search region.

2- In all datasets I have been working with, background labels are present. When you have a new target image you usually have no clue where to look for, so the image usually contains classes of interest and background. So you need to include also that in training. That is why I recommend to include numClasses + 1.

If you are not satisfied with these answers, please feel free to add more details so that I can give you a more appropriate answer.

Best,

Jose

from livianet.

YilinLiu97 avatar YilinLiu97 commented on May 11, 2024

Thanks so much for the detailed explanation!! Sorry for my late reply.

Great! that's what I thought about the use of ROIs too. I have run the generateROIs.py and it works wonderfully! So, I need to modify this script a bit to constrain my search region only to where those 25 structures are? In that way I can segment only the 25 structures, right?

from livianet.

YilinLiu97 avatar YilinLiu97 commented on May 11, 2024

Because currently a issue is that if I specify the # of classes (in config) as 26, I will get the index error, but if I change it to 140, the problem will be solved (but I only want those 25 structures).

Your paper said that the IBSR contains expert-labelled segmentations of 45 brain structures, but only a subset of 8 important subcortical structures are considered. So in fact, I'm trying to do something similar except that I only want to segment 25 structures when the ground truth contains 140 structures. Thanks!

from livianet.

josedolz avatar josedolz commented on May 11, 2024

Ok, I think I got your point.

You mean that from a dataset with X classes you are interested only in Y classes (being Y < X), right?

In that case you should modify a bit the processLabels.py file, so that you select the labels you are interested in and you include them in your new ground truth, that will contain only the classes of interest. For example, let's say that in the IBSR dataset you want to get only the classes corresponding to the main subcortical structures (labels: 10,11,12,13,49,50,51,52 ) . Then, you can do something like:

labelsToSelect = [10,11,12,13,49,50,51,52]
        labelCorrectedImage = np.zeros(imageData.shape, dtype=np.int8)
        for i_l in xrange(0, len(labelsToSelect)):
            idx = np.where(imageData == labelsToSelect[i_l])
            labelCorrectedImage[idx] = i_l + 1

where imageData is the image containing all the labels.

from livianet.

YilinLiu97 avatar YilinLiu97 commented on May 11, 2024

Exactly! That code solved my problem! Thank you so much! :)

from livianet.

YilinLiu97 avatar YilinLiu97 commented on May 11, 2024

Sorry, one more question!
Is it possible to send me the Abide dataset with labels processed by freesurfer? (Or just the labels will be fine). Thank you in advance!! [email protected]

from livianet.

josedolz avatar josedolz commented on May 11, 2024

I'll ask the responsible of those labels, since you know that sharing medical images is not straightforward.

Jose

from livianet.

YilinLiu97 avatar YilinLiu97 commented on May 11, 2024

I see. That's fine! Thanks so much for the help :)

from livianet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.