[KongchangAI]
· 2 min read· 1,242 words

FLEX-LBP: A Binary Texture Descriptor with Learnable Parameters That Outperforms ResNet-50

FLEX-LBP: A Binary Texture Descriptor with Learnable Parameters That Outperforms ResNet-50

FLEX-LBP uses straight-through estimation to learn LBP geometry and thresholds, achieving 90-parameter accuracy surpassing ResNet-50.

FLEX-LBP is a learnable local binary pattern descriptor whose core uses a straight-through estimator (STE) to pass gradients during backpropagation while the forward pass always computes exact hard binary LBP codes and hard histogram statistics, maintaining consistency between training and inference and inference cost identical to fixed-parameter LBP. It has only 90 learnable parameters. Ablations on six color texture benchmarks show that freezing color transformation and learning only geometry (radius and sampling angles) and threshold is the most robust configuration, improving nearest-neighbor accuracy by an average of 3.55 percentage points; fully learning all components yields the highest average performance but gains vary by dataset. In terms of performance, FLEX-LBP surpasses classic LBP family, PCANet, and a neural LBP on five of six benchmarks, with average nearest-neighbor accuracy even exceeding frozen ImageNet ResNet-50 features (23.5 million parameters). On the Kather colorectal cancer histology benchmark, it achieves 93.8%, better than Completed LBP's 92.8%. The paper also points out that noise and illumination disrupt single-pixel comparisons, and median sampling or gray-world normalization can restore performance to 96-97%. The code is open-sourced as a PyTorch layer and is plug-and-play.

FLEX-LBP: A Binary Texture Descriptor with Learnable Parameters That Outperforms ResNet-50

Local Binary Patterns (LBP) is one of the most classic descriptors in texture analysis, appearing everywhere from industrial quality inspection to medical imaging. But its core parameters—radius, sampling angles, color transformation, and threshold—typically require manual tuning for each dataset. A new paper proposes FLEX-LBP to change this: letting these parameters be learned automatically via backpropagation while keeping the forward pass computing exact binary codes and hard histogram statistics.

FLEX-LBP paper source screenshot

Core Idea: Hard Binary Forward, Straight-Through Estimation Backward

The key design of FLEX-LBP lies in the consistency between training and inference. Traditional differentiable methods often use soft relaxations during training, causing deployment behavior to mismatch training. FLEX-LBP employs a straight-through estimator, passing gradients only during backpropagation, while the forward pass always computes exact hard binary LBP codes. This means the deployed descriptor remains an interpretable hard binary LBP with only 90 learnable parameters, and inference cost is identical to fixed-parameter LBP.

This design gives FLEX-LBP both the flexibility of neural networks and the lightweight, interpretable characteristics of traditional descriptors. This is particularly important for resource-constrained scenarios or those requiring interpretability (such as medical image analysis).

Straight-Through Estimator (STE) is a common technique for training neural networks containing discrete operations. When the forward pass contains non-differentiable operations (such as sign functions, quantization, hard threshold binarization), conventional backpropagation cannot directly compute gradients. STE works by: executing the hard operation as usual in the forward pass, but during backpropagation "pretending" the derivative of that operation is 1 (or some surrogate function), passing upstream gradients back downstream unchanged. This allows the network to still train end-to-end while preserving exact discrete behavior at inference. The cost is that gradients are inconsistent with true derivatives—a biased estimate—but it has proven sufficiently effective in scenarios like binary neural networks and quantization-aware training. FLEX-LBP leverages this mechanism to allow LBP parameters such as radius, sampling angles, and threshold to be optimized while maintaining hard binary codes.

Ablation Experiments: What to Learn Depends on the Dataset

The paper conducts controlled ablations on six color texture benchmarks, attempting to answer "which components of LBP are worth learning." The conclusion: it depends on the dataset.

One configuration that remains unchanged across all datasets is: freezing the color transformation, learning only geometry (radius and sampling angles) and threshold. This configuration improves nearest-neighbor classification accuracy by an average of 3.55 percentage points across five random seeds, significantly better on five of six benchmarks, and never significantly worse. When using linear discriminant analysis (LDA) readout, the gain is 0.9 percentage points; while fully learning all components yields a gain of 2.7 percentage points, with the highest average performance.

This indicates that adaptation of geometry and threshold is a robust source of gains, while learning color transformation may vary by dataset and requires careful handling.

Nearest Neighbor (NN) readout and Linear Discriminant Analysis (LDA) readout are two typical ways to evaluate feature quality. Nearest neighbor classification directly uses Euclidean distance between descriptors for 1-NN voting without training any classifier, thus purely reflecting the discriminative power and metric structure of the features themselves, commonly used in texture, image retrieval, and similar benchmarks. LDA learns a linear projection that maximizes between-class scatter and minimizes within-class scatter while performing classification, being more sensitive to feature separability but introducing additional training parameters. Looking at both together can distinguish "features themselves getting better" from "gains from classifier adaptation." The difference between NN and LDA gains in the paper precisely illustrates that different readout methods utilize the same descriptor with different efficiency.

Performance Comparison: Small-Parameter Model Challenges Deep Features

FLEX-LBP outperforms five classic LBP family descriptors, PCANet, and a neural LBP method on five of six benchmarks. More strikingly, its average nearest-neighbor accuracy exceeds frozen ImageNet ResNet-50 features (which have 23.5 million parameters).

On the Kather colorectal cancer histology benchmark, the fully learned descriptor achieves 93.8% accuracy, significantly higher than the best classic descriptor Completed LBP's 92.8%. This demonstrates that in specific domains (such as medical texture), carefully designed lightweight descriptors remain competitive.

ImageNet-pretrained ResNet-50 features are often used as a strong baseline for general visual representation: after training on ImageNet, removing the classification head and using the penultimate layer (2048 dimensions) as frozen features, transferred to downstream tasks with nearest neighbor or linear classifiers. It has approximately 23.5 million parameters, high feature dimensionality, and strong semantics, but inference cost far exceeds traditional descriptors. PCANet is a shallow convolutional network baseline, composed of PCA filter banks plus binary hashing and block histograms, with few parameters and no backpropagation training required, often used to compare the upper bound of "unsupervised shallow features." FLEX-LBP challenges both types of representatives, intending to show that on texture tasks, learnable descriptors with extremely few parameters can compete with large pretrained features and shallow networks.

Robustness Observations: Challenges from Noise and Illumination

The paper also analyzes the learned radius variation trends, finding they are reproducible across different random seeds. It also points out two practical issues: noise can overwhelm single-pixel comparisons, and illumination changes can flip inter-channel comparisons. Through median sampling or gray-world normalization, performance can be restored to 96-97%. These findings provide direct guidance for practical deployment.

Gray-World Normalization is a classic color constancy assumption: that the average of all colors in an image should tend toward gray, scaling each channel accordingly to counteract light source color cast. It can alleviate the problem of inter-channel comparison flipping caused by illumination changes. Median sampling replaces single-pixel sampling with the median or average of neighborhood pixels in LBP neighborhood comparisons, reducing sensor noise interference on single-point comparisons. The two correspond respectively to the two failure modes pointed out in the paper—noise overwhelming single-pixel comparisons and illumination altering inter-channel relationships—and neither adds learnable parameters, belonging to low-cost post-processing or preprocessing methods at deployment stage.

Open Source and Availability

FLEX-LBP is open-sourced as a PyTorch layer and can be used as a plug-and-play module to replace existing LBP implementations. Code address: https://github.com/medalimoussa/FLEX-LBP.

For researchers and engineers working on texture classification tasks, FLEX-LBP provides a new option between handcrafted descriptors and deep networks: extremely few parameters, unchanged inference cost, interpretable, and accurate enough to challenge large pretrained models.

One-line Summary

FLEX-LBP uses straight-through estimation to learn LBP geometry and thresholds, achieving 90-parameter accuracy surpassing ResNet-50.

Paragraph Summary

FLEX-LBP is a learnable local binary pattern descriptor whose core uses a straight-through estimator (STE) to pass gradients during backpropagation while the forward pass always computes exact hard binary LBP codes and hard histogram statistics, maintaining consistency between training and inference and inference cost identical to fixed-parameter LBP. It has only 90 learnable parameters. Ablations on six color texture benchmarks show that freezing color transformation and learning only geometry (radius and sampling angles) and threshold is the most robust configuration, improving nearest-neighbor accuracy by an average of 3.55 percentage points; fully learning all components yields the highest average performance but gains vary by dataset. In terms of performance, FLEX-LBP surpasses classic LBP family, PCANet, and a neural LBP on five of six benchmarks, with average nearest-neighbor accuracy even exceeding frozen ImageNet ResNet-50 features (23.5 million parameters). On the Kather colorectal cancer histology benchmark, it achieves 93.8%, better than Completed LBP's 92.8%. The paper also points out that noise and illumination disrupt single-pixel comparisons, and median sampling or gray-world normalization can restore performance to 96-97%. The code is open-sourced as a PyTorch layer and is plug-and-play.

#FLEX-LBP#local binary patterns#straight-through estimator#texture classification#learnable descriptor#ResNet-50 comparison#binary texture descriptor
Share:

Related articles