FLEX-LBP: Learning Local Binary Patterns with Exact Binary Inference for Texture Classification

Mohamed Alimoussa, Amal El KaidarXiv 2026 · arXiv

TL;DR

FLEX-LBP is a novel texture descriptor that brings the power of backpropagation to the classic Local Binary Pattern (LBP) framework. By using a straight-through estimator, it learns optimal sampling geometries and color transforms from data while remaining a lightweight, interpretable, "hard-binary" operator at inference time.

What Problem Does This Paper Address?

Local Binary Patterns (LBP) have been a workhorse in computer vision for decades, particularly in fields like industrial inspection and medical imaging where data is scarce and interpretability is paramount. However, LBP has a major "tuning" problem: its performance depends heavily on manually chosen parameters like the sampling radius, the number of neighbors, and the color space.

While deep convolutional neural networks (CNNs) can learn features automatically, they often require massive amounts of data, act as "black boxes," and carry a heavy computational burden. The authors of FLEX-LBP sought a middle ground: a descriptor that learns its own configuration from data but retains the efficiency and auditability of traditional LBP.

Methods

The core of FLEX-LBP is a multi-branch architecture (fine, mid, and coarse scales) where each branch learns five key components:

  1. Color Transform: A $3 \times 3$ matrix that mixes RGB channels into an optimal basis for the specific texture.
  2. Sampling Radii: Bounded distances for neighbor comparisons.
  3. Sampling Angles: The specific directions in which neighbors are sampled.
  4. Comparison Thresholds: Generalizing the "zero threshold" of classical LBP to handle noise and contrast better.
  5. Quantization Levels: The number of intensity levels used before comparison.

The technical challenge is that binary comparisons and histogram binning are non-differentiable—you can't pass a gradient through a "hard" bit flip. To solve this, the authors use a Straight-Through Estimator (STE). During the forward pass, the model computes exact binary codes and hard histogram counts. During the backward pass, it uses smooth surrogate derivatives to update the parameters.

Figure 1: Overview of FLEX-LBP on one real USPtex texture, with the parameters learned on USPtex by the All joint configuration (Section 4.2; symbols in Sections 3.2–3.5, with the branch index b dropped). Left (learnable stages): each branch applies its learned color transform Mb and samples K=8 neighbors at learned per-direction radii rk and angles θk, with mean radius ¯r. Open circles mark the classical initialization; filled dots mark the learned positions, shaded by the learned threshold ωk relative to the largest threshold of the branch. The geometry panels show the central 9, 19 and 27 pixels of the gray-level input. Middle (fixed binary encoding): hard comparisons give sign and magnitude codes, counted exactly into 256-bin histograms for each channel pair. Right: the histograms are normalized and concatenated into the 13,824-dimensional descriptor z (Eq. (3)). During training, the loss (proxy loss and regularizers, Eq. (13)) sends gradients back to every learnable stage (dashed); straight-through estimators carry them across the two binary steps (Fig. 2b,c). For evaluation, with frozen parameters, z is projected onto uniform patterns, power-normalized (3,186 dimensions) and classified by standardized one-nearest-neighbor (1-NN) matching against the training images. The ablation of Table 2 skips this postprocessing. The color-transform panels show Mbx with its deviation from the identity doubled for visibility. Input image from USPtex (Backes et al., 2012).

This approach ensures that the deployed model is just a standard LBP with optimized parameters, meaning it has the same low inference cost as a hand-tuned version.

Datasets

The authors evaluated FLEX-LBP on a diverse set of nine benchmarks:

  • Main Benchmarks: NewBarkTex (bark), KTH-TIPS2-b (materials), Outex TC13/TC31 (general textures), Parquet (wood), and USPtex (general textures).
  • Photometric Shift Suites: Outex TC32 (noise) and TC34 (illuminant changes) to test robustness.
  • Medical Application: The Kather-CRC benchmark, which involves classifying eight tissue types in colorectal cancer histology images.

Key Insights and Ideas

  • Geometry is the "Safe" Bet: The authors found that learning the sampling geometry (radii and angles) and thresholds while freezing the color transform was the most robust configuration. It consistently improved performance across almost all datasets without the risk of overfitting.
  • Interpretability Matters: Unlike CNN filters, FLEX-LBP parameters are physically meaningful. You can plot the learned sampling grid and see exactly how the model has adapted to a specific texture—for example, stretching the sampling circle into an ellipse to capture directional wood grains.
  • Beating the Giants: With only 90 learnable parameters, FLEX-LBP's mean accuracy exceeded that of a frozen ImageNet-pretrained ResNet-50 (which has 23.5 million parameters) on the main texture benchmarks. This highlights that for specialized texture tasks, a well-tuned "shallow" descriptor can be more effective than a generic "deep" one.
  • The "Dead Zone" Advantage: Much of the gain over classical LBP comes from learning non-zero thresholds, effectively creating a "dead zone" that ignores small, noisy intensity fluctuations.
Table 1: The nine benchmarks, all evaluated in RGB; the split lists the numbers of training and test images. The Outex benchmarks are 68-class color suites: the original Outex_TC_00013 and the extended Outex_TC_00031, 00032 and 00034. Kather-CRC is evaluated by stratified five-fold cross-validation at the tile level.

Key Results

  • Accuracy Gains: Learning the geometry improved the 1-nearest-neighbor (1-NN) accuracy of the fixed descriptor by 3.55 percentage points on average.
  • Histopathology: On the Kather-CRC histology benchmark, the fully learned FLEX-LBP reached 93.8% accuracy, significantly outperforming the best classical LBP variant (Completed LBP at 92.8%).
  • Efficiency: Because the "learning" only happens during training, the inference speed is identical to traditional LBP, taking roughly 35–40ms per image on a single CPU thread.

Limitations and Future Work

While FLEX-LBP is powerful, it lacks built-in invariance to extreme photometric shifts. For instance, heavy Gaussian noise or drastic changes in lighting can still degrade performance unless specific "remedies" (like median filtering or gray-world normalization) are applied at the input stage.

The authors suggest that future work could involve learning these robustness measures directly or developing a magnitude threshold that adaptively interpolates between image-relative and absolute forms. Additionally, testing on larger, multi-center histology datasets would be a crucial step for clinical validation.

Summary updated

Abstract

Local Binary Patterns (LBP) remain among the most widely used texture descriptors, from industrial inspection to medical imaging. Yet their radius, sampling angles, color transform and thresholds are fixed by hand for each dataset. We present FLEX-LBP, which learns these parameters by backpropagation while every forward pass computes exact binary codes and hard histogram counts. A straight-through estimator acts only in the backward pass, so the deployed descriptor is an interpretable hard-binary LBP with 90 learnable parameters and unchanged inference cost. In a controlled ablation on six color texture benchmarks, the component worth learning is dataset-dependent. One configuration, applied unchanged everywhere, learns the geometry and thresholds with the color transform frozen. It improves the nearest-neighbor accuracy of the identical fixed descriptor by 3.55 points on average over five seeds, significantly on five of six benchmarks and never significantly worse. With a linear discriminant readout, it gains 0.9 points; the fully learned descriptor gains 2.7 and has the highest mean. FLEX-LBP is more accurate than five classical LBP-family descriptors, PCANet and a neural LBP on five of six benchmarks. Its mean nearest-neighbor accuracy exceeds that of frozen ImageNet ResNet-50 features (23.5 million parameters). On the Kather colorectal cancer histology benchmark, the fully learned descriptor reaches 93.8%, significantly above the best classical descriptor (Completed LBP, 92.8%). The learned radii adapt in directions that recur across seeds. Noise drowns single-pixel comparisons and illuminant change flips inter-channel ones; median sampling or gray-world normalization restores 96-97%. The code is available as a drop-in PyTorch layer at https://github.com/medalimoussa/FLEX-LBP.
BibTeX
@misc{alimoussa2026flex,
  author = {Mohamed Alimoussa and Amal El Kaid},
  title = {{FLEX-LBP: Learning Local Binary Patterns with Exact Binary Inference for Texture Classification}},
  year = {2026},
  eprint = {2611.17302},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.17302},
}
Figure