3d-mri-brain-tumor-segmentation-using-autoencoder-regularization icon indicating copy to clipboard operation
3d-mri-brain-tumor-segmentation-using-autoencoder-regularization copied to clipboard

dice score zero

Open bhagi369 opened this issue 5 years ago • 21 comments

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>

bhagi369 avatar Feb 19 '20 10:02 bhagi369

Please help me.I am doing my project for final year and my last review on march 2.

bhagi369 avatar Feb 19 '20 10:02 bhagi369

my dice score is 0.35-0.37

ShixianLibai avatar Feb 19 '20 22:02 ShixianLibai

my dice score is 0.35-0.37

how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning

bhagi369 avatar Feb 20 '20 06:02 bhagi369

my dice score is 0.35-0.37

how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question

ShixianLibai avatar Feb 20 '20 17:02 ShixianLibai

my dice score is 0.35-0.37

how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question

would you mind to help me ?

bhagi369 avatar Feb 20 '20 19:02 bhagi369

my dice score is 0.35-0.37

how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question

would you mind to help me ?

Never mind. we can help each other. I also have some issues

ShixianLibai avatar Feb 20 '20 20:02 ShixianLibai

my dice score is 0.35-0.37

how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question

How many images and epoch you have used?

sneh-debug avatar Feb 25 '20 06:02 sneh-debug

my dice score is 0.35-0.37

Can you please help me out in getting the improvement in score, Even I am getting a score of 0 and if I am increasing epochs, its getting even worse. But VAE's coefficient is around 90+ but GT's coefficient is 0. Trying from many days but unable to crack this. Please help me.

vijayannepu avatar Feb 25 '20 07:02 vijayannepu

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>

Does your issue got resolved? If so please help me in moving forward from that Zero dice's coefficient.Even I am doing it as my final year project.

vijayannepu avatar Feb 25 '20 07:02 vijayannepu

It seems that the Dice loss have been wrongly implemented. It has been defined as -dice instead of 1-dice, therefore, it will try to minimize the Dice coefficient, when it should be doing the opposite. By using the implemented loss function it makes sense that Dice is decreasing the longer you train.

More specifically, you should change line 143 of model.py, from: return - K.mean(2 * intersection / dn, axis=[0,1]) to return 1 - K.mean(2 * intersection / dn, axis=[0,1])

I am not sure if there are more mistakes in this implementation.

jmlipman avatar Feb 25 '20 13:02 jmlipman

1-dice_coefficient or -dice_coeffficient makes no difference for convergence 1-dice_coef just more familiar for monitoring as its value belong to [0, 1], not [-1, 0]

On Tue, Feb 25, 2020 at 7:15 PM Juan-Miguel Valverde < [email protected]> wrote:

It seems that the Dice loss have been wrong implemented. It has been defined as -dice instead of 1-dice, therefore, it will try to minimize the Dice coefficient, when it should be doing the opposite. By using the implemented loss function it makes sense that Dice is decreasing the longer you train.

More specifically, you should change line 143 of model.py, from: return - K.mean(2 * intersection / dn, axis=[0,1]) to return 1 - K.mean(2 * intersection / dn, axis=[0,1])

I am not sure if there are more mistakes in this implementation.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/IAmSuyogJadhav/3d-mri-brain-tumor-segmentation-using-autoencoder-regularization/issues/38?email_source=notifications&email_token=AN2N6VRCU45EXTOADWEY24DREUOJDA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM4ANIY#issuecomment-590874275, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN2N6VQKIQI6WJKXEALEQJLREUOJDANCNFSM4KXWD6GA .

sneh-debug avatar Feb 26 '20 12:02 sneh-debug

I have try from 5-200 epoch even though dice score range from 0.00-0.2 not more than that

On Tue, 25 Feb 2020, 12:29 sneh-debug, [email protected] wrote:

my dice score is 0.35-0.37

how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question

How many images and epoch you have used?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/IAmSuyogJadhav/3d-mri-brain-tumor-segmentation-using-autoencoder-regularization/issues/38?email_source=notifications&email_token=AOLQVR2Q7VYSJKPAO7DU4FDRES6TVA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM2ZMTA#issuecomment-590714444, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOLQVR4E6HEPEW2274K5RVLRES6TVANCNFSM4KXWD6GA .

bhagi369 avatar Feb 26 '20 13:02 bhagi369

1-dice_coefficient or -dice_coeffficient makes no difference for convergence 1-dice_coef just more familiar for monitoring as its value belong to [0, 1], not [-1, 0]

True, although it is a bit unappealing to see a loss function that goes negative.

At the end I am going to try to implement this in Pytorch from scratch. I have seen that this implementation does not follow 100% the paper. Also, unfortunately, the original paper does not describe every single detail so one has to guess :(

jmlipman avatar Feb 26 '20 19:02 jmlipman

I have try from 5-200 epoch even though dice score range from 0.00-0.2 not more than that On Tue, 25 Feb 2020, 12:29 sneh-debug, @.***> wrote: my dice score is 0.35-0.37 how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question How many images and epoch you have used? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#38?email_source=notifications&email_token=AOLQVR2Q7VYSJKPAO7DU4FDRES6TVA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM2ZMTA#issuecomment-590714444>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOLQVR4E6HEPEW2274K5RVLRES6TVANCNFSM4KXWD6GA .

I have try from 5-200 epoch even though dice score range from 0.00-0.2 not more than that On Tue, 25 Feb 2020, 12:29 sneh-debug, @.***> wrote: my dice score is 0.35-0.37 how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question How many images and epoch you have used? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#38?email_source=notifications&email_token=AOLQVR2Q7VYSJKPAO7DU4FDRES6TVA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM2ZMTA#issuecomment-590714444>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOLQVR4E6HEPEW2274K5RVLRES6TVANCNFSM4KXWD6GA .

for how many samples?

sneh-debug avatar Feb 27 '20 06:02 sneh-debug

I have try from 5-200 epoch even though dice score range from 0.00-0.2 not more than that On Tue, 25 Feb 2020, 12:29 sneh-debug, @.***> wrote: my dice score is 0.35-0.37 how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question How many images and epoch you have used? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#38?email_source=notifications&email_token=AOLQVR2Q7VYSJKPAO7DU4FDRES6TVA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM2ZMTA#issuecomment-590714444>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOLQVR4E6HEPEW2274K5RVLRES6TVANCNFSM4KXWD6GA .

I have try from 5-200 epoch even though dice score range from 0.00-0.2 not more than that On Tue, 25 Feb 2020, 12:29 sneh-debug, @.***> wrote: my dice score is 0.35-0.37 how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question How many images and epoch you have used? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#38?email_source=notifications&email_token=AOLQVR2Q7VYSJKPAO7DU4FDRES6TVA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM2ZMTA#issuecomment-590714444>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOLQVR4E6HEPEW2274K5RVLRES6TVANCNFSM4KXWD6GA .

for how many samples?

100-200 sample i have taken and have try in range of 100-250 epochs but no use.

bhagi369 avatar Feb 28 '20 15:02 bhagi369

ok.. maybe there is something missing in the code. I am also working on it!

On Fri, Feb 28, 2020 at 8:56 PM bhagi369 [email protected] wrote:

I have try from 5-200 epoch even though dice score range from 0.00-0.2 not more than that … <#m_971442069090238746_> On Tue, 25 Feb 2020, 12:29 sneh-debug, @.***> wrote: my dice score is 0.35-0.37 how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question How many images and epoch you have used? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#38 https://github.com/IAmSuyogJadhav/3d-mri-brain-tumor-segmentation-using-autoencoder-regularization/issues/38?email_source=notifications&email_token=AOLQVR2Q7VYSJKPAO7DU4FDRES6TVA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM2ZMTA#issuecomment-590714444>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOLQVR4E6HEPEW2274K5RVLRES6TVANCNFSM4KXWD6GA .

I have try from 5-200 epoch even though dice score range from 0.00-0.2 not more than that … <#m_971442069090238746_> On Tue, 25 Feb 2020, 12:29 sneh-debug, @.***> wrote: my dice score is 0.35-0.37 how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question How many images and epoch you have used? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#38 https://github.com/IAmSuyogJadhav/3d-mri-brain-tumor-segmentation-using-autoencoder-regularization/issues/38?email_source=notifications&email_token=AOLQVR2Q7VYSJKPAO7DU4FDRES6TVA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM2ZMTA#issuecomment-590714444>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOLQVR4E6HEPEW2274K5RVLRES6TVANCNFSM4KXWD6GA .

for how many samples?

100-200 sample i have taken and have try in range of 100-250 epochs but no use.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/IAmSuyogJadhav/3d-mri-brain-tumor-segmentation-using-autoencoder-regularization/issues/38?email_source=notifications&email_token=AN2N6VXBBRBHJHXWLGTPIQ3RFEULPA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENI4SJA#issuecomment-592562468, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN2N6VRVAZF2JZ62VC6EKVLRFEULPANCNFSM4KXWD6GA .

sneh-debug avatar Feb 29 '20 10:02 sneh-debug

ok.. maybe there is something missing in the code. I am also working on it! On Fri, Feb 28, 2020 at 8:56 PM bhagi369 @.> wrote: I have try from 5-200 epoch even though dice score range from 0.00-0.2 not more than that … <#m_971442069090238746_> On Tue, 25 Feb 2020, 12:29 sneh-debug, @.> wrote: my dice score is 0.35-0.37 how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question How many images and epoch you have used? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#38 <#38>?email_source=notifications&email_token=AOLQVR2Q7VYSJKPAO7DU4FDRES6TVA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM2ZMTA#issuecomment-590714444>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOLQVR4E6HEPEW2274K5RVLRES6TVANCNFSM4KXWD6GA . I have try from 5-200 epoch even though dice score range from 0.00-0.2 not more than that … <#m_971442069090238746_> On Tue, 25 Feb 2020, 12:29 sneh-debug, @.***> wrote: my dice score is 0.35-0.37 how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question How many images and epoch you have used? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#38 <#38>?email_source=notifications&email_token=AOLQVR2Q7VYSJKPAO7DU4FDRES6TVA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM2ZMTA#issuecomment-590714444>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOLQVR4E6HEPEW2274K5RVLRES6TVANCNFSM4KXWD6GA . for how many samples? 100-200 sample i have taken and have try in range of 100-250 epochs but no use. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#38?email_source=notifications&email_token=AN2N6VXBBRBHJHXWLGTPIQ3RFEULPA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENI4SJA#issuecomment-592562468>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN2N6VRVAZF2JZ62VC6EKVLRFEULPANCNFSM4KXWD6GA .

but i have change nothing except splitting data into training and testing

bhagi369 avatar Feb 29 '20 12:02 bhagi369

ok.. maybe there is something missing in the code. I am also working on it! On Fri, Feb 28, 2020 at 8:56 PM bhagi369 @.**> wrote: I have try from 5-200 epoch even though dice score range from 0.00-0.2 not more than that … <#m_971442069090238746> On Tue, 25 Feb 2020, 12:29 sneh-debug, @.> wrote: my dice score is 0.35-0.37 how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question How many images and epoch you have used? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#38 <#38>?email_source=notifications&email_token=AOLQVR2Q7VYSJKPAO7DU4FDRES6TVA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM2ZMTA#issuecomment-590714444>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOLQVR4E6HEPEW2274K5RVLRES6TVANCNFSM4KXWD6GA . I have try from 5-200 epoch even though dice score range from 0.00-0.2 not more than that … <#m_971442069090238746> On Tue, 25 Feb 2020, 12:29 sneh-debug, @.*> wrote: my dice score is 0.35-0.37 how did you do that ? can you help me on finding predicted value for it because I am very new to deep learning we can talk aobout this question How many images and epoch you have used? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#38 <#38>?email_source=notifications&email_token=AOLQVR2Q7VYSJKPAO7DU4FDRES6TVA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM2ZMTA#issuecomment-590714444>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOLQVR4E6HEPEW2274K5RVLRES6TVANCNFSM4KXWD6GA . for how many samples? 100-200 sample i have taken and have try in range of 100-250 epochs but no use. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#38?email_source=notifications&email_token=AN2N6VXBBRBHJHXWLGTPIQ3RFEULPA5CNFSM4KXWD6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENI4SJA#issuecomment-592562468>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN2N6VRVAZF2JZ62VC6EKVLRFEULPANCNFSM4KXWD6GA .

but i have change nothing except splitting data into training and testing

@bhagi369 try for bigger patch size

sneh-debug avatar Mar 04 '20 04:03 sneh-debug

@bhagi369 have you tried bigger patch size?

sneh-debug avatar Mar 19 '20 07:03 sneh-debug

does anyone solve this problem?

beijing1214 avatar Apr 27 '20 09:04 beijing1214

Has anyone tried this (https://github.com/IAmSuyogJadhav/3d-mri-brain-tumor-segmentation-using-autoencoder-regularization/issues/4#issuecomment-618719803)? It was posted only recently. Any suggestions, @srivathsapv ?

IAmSuyogJadhav avatar Apr 29 '20 23:04 IAmSuyogJadhav