Git Product home page Git Product logo

Comments (22)

ellisdg avatar ellisdg commented on August 21, 2024

@build2create sorry, I hadn't tested that code out yet. With the latest commit that I just committed, you should be able to run the code as you have it in your comment.

from 3dunetcnn.

build2create avatar build2create commented on August 21, 2024

Alright!

from 3dunetcnn.

build2create avatar build2create commented on August 21, 2024

With the pre-trained model given here I generated training_ids.pkl andtesting_ids.pkl.Bascially just to get testing ids required to test the model. I defined main class as :

if __name__ == '__main__':
    run_test_case(1,"./data_test")

The problem is it is not producing any data_dir .Neither it is appending to it if I create one. And this:

if __name__ == '__main__':
    model = load_model(config["model_file"])
    predict_from_data_file_and_write_image(model,config["hdf5_file"],0,result.nii.gz)

And this

if __name__ == '__main__':
    model = load_model(config["model_file"])
    predict_from_data_file_and_write_image(model,config["hdf5_file"],0,data_dir)#data_dir  is directory

All of them fail to produce any segmented output. Plus where is get_prediction_labels getting called?
@ellisdg any idea on this one? Apologies for the constant trouble.

from 3dunetcnn.

ellisdg avatar ellisdg commented on August 21, 2024

Maybe try giving a full path name instead of "./data_test"? Does that work?

from 3dunetcnn.

build2create avatar build2create commented on August 21, 2024

It worked but gave error
ValueError: "concat" mode can only merge layers with matching output shapes except for the concat axis. Layer shapes: [(None, 1024, 18, 18, 9), (None, 256, 18, 18, 18)]
then I updated the configuration in keras.json file as

{
"image_dim_ordering": "th",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tensorflow"
}

Note: earlier "backend": "theano" this was the in the keras.json file so it was giving error.(refer this)
it ran finally but gave error:
ValueError: Invalid objective: dice_coef_loss

then I added these:
from model import dice_coef_loss
from model import dice_coef
and
model = load_model(config["model_file"],custom_objects={'dice_coef_loss': dice_coef_loss,'dice_coef':dice_coef})

Now I get this error:

ValueError: Error when checking : expected input_1 to have 5 dimensions, but got array with shape (3, 144, 144, 144)
To which I added 'T2' to config["training_modalities"]
Now to the call in main:
run_test_case(1,'/home/adminsters/Desktop/3DUnetCNN-master/data_dir');
it gives index error:

  File "testing.py", line 67, in <module>
    run_test_case(1,'/home/adminsters/Desktop/3DUnetCNN-master/data_dir');
  File "testing.py", line 53, in run_test_case
    image = nib.Nifti1Image(test_data[i], affine)
IndexError: index 3 is out of bounds for axis 0 with size 3

My testing_ids.pkl is:
[141, 20, 15, 57, 186, 167, 60, 80, 23, 54, 143, 158, 132, 83, 61, 81, 168, 85, 157, 90, 147, 86, 127, 199, 74, 136, 24, 182, 146, 152, 170, 44, 30, 156, 172, 154, 1, 25, 59, 45]

I guess it is because I changed the config["training_modalities"]
@ellisdg how to fix this Index error?

from 3dunetcnn.

ellisdg avatar ellisdg commented on August 21, 2024

from 3dunetcnn.

build2create avatar build2create commented on August 21, 2024

I am getting index error. Please see updated comment

from 3dunetcnn.

build2create avatar build2create commented on August 21, 2024

In case you are not able to see I am reposting it here:
Initially I was getting this:
ValueError: "concat" mode can only merge layers with matching output shapes except for the concat axis. Layer shapes: [(None, 1024, 18, 18, 9), (None, 256, 18, 18, 18)]
then I updated the configuration in keras.json file as


{
"image_dim_ordering": "th",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tensorflow"
}

Note: earlier"backend": "theano" this was the in the keras.json file so it was giving error.(refer this)
it ran finally but gave error:
ValueError: Invalid objective: dice_coef_loss
then I added these:

from model import dice_coef_loss
from model import dice_coef

and
model = load_model(config["model_file"],custom_objects={'dice_coef_loss': dice_coef_loss,'dice_coef':dice_coef})
Now I get this error:

ValueError: Error when checking : expected input_1 to have 5 dimensions, but got array with shape (3, 144, 144, 144)
So in config.py I added 'T2' to config["training_modalities"]
Now to the call in main:
run_test_case(1,'/home/adminsters/Desktop/3DUnetCNN-master/data_dir');
it gives index error:

  File "testing.py", line 67, in <module>
    run_test_case(1,'/home/adminsters/Desktop/3DUnetCNN-master/data_dir');
  File "testing.py", line 53, in run_test_case
    image = nib.Nifti1Image(test_data[i], affine)
IndexError: index 3 is out of bounds for axis 0 with size 3

My testing_ids.pkl is:
[141, 20, 15, 57, 186, 167, 60, 80, 23, 54, 143, 158, 132, 83, 61, 81, 168, 85, 157, 90, 147, 86, 127, 199, 74, 136, 24, 182, 146, 152, 170, 44, 30, 156, 172, 154, 1, 25, 59, 45]

I guess it is because I changed the config["training_modalities"]
@ellisdg how to fix this Index error?

from 3dunetcnn.

ellisdg avatar ellisdg commented on August 21, 2024

It looks like you may have modified line 53, or you may not have the latest version of the file.

from 3dunetcnn.

build2create avatar build2create commented on August 21, 2024

Ok my bad, ran the updated code this time.
I got his output :
image
for a test image id 20. How should I infer segmentation labels from this, which one is necrotic,edemic and so on? Like the one in this
When I choose to open segmented image I get this:
image
Which patch is tumorous how should I interpret?

from 3dunetcnn.

ellisdg avatar ellisdg commented on August 21, 2024

from 3dunetcnn.

build2create avatar build2create commented on August 21, 2024

Can you elaborate? The first screenshot shows grayscale image. Is that correct?How do I read the first image?Is it like darker parts tumorous? Can you cite/give an example?

from 3dunetcnn.

build2create avatar build2create commented on August 21, 2024

If I have understood it right this is not for tumor detection but just for volumetric segmentation right?

from 3dunetcnn.

build2create avatar build2create commented on August 21, 2024

For FLAIR modality I am sort of getting evidently slightly more greyish patch, Is that the tumor?

from 3dunetcnn.

ellisdg avatar ellisdg commented on August 21, 2024

T1:
t1
T1c:
t1c
FLAIR:
flair
Tumor prediction. Ranges from 0 to 1:
prediction
Manual segmentation. The separate tumor regions are not used by the classifier:
truth

from 3dunetcnn.

build2create avatar build2create commented on August 21, 2024

Thanks. By the way which tool are you using for viewing? Is it ITK sanp?

from 3dunetcnn.

ellisdg avatar ellisdg commented on August 21, 2024

3D Slicer. I know a lot of people use ITK Snap, but I've never taken the time to learn how to use it. 3D Slicer has a lot of features, so there might be a little bit of a learning curve. They also have plenty of helpful tutorials too.

from 3dunetcnn.

build2create avatar build2create commented on August 21, 2024

Thanks a lot!

from 3dunetcnn.

build2create avatar build2create commented on August 21, 2024

By volumetric segmentation we are detecting the presence or absence of the tumor but not the different segments within the tumor, like necrotic, core or enhancing. Doing this would be a multi-class classification problem right?

from 3dunetcnn.

build2create avatar build2create commented on August 21, 2024

Also why are we not able to segment the tumor into sub-parts.Is it because of data set?I viewed ground truth of BRATS dataset in mha format. They do provide all the segmentation labels.

from 3dunetcnn.

ellisdg avatar ellisdg commented on August 21, 2024

You should be able to train a classifier to segment different tumor regions with Keras. However, I currently have no need for multi-class labels, so I have not implemented it yet. I will probably add this eventually, but that could be months from now.

from 3dunetcnn.

mingrui avatar mingrui commented on August 21, 2024

for anyone coming from the future, testing.py was renamed to predict.py:

b4012bb#diff-22508acf6c6356eb94fbcda75eaf09f2

from 3dunetcnn.

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.