Spent 3 hours debugging why my image classifier kept predicting the same label, and it was one stupid line
So I built this little model to sort photos of my garden into flowers vs vegetables, nothing fancy, just a small CNN I trained on about 400 pics I took on my phone. It kept spitting out "flower" for every single image, even a pic of a zucchini, which made zero sense to me. Turned out I forgot to shuffle the training data before splitting it, so all the flowers were in the first batch and the model just learned to guess the majority class. Fixed it with one line, model hit 89% accuracy in like 10 minutes. Has anyone else run into silent bugs like this that make you question your whole setup?
Oh sure, the model was just being extra confident about its flower phase. Classic case of garbage in, garbage out, except the garbage was your data order and the model just went along for the ride. I did the exact same thing with a cat vs dog set once and spent an hour convinced my architecture was broken. At least yours only wasted 3 hours, mine took a whole afternoon plus a walk around the block to cool off.