Texture Classification

Objective: Use the texture classifier to distinguish between sand, seed, and stone and then add an additional texture to the classification (your choice). The script uses a Local Binary Pattern (LBP) to create the features and a Support Vector Machine for training and testing.

Local Binary Pattern

A Local Binary Patterns (LBP) is a visual descriptor for classification in computer vision by analyzing the local pixels around a point. LBP is an effective feature for texture classification.

A threshold is set to create a zero or one for each location. The one and zero combinations create a binary pattern that is translated into a decimal. A rotation-invariant transform is performed to create 36 unique patterns.

Train and Test Classifier

Images of sand, seed, and stone are available in training (training-set) and test (test-set) folders from the GitHub archive.

The archive includes two source files step1_LBP.py and step2_SVM.py to analyze the images for the LBP and perform the classification with the SVM. Alternatively, run the exercise with one of the following Jupyter Notebooks.

Verify that the following confusion matrix results are obtained when running the scripts. Tip: The accuracy with Linear SVC may be improved; try the nonlinear SVC or other classifiers.

Select a new material such as fabric, grass, wood. Add this texture to add to the training and testing. Create a new folder with 5 new photos in the test-set and training-set folders. Re-run the programs to determine the new confusion matrix with the added texture. Comment on the accuracy with the new texture.

Another way to detect materials is through Convolutional Neural Networks (CNNs) that use Deep Learning to classify textures and materials. See Soil Classification


References

  • Ahonen, T., Hadid, A., Pietikäinen, M., Face recognition with local binary patterns. European conference on computer vision. Springer, Berlin, Heidelberg, 2004.
  • Ojala, T., Pietikäinen, M., Maenpaa, T., Multiresolution gray-scale and rotation invariant texture classification with local binary patterns. IEEE Transactions on pattern analysis and machine intelligence 24.7 (2002): 971-987.
  • Kylberg, G., Texture Dataset v. 1.0, Centre for Image Analysis, Swedish University of Agricultural Sciences and Uppsala University, External report (Blue series) No. 35. Dataset
  • Scikit Image, Local Binary Pattern for texture classification, Accessed Online: 2 Feb 2022. Source Code

Solutions


Thanks to DJ Lee, BYU ECE Professor, for the computer vision material and for sharing research and industrial experience with the class.

💬