Onset of shear band localization by a local generalized eigenvalue analysis