Abstract
Agricultural data collection has outpaced manual labeling capabilities, creating a critical need for efficient self-supervised learning frameworks. We introduce CLAWS (Contrastive Learning with hard Attention and Weak Supervision), which improves upon standard contrastive methods by employing a dual-branch architecture and a hard attention mask. These innovations force the model to prioritize relevant crop features while filtering out background noise. Evaluated on a massive dataset of 227,060 agricultural images, CLAWS significantly outperforms standard SimCLR in clustering metrics and enables effective automated outlier detection.
Introduction
In the field of precision agriculture, visual data is abundant but expert labels are a luxury. Ground-based sensors can capture millions of images across thousands of acres, yet the cost of annotating every weed or growth anomaly is prohibitive. While self-supervised learning (SSL) methods like SimCLR have shown promise, they often struggle with the visual complexity of agricultural scenes, where soil, sky, or shadows can distract the model from the primary crop features. CLAWS addresses this by introducing architectural constraints that enforce focus on pertinent objects.
Methodology: The CLAWS Framework
CLAWS builds upon the SimCLR framework with three significant architectural shifts designed for real-world agricultural imagery:
- Dual-Branch Architecture: Unlike standard Siamese networks, CLAWS uses two distinct EfficientNet base networks. One is optimized for full-sized images (120x190), while the other processes small, local crops (32x32). This prevents the artifacts typically introduced when stretching small patches to fit large input layers.
- Hard Attention Mask: This core innovation uses a 2-layer perceptron to generate a binary mask ($M$). Applied to feature embeddings before contrastive loss calculation, it forces the network to ignore background noise and focus only on features consistent across both global and local views.
- Weak Supervision: The framework combines standard contrastive loss (NT-Xent) with a cross-entropy loss using available sparse labels, helping the model form more semantically cohesive clusters.
Experimental Results
The researchers utilized a specialized agricultural dataset containing 227,060 samples across 11 categories, including Wheat, Cotton, Corn, and Soybeans. CLAWS was compared against a supervised SimCLR baseline using standard clustering metrics.
| Method | NMI (Normalized Mutual Info) | ARI (Adjusted Rand Index) | AMI (Adjusted Mutual Info) |
|---|---|---|---|
| SimCLR | 0.6101 | 0.2873 | 0.6101 |
| CLAWS (Ours) | 0.7325 | 0.5069 | 0.7324 |
The significant jump in NMI (0.73 vs 0.61) suggests that the attention mechanism and dual-branch strategy create much more cohesive and distinct clusters for different crop types.
Key Insights and Outlier Detection
A major benefit of the CLAWS approach is the high quality of the resulting embeddings, which allows for the use of transparent clustering methods like Gaussian Mixture Models (GMMs). This enhances "Explainable AI" in agriculture, as researchers can visualize why specific samples are categorized together. Furthermore, the model successfully identifies outliers—such as images containing tire marks, weeds, or sensor errors—providing an automated method for cleaning large-scale agricultural datasets.
Conclusion
CLAWS stands as a robust tool for transforming raw field data into actionable insights with minimal human intervention. By sharpening the focus of contrastive learning through hard attention, the framework achieves superior representation quality in complex environments. Future work will explore moving toward a completely unsupervised regime and integrating transformer-based attention mechanisms.
Summary updated