Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect predictions #65

Closed
sasinghi opened this issue Aug 28, 2018 · 8 comments
Closed

Incorrect predictions #65

sasinghi opened this issue Aug 28, 2018 · 8 comments

Comments

@sasinghi
Copy link

After training the model (for a short time) I see an accuracy of 80%. However, when I test it, the result is as shown for all test images. Can someone help with this? Would be great if someone could share the pre-trained weights.

image

@ajithvcoder
Copy link

ajithvcoder commented Aug 28, 2018

model.fit_generator(myGene,steps_per_epoch=2000,epochs=5,callbacks=[model_checkpoint])

in above line change the steps_per_epoch to 300 or 400 or 500 some thing should work

@enggrey
Copy link

enggrey commented Sep 3, 2018

In case you or anyone else is still having issues with this, in the testGenerator function change this line
img = img / 255
for this
img = img / 255.

@sasinghi
Copy link
Author

sasinghi commented Sep 4, 2018

@ajithvallabai that was it. Training longer helped.
Thanks!

@duanmuji
Copy link

duanmuji commented Oct 8, 2018

I modified img.255, but problems persisted.

@openXG
Copy link

openXG commented Oct 23, 2018

model.fit_generator(myGene,steps_per_epoch=2000,epochs=5,callbacks=[model_checkpoint])

in above line change the steps_per_epoch to 300 or 400 or 500 some thing should work

I set steps_per_epoch=500, but my test images are still all gray...
should I set it more larger than 500? by the way, I just use CPU.

@JianyingLi
Copy link

JianyingLi commented Dec 3, 2018

model.fit_generator(myGene,steps_per_epoch=2000,epochs=5,callbacks=[model_checkpoint])
in above line change the steps_per_epoch to 300 or 400 or 500 some thing should work

I set steps_per_epoch=500, but my test images are still all gray...
should I set it more larger than 500? by the way, I just use CPU.

i think epochs should be increased rather than steps_per_epoch to improve the acc . Another place to check is the function of adjustData.
def adjustData(img,mask,flag_multi_class,num_class):
# here#
elif(np.max(img) > 1):
img = img / 255
mask = mask /255
mask[mask > 0.5] = 1
mask[mask <= 0.5] = 0
return (img,mask)
This code works for py3, if you use py2, modify '255' to '255.'; Last, you need to check the threshold '0.5' in order to make sure the returned mask is a binary(0/1) mask.

@lihao6666
Copy link

get it

@jizhang02
Copy link

jizhang02 commented Mar 5, 2019

@JianyingLi Hello,
I change cross entropy loss into dice, but the result become all white, could you help me?
def dice_coef(y_true, y_pred):
smooth = 1
y_true_f = K.flatten(y_true)
y_pred_f = K.flatten(y_pred)
intersection = K.sum(y_true_f * y_pred_f)
return (2. * intersection +smooth) / (K.sum(y_true_f) + K.sum(y_pred_f) +smooth)

def dice_coef_loss(y_true, y_pred):
print("dice loss")
return 1-dice_coef(y_true, y_pred)

model.compile(optimizer = Adam(lr = 1e-5), loss = dice_coef_loss, metrics = ['accuracy'])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants