Lumber pieces usually contain defects such as knots, which strongly affect the strength and stiffness. To develop a model for rapid, accurate grading of lumbers based on knots, Douglas fir, spruce-pine-fir (SPF), Chinese hemlock, and Dragon spruce were used. The experiments explored the effects of modelling methods and spectral preprocess methods for knot detection, and investigated the feasibility of using a model built within one species to discriminate the samples from other species, using a novel variable selection method-random frog (RF)- to select effective wavelengths. The results showed that least squares-support vector machines coupled with first derivative preprocessed spectra achieved best performance for both single and mixed models. Models built within Dragon spruce could be used to classify knot samples from SPF and Chinese hemlock but not Douglas fir, and vice versa. Eight effective wavelengths (1314 nm, 1358 nm, 1409 nm, 1340 nm, 1260 nm, 1586 nm, 1288 nm, and 1402 nm) were selected by RF to build effective wavelengths based models. The sensitivity, specificity, and accuracy in the validation set were 98.49%, 93.42%, and 96.30%, respectively. Good results could be obtained when using data at just eight wavelengths, as an alternative to evaluating the whole spectrum.