Mapping Farmland with AI: ResUNet and SAM for Field Boundaries

Learn how a Residual U-Net and SAM 3 model accurately map farmland extent and visible boundaries from 1m NAIP imagery. Test accuracy 0.88, Dice 0.92.

martes, 28 de julio de 2026 • 4 min read • Q2BSTUDIO Team

Segmentación de campos agrícolas con deep learning e imágenes NAIP

Modern agriculture faces a critical challenge: the lack of up-to-date, complete, and open-access agricultural field maps. These maps are the foundation for crop monitoring, production accounting, and land-use change analysis. However, they are often proprietary, incomplete, or simply outdated. In this context, artificial intelligence (AI) emerges as a transformative tool, capable of extracting valuable information from satellite and aerial imagery. This article explores in depth the combined use of two deep learning architectures —ResUNet and SAM (Segment Anything Model)— to map the extent and visible boundaries of agricultural land using 1-meter RGB imagery from the National Agriculture Imagery Program (NAIP). Beyond the technical approach, it analyzes how companies like Q2BSTUDIO can integrate these capabilities into tailored enterprise solutions, ranging from custom software development to cybersecurity and cloud-based data analysis.

The problem of outdated maps is especially severe in intensive cropping regions, peri-urban interfaces, semi-arid irrigation zones, and fragmented mosaics. Traditional mapping methods require costly field work and processing time that do not align with precision agriculture needs. Here, the combination of convolutional neural networks (CNNs) and foundational models like SAM offers an efficient and scalable alternative. The reference study analyzed 37 NAIP scenes manually annotated in CVAT, generating 5,698 patches of 256x256 pixels. With a split of 3,850 training patches, 770 validation, and 1,078 test patches, a ResUNet was trained using a Dice-dominated loss —L = 2.5(1 - Dice) + BCE— achieving test accuracy of 0.8808, IoU of 0.8605, Dice of 0.9234, precision of 0.8766, and recall of 0.9794. These results demonstrate the robustness of semantic segmentation for distinguishing agricultural land from other land uses.

However, boundaries between parcels —especially in linear crops like orchard rows or highly fragmented plots— remain a challenge. To improve them, a pre-trained SAM model (branch 3) was integrated with a text prompt: 'agricultural farmland field'. The fusion was performed via a logical OR between the ResUNet mask and the SAM mask. In difficult patches, Dice improved from 0.858 to 0.955 in orchard rows and from 0.804 to 0.903 in fragmented parcels. This hybrid approach combines the local precision of ResUNet with the global context understanding provided by SAM, resulting in semantic agricultural extent maps —not cadastral maps— but sufficient for regional monitoring.

From a business perspective, adopting these techniques requires more than AI models: it demands a robust and customized infrastructure. Q2BSTUDIO, as a software and technology development company, offers custom software applications that integrate computer vision pipelines, from image ingestion to map publishing in interactive dashboards. The cloud plays a fundamental role: cloud AWS/Azure services allow parallel processing of terabytes of NAIP data, while cybersecurity ensures that sensitive agricultural data —such as estimated production or location of high-value crops— is protected from unauthorized access. Additionally, integration with Business Intelligence (Power BI) enables visualization of temporal trends and data-driven decision-making.

Artificial intelligence not only segments images; it can also act as an autonomous agent. AI agents, developed by Q2BSTUDIO, are capable of scheduling new image acquisitions, adjusting models based on new annotations, and generating alerts when changes in field boundaries are detected. For example, a monitoring system could combine the agricultural extent map generated by ResUNet+SAM with weather and soil moisture data to recommend irrigation or fertilization. All of this is built on a foundation of custom software, tailored to the specific needs of each client, whether an agricultural cooperative, a government agency, or an agro-industrial company.

The use of sliding-window stitching, mentioned in the study, is an example of how coherent regional masks can be generated. In a sample tile, Dice reached 0.898 and 0.919, demonstrating that the technique is viable for covering large areas without losing continuity. This is crucial for applications such as estimating cultivated area, early deforestation detection, or agricultural infrastructure planning. However, the final product is a semantic farmland extent map, not a cadastral parcel map. For applications requiring legal boundaries or property rights, additional post-processing with vectorization algorithms and higher-resolution orthophotos would be needed.

The scalability of the approach is another strong point. Since it is a reproducible pipeline —from annotation in CVAT to inference with pre-trained models— any organization can adapt it to their region of interest. Q2BSTUDIO offers consulting and development services to implement these workflows in production environments, ensuring the model stays updated with seasonal changes and new available imagery. The combination of AI, cloud, and BI creates a digital ecosystem that empowers farmers and land managers.

In summary, the fusion of ResUNet and SAM for agricultural land mapping represents a significant advance in remote monitoring, especially where official maps are deficient. The technology is mature, but its successful deployment depends on careful integration with enterprise systems. Q2BSTUDIO positions itself as a technology partner capable of turning these models into operational AI solutions, offering everything from custom application development to cloud infrastructure management, cybersecurity, and data analytics. The future of agriculture lies in digitalization, and artificial intelligence is the key to unlocking maps that were once invisible.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.