Giter Site home page Giter Site logo

iamsuyogjadhav / 3d-mri-brain-tumor-segmentation-using-autoencoder-regularization Goto Github PK

View Code? Open in Web Editor NEW
365.0 365.0 114.0 78 KB

Keras implementation of the paper "3D MRI brain tumor segmentation using autoencoder regularization" by Myronenko A. (https://arxiv.org/abs/1810.11654).

License: MIT License

Python 35.81% Jupyter Notebook 64.19%
brats2018 cnn deep-learning keras medical-image-processing

3d-mri-brain-tumor-segmentation-using-autoencoder-regularization's Introduction

Hi there 👋

I am Suyog Jadhav, a master's student at UiT Norway.

  • 🔭 I’m currently researching on theoretical aspects of computer vision.
  • 🎓 I’m currently pursuing a master's in computer science.
  • 📖 I'm looking forward to learning the mathematics behind machine learning.
  • 💻 Apart from deep learning, I also take interest in speedcubing, graphic design, photography, 3D pen art and other creative endeavors.
  • 📫 Reach out to me @IAmSuyogJadhav on all major social platforms.
  • ✒️ I occasionally write blogs on suyogjadhav.com
  • ⚡ Fun fact: I once wrote a piece of code that worked without any errors right away.

Visitor Count!

Hits

3d-mri-brain-tumor-segmentation-using-autoencoder-regularization's People

Contributors

crispy13 avatar iamsuyogjadhav avatar shivamsaraf 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

3d-mri-brain-tumor-segmentation-using-autoencoder-regularization's Issues

TypeError

This is the error i get when i fit this model... i type casted the types to float of y_pred and y_true but still getting this error. How can i resolve it?

TypeError: in user code:

/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py:806 train_function  *
    return step_function(self, iterator)
/content/model.py:140 loss_gt_  *
    intersection = K.sum(K.abs(y_true * y_pred), axis=[-3,-2,-1])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py:1141 binary_op_wrapper
    raise e
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py:1125 binary_op_wrapper
    return func(x, y, name=name)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py:1457 _mul_dispatch
    return multiply(x, y, name=name)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/util/dispatch.py:201 wrapper
    return target(*args, **kwargs)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py:509 multiply
    return gen_math_ops.mul(x, y, name)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/gen_math_ops.py:6176 mul
    "Mul", x=x, y=y, name=name)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py:506 _apply_op_helper
    inferred_from[input_arg.type_attr]))

TypeError: Input 'y' of 'Mul' Op has type float32 that does not match type uint8 of argument 'x'.

Shouldn't the dice coefficient loss be negative?

The loss function in this code is:

def loss_(y_true, y_pred):
        y_true_f = K.flatten(y_true)
        y_pred_f = K.flatten(y_pred)
        intersection = K.sum(K.abs(y_true_f * y_pred_f), axis=-1)
        loss_dice = (2. * intersection) / (
            K.sum(K.square(y_true_f), -1) + K.sum(K.square(y_pred_f), -1) + e)

        return loss_dice + 0.1 * loss_L2 + 0.1 * loss_KL

But I think our target is to maximize the loss_dice part, isn't it?

Are we missing a minus here? It goes like:
return - loss_dice + 0.1 * loss_L2 + 0.1 * loss_KL

Thanks :-)

VAE branch is not trained.

When running model.summary(), i found VAE part layers were not included in the model.

Also, i fitted the model with 1 epoch and checked the weights using get_weights() method. The weights were not changed.

decoder blue boxes

Hi again
Checking your model implementation I realized that you decoder blue box outputs 32 channels and then you apply a final conv layer into the 3 output channels

I think that the blue box is the one that maps from 32 to 3 output channels since no extra layer is drawn in the paper.

The paper says:
"The end of the decoder has the same spatial size as the original image, and the number of features equal to the initial input feature size, followed by 1x1x1 convolution into 3 channels and a sigmoid function."

I think that "the end of the decoder" here means the output of the last green block and the 1x1x1 convolution that follows is the blue box

I have also found this implementation that agrees with my interpretation:
https://github.com/athon2/BraTS2018_NvNet/blob/master/nvnet.py

What do you think?

getting error while running in google co-lab

i am getting error while running
model = build_model(input_shape=input_shape, output_channels=3)
"module 'tensorflow._api.v2.config' has no attribute 'experimental_list_devices'"

please help me out.

invalid syntax

hi sir,
I have impressed your work. Its really excellent work.
I have tried this code in google colab. It gave an error shown below.
Thank you sir.

File "", line 16
assert H%16 && W%16 && D%16, "All the input dimensions must be divisible by 16"
^
SyntaxError: invalid syntax

Bilinear Upsampling

In the paper, the author specifies using bilinear interpolation to upsample the features in the decoder heads.
Going over your implementation, I saw you are using Kerase's UpSampling3D object to do that.
But it seems to me that what this object does is repeat elements, not perform interpolation.
Please, correct me if I'm wrong.

nan loss for down-sized model

I get loss=nan when I try to run a down-sized version of your model on single channel data with batch size=1 and input size=(1, 128,128,128)
Any suggestions?

help!!ValueError: Error when checking model target: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 2 array(s), but instead got the following list of 1 arrays?

Traceback (most recent call last):
File "Example_on_BRATS2018.py", line 109, in
model.fit(data, labels, batch_size=1, epochs=1)
File "/home/xxx/anaconda3/envs/tf108/lib/python3.6/site-packages/keras/engine/training.py", line 1630, in fit
batch_size=batch_size)
File "/home/xxx/anaconda3/envs/tf108/lib/python3.6/site-packages/keras/engine/training.py", line 1480, in _standardize_user_data
exception_prefix='target')
File "/home/xxx/anaconda3/envs/tf108/lib/python3.6/site-packages/keras/engine/training.py", line 86, in _standardize_input_data
str(len(data)) + ' arrays: ' + str(data)[:200] + '...')
ValueError: Error when checking model target: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 2 array(s), but instead got the following list of 1 arrays: [array([[[[[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
...,
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],

How to make this code suitable for single modal input data(e.g. t1ce)?

I made the following changes for your example.
input_shape = (1, 80, 96, 64)
data[i] = np.array([preprocess(read_img(imgs['t1ce']), input_shape[1:])], dtype=np.float32)
and commented

assert (c % 4) == 0, "The no. of channels must be divisible by 4

in model.py.

But I got the following error.

Epoch 1/1
[1] 9624 floating point exception (core dumped) python test.py

Can you give me some hints to modify your code and give me an explanation for why assert (c % 4) == 0?

some strange samples in brats2018 validation dataset

Hi! I tested brats2018 validation dataset using my own U-Net models. But I found some very strange samples that the dice score of those is always 0 or 1. I want to ask what features of samples would cause this phenomenon.

Prediction

Hi,
I will appreciate, if it is possible, to add a sample code for 1 image prediction (segmentation)
Thank you,
shira

about group norm size

Hi
I am also implementing this algorithm and I want to check something with you...

I see that in your implementation you set the number of groups to 8:
But in the paper myronenko says literally:
"GN stands for group normalization (with group size of 8)"

so this can also understood that each group has 8 channels and therefore
num_groups = inChans/8

What do you think?

__init__() takes from 2 to 5 positional arguments but 6 were given

pat = re.compile('._(\w).nii.gz')

data_paths = [{
pat.findall(item)[0]:item
for item in items
}
for items in list(zip(t1, t2, t1ce, flair, seg))]

TypeError Traceback (most recent call last)
in ()
5 for item in items
6 }
----> 7 for items in list(zip(t1, t2, t1ce, flair, seg))]

TypeError: init() takes from 2 to 5 positional arguments but 6 were given

How we solve this?

Could you please share system CPU and GPU requirements?

Sir

I tried to run it on 8GB GPU(Active 7 GB) V100D, with 64 GB RAM,
But i got unknow error: during model.fit
Loading Convolution Algorithm is failed due to memory constraints even in the case of batch_size=1.

kindly suggest me in this regard

UnknownError Traceback (most recent call last)
in
----> 1 model.fit(data, [labels, data], batch_size=1, epochs=1)

~.conda\envs\Gandhiji\lib\site-packages\keras\engine\training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
1176 steps_per_epoch=steps_per_epoch,
1177 validation_steps=validation_steps,
-> 1178 validation_freq=validation_freq)
1179
1180 def evaluate(self,

~.conda\envs\Gandhiji\lib\site-packages\keras\engine\training_arrays.py in fit_loop(model, fit_function, fit_inputs, out_labels, batch_size, epochs, verbose, callbacks, val_function, val_inputs, shuffle, callback_metrics, initial_epoch, steps_per_epoch, validation_steps, validation_freq)
202 ins_batch[i] = ins_batch[i].toarray()
203
--> 204 outs = fit_function(ins_batch)
205 outs = to_list(outs)
206 for l, o in zip(out_labels, outs):

~.conda\envs\Gandhiji\lib\site-packages\keras\backend\tensorflow_backend.py in call(self, inputs)
2977 return self._legacy_call(inputs)
2978
-> 2979 return self._call(inputs)
2980 else:
2981 if py_any(is_tensor(x) for x in inputs):

~.conda\envs\Gandhiji\lib\site-packages\keras\backend\tensorflow_backend.py in _call(self, inputs)
2935 fetched = self._callable_fn(*array_vals, run_metadata=self.run_metadata)
2936 else:
-> 2937 fetched = self._callable_fn(*array_vals)
2938 return fetched[:len(self.outputs)]
2939

~.conda\envs\Gandhiji\lib\site-packages\tensorflow\python\client\session.py in call(self, *args, **kwargs)
1456 ret = tf_session.TF_SessionRunCallable(self._session._session,
1457 self._handle, args,
-> 1458 run_metadata_ptr)
1459 if run_metadata:
1460 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

UnknownError: 2 root error(s) found.
(0) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[{{node Input_x1/convolution}}]]
[[loss/Dec_VAE_Output_loss/Mean_3/_2353]]
(1) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[{{node Input_x1/convolution}}]]
0 successful operations.
0 derived errors ignored.

reparameterization trick implementation

It's unclear to me how the authors of the paper went from the 256 features before the random sampling to the parameters of the embedded distribution.
I saw you used additional two layer to compute 128 features each for use as parameters of the random distribution.
Since what I would have figured from the paper is that the authors may have split the 256 features to two sets of 128 and used them as distribution parameters.
This may be inconsequential, but from my personal experience deep architectures that have over 8 non-skippable layers are very difficult to optimize. I generally try to limit my nets to about 5 non-skippable layers. I'm mentioning this because these two additional linear layers bump you up from 8 to 9 non-skippable layers after the embedded space features of the encoder.
Please, let me know if you think I'm mistaken.

Model.fit

Hello does anyone know why in model.fit instead of labels , [labels,data] has been used?
model.fit(data, [labels,data], batch_size=1, epochs=50)

How to predict with the model?

I've recently followed the every step in Example_on_BRATS2018.ipynb and built the model. I'm curious about how to get the prediction with the model. Could somebody tell me how to predict data with the model? plz
I'm new in brain tumor segmentation.

Ground truth output loss and dice loss go to zero

I would appreciate some feedback on my training curves. Looks like over-fitting which I thought the VAE would address. L2 and KL are set to 0.1 for the VAE in the loss function. The 'Dec_GT_Output_loss' and 'Dec_GT_Output_dice_coefficient' flat line at zero after ~100 epochs. The VAE portion seems to eventually improve.

After 50 epochs:
image

Here's an example ground truth:

image

And the corresponding prediction. Not very good.

image

After 100 epochs:

image

image

After 150 epochs:

image

image

Thanks,
Jay

Two things to mention

Hi. I'm using this source code to build a model for my project.

I found several things which are different from the paper or need to be fixed.

  1. VAE branch is not trained.

    • When creating model using keras.models.Model, the output argument has not the VAE branch output.
  2. Dropout was used instead of spatial dropout.

We also use the spatial dropout with a rate of 0.2 after the initial encoder convolution.

  1. When evaluating the model, dice score varys batch by batch.
    Current dice score is not the mean of the scores(e.g. (sample 1 + sample 2) / 2, ) but the function calculates the score like the samples of a batch are one sample.

L2 Loss function might not be calculating the loss correctly.

I couldn't find out anything on the internet to calculate the MSE loss between input and the VAE output. I think this might actually be correct, but I am doubtful.
Do you have a better solution?

The current code:

loss_L2 = K.mean(K.square(inp - out_VAE), axis=(1, 2, 3, 4))

InvalidArgumentError on build_model

I am running the example notebook locally. In the "build model" step, I get the following error:

InvalidArgumentError: Duplicate node name in graph: 'Dec_VAE_VDraw_Sampling/random_normal/shape'

Do you know what is causing it and how to fix it?

dice score zero

I have splited data set into train and test but still getting accuracy zero ,dice score zero and can't perform confusion matrix too.
Can anybody help me please

import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
xTrain,xTest,yTrain,yTest=train_test_split(data,labels,test_size = 0.25,random_state=10)
(this is code that i have splitted)

model.fit(xTrain,yTrain, batch_size=1, epochs=5)

Epoch 1/5
3/3 [==============================] - 25s 8s/step - loss: 0.2007 - dice_coefficient: 0.0000e+00
Epoch 2/5
3/3 [==============================] - 4s 1s/step - loss: 0.1996 - dice_coefficient: 0.0000e+00
Epoch 3/5
3/3 [==============================] - 4s 1s/step - loss: 0.1960 - dice_coefficient: 0.0000e+00
Epoch 4/5
3/3 [==============================] - 4s 1s/step - loss: 0.2002 - dice_coefficient: 0.0000e+00
Epoch 5/5
3/3 [==============================] - 4s 1s/step - loss: 0.1948 - dice_coefficient: 0.0000e+00

<keras.callbacks.History at 0x7f68441bbbe0>

Ran for 200 epochs batch size 32 on brats18

I noticed that I couldn't get the collab to work due to a tensorflow error however I tried to run it locally and was able to modify the notebook to run it as a python script.

I initially ran with default setting and this was my output:
https://gist.github.com/CraigMyles/12800936b55830d92aaf6a4b7bbb913e

I then ran with 200 epochs and batch size 32. and I got the following results:
https://gist.github.com/CraigMyles/f69392cba910accacbd45fc378a4474f

Epoch 200/200
4/4 [==============================] - 51s 13s/step - loss: 0.0225 - Dec_GT_Output_loss: 0.0000e+00 - Dec_VAE_Output_loss: 0.0225 - Dec_GT_Output_dice_coefficient: 0.0000e+00 - Dec_VAE_Output_dice_coefficient: 0.8982

I just have a few questions regarding the model and how it works, I noticed that with other segmentation models, once you have trained it, you have a weighted model which can be used against a testing set however I don't see this to be the case here?

Also I was wondering if possible how I would be able to get results in the form of jpg or png images that I would be able to turn into a gif.

Any advice or explanation would be great

Is the output of this model not the three sub-regions of the tumor(i.e. whole tumor, enhance tumor and tumor core)?

In function "preprocess_label", you converts the label into three channels, representing "ncr", "ed" and "et". However, the paper mentions that "We also output all 3 nested tumor subregions directly after the sigmoid (instead of using several networks or the softmax over the number of classes). "

By the way, can you tell me the final value of the loss after the model converges? In my experiments, the loss is approaching -0.20 and the dice score is 0.4443 after 300 epochs (the patch size set to 32, 192, 160).

data augmentation

Hello
In your code the data augmentation techniques haven't implemented and I have no idea about why tf.keras.preprocessing.image.ImageDataGenerator doesn't work for me. can add this part too?
Thanks

Error during Fitting the model.

I am trying this model on brats 2019 dataset. Everything was okay but during fitting the model it is giving the following error. Can someone help me..
Here is the error

ValueError: Error when checking model target: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 2 array(s), but instead got the following list of 1 arrays: [array([[[[[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
...,
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
...

tf.keras compatibility

Hi, I am trying to run the code using tf2 Keras. However, I receive the following error which is related to the loss_VAE function:

_SymbolicException: Inputs to eager execution function cannot be Keras symbolic tensors, but found [<tf.Tensor 'Dec_VAE_VDraw_Var/Identity:0' shape=(None, 128) dtype=float32>, <tf.Tensor 'Dec_VAE_VDraw_Mean/Identity:0' shape=(None, 128) dtype=float32>]`

I know its not a bug, but I will appreciate any suggestion to solve it.

Please find the complete NOTEBOOK here.

How to load the trained model?

Hi,
I have trained a model with your code,but when loading the model,

from model import loss_
from model import dice_coefficient
...
....
model = load_model(model_name,custom_objects={'loss_':loss_,'dice_coefficient':dice_coefficient})

I got a error :'ImportError: cannot import name 'loss_''.

I found that I can't import the nested function loss_ defined in loss.
Ask for help!Thanks a lot!

score

I am trying to reproduce the nice result in the paper with this code. What is the best dice score (on validation dataset or testing dataset) achieved by the current code? Is it close to the ones given by the paper?

model.fit ValueError Upgrading to tensorflow 2 (tf.keras)

First, thanks for everyone's contributions to this project.

I'm trying to upgrade from tf 1.15 using keras to tensorflow 2, i.e., tf.keras...

On the call to model.fit(), I get a value error (shown below).
#Train the model
import tensorflow as tf
model.fit(data, [labels, data], batch_size=1, epochs=1, verbose=1)

Input and target data:
data is dtype('float32')
label is dtype('uint8')

Ultimately, the code is failing on a numpy multiply operation:
TypeError: Input 'y' of 'Mul' Op has type float32 that does not match type uint8 of argument 'x'.

I've tried changing the np label array to tf.float32, casting the labels to tf.float32. I've also tried simpler loss functions.

Any direction would be appreciated. Thanks, Jay.

model.fit() output:
Train on 4 samples
1/4 [======>.......................] - ETA: 3s

ValueError Traceback (most recent call last)
~/anaconda3/envs/tf2/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py in _apply_op_helper(op_type_name, name, **keywords)
469 as_ref=input_arg.is_ref,
--> 470 preferred_dtype=default_dtype)
471 except TypeError as err:

~/anaconda3/envs/tf2/lib/python3.7/site-packages/tensorflow/python/framework/ops.py in convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, dtype_hint, ctx, accepted_result_types)
1316 "Tensor conversion requested dtype %s for Tensor with dtype %s: %r" %
-> 1317 (dtype.name, value.dtype.name, value))
1318 return value

ValueError: Tensor conversion requested dtype uint8 for Tensor with dtype float32: <tf.Tensor 'model/Dec_GT_Output/Sigmoid:0' shape=(1, 3, 80, 96, 64) dtype=float32>

During handling of the above exception, another exception occurred:

TypeError Traceback (most recent call last)
in
2 # .astype("float32").values
3
----> 4 model.fit(data, [labels, data], batch_size=1, epochs=1, verbose=1)

...

~/anaconda3/envs/tf2/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py in _apply_op_helper(op_type_name, name, **keywords)
504 "%s type %s of argument '%s'." %
505 (prefix, dtypes.as_dtype(attrs[input_arg.type_attr]).name,
--> 506 inferred_from[input_arg.type_attr]))
507
508 types = [values.dtype]

TypeError: Input 'y' of 'Mul' Op has type float32 that does not match type uint8 of argument 'x'.

could anyone please help regarding this error?

I have executed the given example on google colab. I changed the working directory into the working directory. using the following code:

import os
os.chdir("/content/drive/My Drive/Colab Notebooks/3d-mri-brain-tumor-segmentation-using-autoencoder-regularization-master")
that working directory having the following files:
Brats_2018 model.py pycache testing.ipynb
group_norm.py NVDLMED_Implementation.ipynb README.md

when extract the datadet from below code
import zipfile # For faster extraction
dataset_path = "/Brats_2018/MICCAI_BraTS_2018_Data_Training.zip"
zfile = zipfile.ZipFile(dataset_path)
zfile.extractall()

error here is
FileNotFoundError Traceback (most recent call last)
in ()
1 import zipfile # For faster extraction
2 dataset_path = "/Brats_2018/MICCAI_BraTS_2018_Data_Training.zip"
----> 3 zfile = zipfile.ZipFile(dataset_path)
4 zfile.extractall()

/usr/lib/python3.6/zipfile.py in init(self, file, mode, compression, allowZip64)
1111 while True:
1112 try:
-> 1113 self.fp = io.open(file, filemode)
1114 except OSError:
1115 if filemode in modeDict:

FileNotFoundError: [Errno 2] No such file or directory: '/Brats_2018/MICCAI_BraTS_2018_Data_Training.zip'

how to give datapath?
please help me
thanking you.

About Input size

Hello. I'm a noob in this part and try to this code on our dataset.
According to the article of nvdlmed, the input size is 4 x 160 x 192 x 128.

But the code is:
image

Also after load nii a image using the read_img function the loaded numpy array's shape is (155, 240, 240).

I can understand how can 240 x 240 -> 192 x 128 converting happen(maybe crop), but can't understand how does the slice number increase(155 -> 160).

They are very confusing to me. Am i missing something about input size?

right input_shape ?

good morning
my input_shape=(1,240,240,155) (BRATS2018 (240240155) i got the following error : ValueError: Operands could not be broadcast together with shapes (128, 60, 60, 40) (128, 60, 60, 39)
(whats is the right input_shape ) ?
Thank you

Decoder loss and dice coefficient is 0 even after i trained it for 90 epochs?

Epoch 90/90
1/2 [==============>...............] - ETA: 15s - loss: 0.0271 - Dec_GT_Output_loss: 0.0000e+00 - Dec_VAE_Output_loss: 0.0271 - Dec_GT_Output_d2/2 [==============================] - 30s 15s/step - loss: 0.0282 - Dec_GT_Output_loss: 0.0000e+00 - Dec_VAE_Output_loss: 0.0282 - Dec_GT_Output_dice_coefficient: 0.0000e+00 - Dec_VAE_Output_dice_coefficient: 0.8795
I trained for epoch 90, but the decoder loss and dice coefficient remained 0

I think that the current code for processing labels should be fixed.

According to "https://www.med.upenn.edu/sbia/brats2018/tasks.html":

The TC describes the bulk of the tumor, which is what is typically resected. The TC entails the ET, as well as the necrotic (fluid-filled) and the non-enhancing (solid) parts of the tumor. The appearance of the necrotic (NCR) and the non-enhancing (NET) tumor core is typically hypo-intense in T1-Gd when compared to T1. The WT describes the complete extent of the disease, as it entails the TC and the peritumoral edema (ED), which is typically depicted by hyper-intense signal in FLAIR.

So i think that the current code for processing labels should be fixed. For example, tumor core label should consist of both 1 and 4.

Data_loading

The code is easy to read, you are really great! And I want to ask a question about the data loading, is all the data ready before training, I mean, do we need to load all the data into memory? Due to my pc have 48G memory but it doesn't contain all the data after pre-processing before training.

ZeroDivisionError: division by zero

Thank you so much, sir, for the repository. Sir, I am applying the code on BraTS'19 data set. I have the access for the data set. All thing went well but at the cell number 10 i got an error: `ZeroDivisionError Traceback (most recent call last)
in ()
3 # Parameters for the progress bar
4 total = len(data_paths[:4])
----> 5 step = 25 / total
6
7 for i, imgs in enumerate(data_paths[:4]):

ZeroDivisionError: division by zero`

Any help in this regard would be very appreciated. Thanks!

Zero Dice Coefficient

Iam trying this approach on 2019 brats dataset with same model. The VAE dice coefficient (reconstructed image ) is around 0.90 but the dice coefficient for the segmentation label is 0.0000e+00.

Here is the model.fit method and output. Output is same for even 10 to 30 epochs.

model.fit(data, [labels, data],validation_split=0.1, batch_size=1,epochs=1,verbose=1,callbacks=[es,mc])

Train on 301 samples, validate on 34 samples
Epoch 1/1
301/301 [==============================] - 6902s 23s/step - loss: 0.0413 - Dec_GT_Output_loss: -0.0065 - Dec_VAE_Output_loss: 0.0478 - Dec_GT_Output_dice_coefficient: 0.0065 - Dec_VAE_Output_dice_coefficient: 0.7997 - val_loss: 0.0229 - val_Dec_GT_Output_loss: 0.0000e+00 - val_Dec_VAE_Output_loss: 0.0229 - val_Dec_GT_Output_dice_coefficient: 0.0000e+00 - val_Dec_VAE_Output_dice_coefficient: 0.9005

Can some one help me..?

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.