Batch Dimension squeeze
StinkyBenji opened this issue · comments
Hey Sergi, I was training some dataset using nicMSlesions, however, the following error occurred.
So I guess there is one batch shape for a subject is (1,2,11,11,11), and in base.py, test_scan, line 551: y_pred = model['net'].predict(np.squeeze(batch),options['batch_size'])
you used np.squeeze(batch), so the shape becomes (2, 11, 11, 11)?
So do you think I can simply modify the script by adding a condition after np.squeeze the batch or
sqz_batch = np.squeeze(batch)
if len(sqz_batch.shape) < 5:
sqz_batch = np.expand_dims(sqz_batch, axis = 0)
else....
Looking forward to your reply.
Thanks
Hi,
Looks like for this particular image, it exists only one lesion patch [1,2,11,11,11] so it's squeezed. What you suggest may work. Maybe you can delete the np.squeeze in line 551?
Let me know what it does.
s
Hey,
ystd I used the condition that I suggested in the base.py and ran the process for a small epoch on a small training set, there was no error occurring anymore. Bcs I wasn't sure what's ur initial intention for using np.squeeze(), thus I didn't want to simply delete it.. Anyway the modified script works just fine :)