Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
204 views
in Technique[技术] by (71.8m points)

python - Tensorflow for image segmentation: Changing minibatch size stops learning

I have created a net for image segmentation, in particular brain tumors. The jupyter notebook with the code is here.

When I train the CNN with minibatch size of 1, I get a fairly good result: enter image description here

But when I change the size to something larger ( 2 or more) the results are terrible: enter image description here

Tensorboard shows the diference in the loss. Clearly the the net with batchsize 2 is not minimizing the loss (blue) enter image description here

Any ideas on why this could be the case?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I found the problem. I checked my graph with tensorboard and I notice that in the CONV1/S1 I was not connecting the output of the ReLu to the next layer (CONV1/S2), instead I was connecting the output of the conv2d directly.

enter image description here

I changed that line in the code and everything is working as expected.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...