A better technique (of course not fool proof, but just better) would be to insert a pause, for about one-third of a second, after every inhale and every exhale.
This way, it is much more likely that we will stay with the breath and is much more easier to detect when we stray. Breathing is such a powerful automatic process that a pause would be possible only if we consciously insert it. The moment we lose consciousness, the pause vanishes! And, the teacher, if he / she is around, gets a chance to kick your ass! :)