GithubHelp home page GithubHelp logo

ibbm / cascaded-fcn Goto Github PK

View Code? Open in Web Editor NEW
300.0 38.0 127.0 6.21 MB

Source code for the MICCAI 2016 Paper "Automatic Liver and Lesion Segmentation in CT Using Cascaded Fully Convolutional NeuralNetworks and 3D Conditional Random Fields"

License: Other

Jupyter Notebook 100.00%
deep-learning deep-neural-networks segmentation medical-imaging liver-segmentation 3d-crf caffe fully-convolutional-networks semantic-segmentation

cascaded-fcn's People

Contributors

felixgruen avatar mohamed-ezz avatar patrickchrist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cascaded-fcn's Issues

Weights for MRI model

Hello,
I achieved very good and very fast inference with your CT model. Are the MRI weights available somewhere?
thx e.-

Example Docker does not work (crashes)

After I couldn't get the notebook to work on my own caffe installation (see #29) I tried running your prepared docker. However this line

# Load network
net1 = caffe.Net(STEP1_DEPLOY_PROTOTXT, STEP1_MODEL_WEIGHTS, caffe.TEST)

throws the following error

...
F0509 19:58:49.805807    24 cudnn_relu_layer.cpp:15] Check failed: status == CUDNN_STATUS_SUCCESS (1 vs. 0)  CUDNN_STATUS_NOT_INITIALIZED

My host system is ubuntu 18.04, NVIDIA Driver Version 390.48, CUDA Version 9.1.85 (if that is any help)
caffe is set to CPU mode in your example jupyter notebook

Any help would be appreciated.

question

step2_weights.caffemodel I cannot find

Class Weight Selection

why use class weight 1, 13,120 ? Can we use other number for weights ?...On what basis you are using this weights..

class_loss_weights: 1
class_loss_weights: 13
class_loss_weights: 120

model link is not found

Hi, I found your model link is disable, can you update your link or give me a web link, thank you

#question. Do we need to train for step 2 in cascaded FCN?

Hello,

I'm following this notebook: https://github.com/mohamed-ezz/saratan/tree/master/notebooks for Step 1 caffemodel, I just need clarification on my understanding once I trained for dataset 3D-Ircadb using this notebook so basically my model is ready to segment liver. How about for lesion, do I need to save the result after segmenting in Step1 and use the same notebook for creating the Step 2 model.
Please help me to understand, I don't see how's this is taken care in the code.

#Question:The results in the Docker are inconsistent with the illustrations in the paper

The illustration in the paper uses the 86th slice of the patient No. 9 in the data set,and I successfully ran the cascaded_unet_inference.ipynb program in Docker,but the result is inconsistent with the picture in the paper, where is the implementation of my right? Is not using 3DCRF? In the Docker how should we use denseinference?Looking forward to your answer

training proto

hi

I could only find the deploy proto
can you please provide the complete set of proto? train, train val?

thanks

model test problem

Hi, I have tested your released model, my code is refer to your notebook. my code is

`caffe.set_mode_gpu()
caffe.set_device(2)
net_liver = caffe.Net('/home/zhou/zou/Cascaded-FCN/models/cascadedfcn/step1/step1_deploy.prototxt', '/home/zhou/zou/Cascaded-FCN/models/cas cadedfcn/step1/step1_weights.caffemodel', caffe.TEST)

img=read_dicom_series("../train_image/3Dircadb1.17/PATIENT_DICOM/")
lbl=read_liver_lesion_masks("../train_image/3Dircadb1.17/MASKS_DICOM/")
S = 90
img_p = step1_preprocess_img_slice(img[...,S])
lbl_p = preprocess_lbl_slice(lbl[...,S])
net_liver.blobs['data'].data[0,0,...] = img_p
pred = net_liver.forward()['prob'][0,1] > 0.5
plt.figure(figsize=(3*5,10))
plt.subplot(1, 3, _1)
plt.title('CT')
plt.imshow(img_p[92:-92,92:-92], 'gray')
plt.subplot(1, 3, 2)
plt.title('GT')
plt.imshow(lbl_p, 'gray')
plt.subplot(1, 3, 3)
plt.title('pred')
plt.imshow(pred, 'gray')`

but the result is very bad like this
result

How to run 3D CRF?

Hello,

I'm trying to reproduce your results and I'm having trouble with the CRF step. Following the ipython notebook, I'm using image 17 from 3DIRCAdb1. I've made some modifications in the notebook to run the network for every slice. Without CRF, I got a dice score of 0.8573.

I cloned and installed https://github.com/mbickel/DenseInferenceWrapper/. However, I'm not sure how I can use it. I'm trying the following:

pro = CRFProcessor.CRF3DProcessor()
result = pro.set_data_and_run(img_preprocessed, extended_labels)

Where img_preprocessed is the preprocessed image without the padding reflections (dimensions (W,H,D); and extended_labels is the output of the predictions (direct probabilities, not thresholded bool) with dimensions (W,H,D,L) (where L = 1). I'm getting a (W,H,D) matrix with zeroes.

Can you help me with this?

How to create our own model with CT images and ground truth

Hi,
I have abdominal CT scan data sets for 15 patients. Among them 5 data sets are with HCC legions. I also have the ground truths of liver for all the data sets and also ground truth of legions for the 5 data sets with HCC.
Can you help me train this data to create my own caffe model?

Thanks,
Jayanth.

Discrepancy in dice scores

You have reported a dice score of 82.3% for the lesions in the first paper. It's not clear as to what this metric belongs to. Is it the dice score for lesion at training or testing?

In the follow-up paper, it's been reported as follows: "In general, we observe significant additional improvements for Dice overlaps of liver segmentations, from mean Dice 93.1% to 94.3% after applying the 3D CRF. For lesions we could achieve a Dice score of 56% at a standard deviation of 26% with a 2 fold cross-validation."

Can you clarify me regarding the correct results? Why is there a discrepancy?

paper question

Hi, I have read your paper many times and I have some questions. Hope you can help me, thank you!
in Table 1, are all the results for liver segmentation? If the results are for liver, in my option the first branch of Cascaded UNET is for liver segmentation and it is just a UNET, why the result is very different from the UNET?(DICE 93.1% vs 72.9%).

Why is my prediction so bad?

This is my code:
STEP1_DEPLOY_PROTOTXT = "/home/mi/smj/myproject/Cascaded-FCN-master/models/cascadedfcn/step1/step1_deploy.prototxt"
STEP1_MODEL_WEIGHTS = "/home/mi/smj/myproject/Cascaded-FCN-master/models/cascadedfcn/step1/step1_weights.caffemodel"
STEP2_DEPLOY_PROTOTXT = "/home/mi/smj/myproject/Cascaded-FCN-master/models/cascadedfcn/step2/step2_deploy.prototxt"
STEP2_MODEL_WEIGHTS = "/home/mi/smj/myproject/Cascaded-FCN-master/models/cascadedfcn/step2/step2_weights.caffemodel"
img=read_dicom_series("/home/mi/smj/myproject/Cascaded-FCN-master/test_image/3Dircadb1.17/PATIENT_DICOM/")
lbl=read_liver_lesion_masks("/home/mi/smj/myproject/Cascaded-FCN-master/test_image/3Dircadb1.17/MASKS_DICOM/")

This is my result:
after step1 process
step1 prediction
after step2 process
step2 prediction

Why is result so bad?

train.prototxt

Do you have the train.prototxt to finetune the attached models?

Issue with prediction method

OS: ubuntu 16.04
GPU: Nvidia GeForce GTX 105
The kernel dies while loading network when working from docker
and when I set up my own environment I am able to run it through some layers only from net.forward() method but unable to get to the output, the kernel dies on forward pass. kindly suggest how to solve the issue as I am testing it only for one image right now as given in the notebook. Thank you

screenshot from 2018-07-05 18-33-41

Batch normalization not used? Step2 dataset?

Hi, I studied u-net prototxt and your unet-overfit-python.prototxt . I found that you didn't use batch normalization layer. Can you explain why?

In step1, the dataset contains 15 patients to train liver. And for step2, do you still use these 15 patients' CT scans? You crop the liver and resized and padded to fit the u-net. Then I thought there are two problems:
1, for each slice, liver size is different, if you crop just the tiny liver, comparing with those "big" liver, there will be noises. In Medical image processing, they often crop the liver by the volume size, not the liver size of a single slice.
2, for 15 patients, 2063 slices in total, 1572 of them have livers, and only 579 of them have tumors. You just crop all livers to train lesion in step2? Then will there be imbalance problem?

Finetune Ultrasound 2D Dataset.

Hi,

I would like to train my dataset , which consist of ultrasound 2D images, in gray-scale, for making automatic bone segmentation . I have no GPU, so I would like to finetune your model in order to do the training faster . My images are of different sizes( the height is fixed at 512, but the width varies between 300 and 512. Is there any special consideration in this case ? Your cand find attached an example of an image and the ground truth
image_01_0541_croped
image_01_0541_croped

Thank you very much,

Cordially,

Mateo Villa

Regarding preprocessing(for step1)

Hi,
I am having trouble understanding pre-processing step. I have dicom images of liver of size 512x512. How do I proceed further?Do I have to resize it to 388x388 and add symmetrical padding of size 92?

Any help would be appreciated.

Thanks.

TypeError: slice indices must be integers or None or have an __index__ method`

Firstly, let me commend you on your effort for this paper and the repo that accompanies it. As a programmer myself, I know how difficult it is to write code especially for machine learning models.

I successfully, reproduced the results through a GPU hardware and the code code ran up until:

# Visualize results imshow(img_p, lbl_p, pred>0.5, title=['Slice','Ground truth', 'Prediction'])

Besides, I also had to downgrade SCIPY to 1:00 because of the depreciated imgresize issue.

/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:108: DeprecationWarning: imresizeis deprecated!imresizeis deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use ``skimage.transform.resize`` instead. /usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:104: DeprecationWarning:imresizeis deprecated!imresize is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use ``skimage.transform.resize`` instead.

perhaps you could look into these issues.

Additionally, running:
`# Prepare liver patch for step2

net1 output is used to determine the predicted liver bounding box

img_p2, bbox = step2_preprocess_img_slice(img_p, pred)
imshow(img_p2)`

gave the following error:
`---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
----> 1 img_p2, bbox = step2_preprocess_img_slice(img_p, pred)
2 imshow(img_p2)

in step2_preprocess_img_slice(img_p, step1_pred)
79 y2 = min(img.shape[0], y2+y_pad)
80
---> 81 img = img[y1:y2+1, x1:x2+1]
82 pred = pred[y1:y2+1, x1:x2+1]
83

TypeError: slice indices must be integers or None or have an index method`

these affected the rest of the executions such as:

  1. `# Visualize result

extract liver portion as predicted by net1

x1,x2,y1,y2 = bbox
lbl_p_liver = lbl_p[y1:y2,x1:x2]

Set labels to 0 and 1

lbl_p_liver[lbl_p_liver==1]=0
lbl_p_liver[lbl_p_liver==2]=1
imshow(img_p2[92:-92,92:-92],lbl_p_liver, pred2>0.5)`

  1. # Load step2 network net2 = caffe.Net(STEP2_DEPLOY_PROTOTXT, STEP2_MODEL_WEIGHTS, caffe.TEST)

and finally

  1. net2.blobs['data'].data[0,0,...] = img_p2 pred2 = net2.forward()['prob'][0,1] print (pred2.shape)

Please could you kindly proffer solutions to these issues?

Pretrained TensorFlow Models

Can you provide the pre-trained tensorflow model(including graph and ckpt) for us? Training from scratch really takes a lot of time and need gpus with big memory. Thank you very much!

A question about training sets and metrics

There are some irrelevant images (without liver region) in the CT volumes. Do I need to remove these images or send all of them to the network as a training set?
For metrics, I didn't get any prediction for small image with very small liver region. So some of the metrics cannot be calculated (Infinite). Do you get a predicted result for every single image, and compared with the ground-truth of foreground?

source code

Hello, could you provide your trainning code for us?Thanks very much.

Result is very worse followed by the ipynb file

Hi, I execute the cascaded_unet_inference.ipynb that doesn't report any questions, but the result is worse.
The result of step1 is shown as follow:
image

Any one know the reason?
Thank you very much

How testing and training is done

On which dataset training is done and also how testing is performed (name of both datasets would be fine)

Also could you pls highlight the evaluating function

Input image sizing

Hello!

If I understand right your input images size is increased from 388x388 to 572x572, the same dimensions as in the U-Net publication by Olaf Ronneberger, by extending all sides with mirrored copies of the image.

But since the background of the CT scans has intensities near zero anyway, wouldn't it be possible to use zero padding instead and remain at the original size? The network should then be able to use less memory and to return a label map of the same size as the input, so I wonder if you found a reason not to use the zero padding that I have been missing so far.

Question:The results for the code are error

    1、I downloaded the 3Dircadb database.
    2、I downloaded the Cascaded-FCN code from https://github.com/IBBM/Cascaded-FCN.
    3、I downloaded the step1_weights.caffemodel(https://www.dropbox.com/s/aoykiiuu669igxa/step1_weights.caffemodel?dl=1) and step2_weights.caffemodel(https://www.dropbox.com/s/ql10c37d7ura23l/step2_weights.caffemodel?dl=1).
   I run the cascaded_unet_inference.ipynb in the  Cascaded-FCN code. I find that the prediction is error, so I want to know why。The attachment is result of prediction.

3dircadb

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.