Automatic field delineation: New release
We have released a new version of our automatic field delineation algorithm for Sentinel-2 imagery, with an improved workflow and accuracy. We detail here the research and development voyage that led to the new version.
Written by Devis Peressutti. Work done by Nejc Vesel, Matej Batič, Matic Lubej, Nika Oman Kadunc, Sara Verbič, Žiga Lukšič, and Devis Peressutti.
Time flies! It’s been already three years since we released the first version (V1) of our automatic field delineation (FD) algorithm. A lot has happened since, and we surely have not been idle. In this blog-post we report on the major research and development activities that led to the release of the second version (V2) of the algorithm. First things first.
What is field delineation and why do you need it?
Field delineation, for us, refers to the process of automatically tracing the boundaries of agricultural parcels from satellite or aerial imagery. We consider an agricultural parcel as a spatially homogeneous land unit used for agricultural purposes, where a single crop is grown. The result of the FD is a set of closed vector polygons marking the extent of each agricultural parcel. Such polygons are the input to a multitude of applications, ranging from the management of agricultural resources, such as the Area Monitoring for the Common Agricultural Policy, to precision farming, to the estimation of damages to crop yield due to natural (e.g. drought, floods), and human-made disasters (e.g. war). Automatic estimation of parcels with high fidelity in a timely manner allows therefore to characterize the changes of agricultural landscapes due to anthropogenic activities, agricultural practices, and climate change consequences.
The underlying assumption of FD is that boundaries of agricultural parcels are visible and spatially resolvable from remotely sensed imagery. The first version of the algorithm used Sentinel-2 imagery, and we have since trained and validated the algorithm also on Planet Scope imagery and on aerial imagery. While the spatial, spectral, temporal resolution, and spectral range differ greatly between data sources, therefore affecting the smallest resolvable agricultural parcel, the FD algorithm and workflow does not change.
How does it work?
In a nutshell, the algorithm leverages the similarity of spatial, spectral, and temporal properties of pixels belonging to the same field. We use a deep neural network based on the popular U-net architecture to estimate the parcel’s extent, boundary, and the distance of the segmented image pixels to the boundary. We then combine the estimated probability images, either from a single temporal image or from a time series of images, into a single pseudo-probability image representing the extent of the parcels. In post-processing, the image prediction is converted into vector format, where each polygon represents the extent of homogeneous agricultural parcels.
What is new?
Many things!
As a reminder, V1 was trained on data from Lithuania. Since its release, we have applied V1 on more than 1 million square kilometers, delineating agricultural parcels in Europe and North America. Some noteworthy examples include estimating parcels for Ukraine (for the past 7 years), as well as for Germany, Hungary, Spain, Lithuania and Canada. We received positive feedback and constructive criticism, which has led to the improvements of V2.
We have improved many steps of the workflow, both the training and the inference phase, with the main aim of improving the accuracy of the results, and reducing the noise and uncertainty associated with some steps of the workflow.
Fig. 1 shows the improved training phase. As opposed to V1, we considered imagery and reference data from the whole European continent. All imagery was downloaded through Sentinel Hub APIs. We used the AI4Boundaries and EuroCrops label datasets as source of ground-truth, and sampled locations to obtain stratified samples across geographical locations and crop-types. To reduce the sources of noise present in the training dataset, we applied two new steps, namely co-registration of the image series, and automatic curation of the reference data. Finally, we added a super-resolution layer to our U-net architecture to produce estimates of extent and boundaries at 4x smaller pixel size than the input image — for example, given the four B02, B03, B04, and B08 Sentinel-2 bands at 10 m pixel size, the network estimates parcel boundaries at 2.5 m. The neural network is then trained following hyper-parameter optimization. And ta-da, the weights of the V2 architecture are ready for inference.
Fig. 2 shows an exemplary scheme for the inference phase. Given the area-of-interest (AOI) and time-of-interest (TOI), we forward a batch processing API request to Sentinel Hub, which scales the download of the desired input imagery. For each cell of the grid used by the service, we optionally co-register images to reduce misalignments, we normalize them to center the reflectance values to the sensitive range of the deep network, and finally we input them to the U-net network with the pre-trained weights. The network outputs the estimates for the extent, boundary and distance to boundary of each detected agricultural parcel for each input timestamp of the time-series. We then temporally and spatially merge such estimates to obtain a single image which is contoured to derive the polygons outlining each agricultural parcel. Polygons estimated for each cell in the grid are then harmonized and merged to obtain a single vector map covering the input AOI.
The complete list of improvements for V2 over V1 is as follows:
- Europe-wide normalization of satellite imagery, to improve convergence and generalization of the deep network;
- Co-registration of input satellite time-series to reduce frame-to-frame misalignments;
- Use of open data from the AI4Boundaries and EuroCrops label datasets, which provide reference data of agricultural parcels for some European countries;
- Automatic curation of reference data;
- Super-resolution of estimated probability maps for the parcels’ extent, boundary and distance to boundary;
- Optional “rectangularization” of estimated parcels;
- Automation of execution.
The following paragraphs briefly describe the aim of each of the applied improvements.
Band normalization
We have investigated the influence of different normalization approaches on the convergence of the deep network and on the achieved accuracy for the estimated parcels. We found that linear normalization using percentiles of the band distributions (third picture in the top row of Figure 3) performed the best. To evaluate these methods, we derived band distribution for different land covers over Europe, resulting in a set of normalization factors that can be applied to a very large area, therefore improving the generalization of the model. You can find all details about this research in this blog-post.
Frame-to-frame co-registration
Geometric errors cause misalignments between consecutive satellite image acquisitions, which produces artefacts in FD results. They affect the accuracy of the training dataset, since temporal acquisitions are affected differently by geometric errors. For the same reasons, geometric errors affect the accuracy of the temporally merged probability image, which can also be seen when visualizing the results.
An example of the noise introduced by geometric errors is shown in Fig. 4, where the 3D spatio-temporal stack of the input satellite imagery is cut along one of the spatial dimensions. The vertical axis shows the time progression over different image acquisitions, while the horizontal axis shows the spatial index of the other spatial dimension, in this case northing. The yellow lines represent the boundaries of the reference polygons denoting agricultural parcels. For the unregistered stack shown in the top row, misalignments between the boundaries and the underlying images can be noticed. Such misalignments are compensated for when applying co-registration of consecutive frames, as shown in the bottom row. More details about the co-registration research can be found in this blog-post.
AI4Boundaries and EuroCrops
Normalization factors that are derived from a large area ensure that the model can operate well on image data coming from a wide range of locations. However, normalization factors are merely one requirement for such generalization. The key component to ensure generalization of the deep network to various locations, and possibly the entire globe, is to create a training dataset of reference polygons and corresponding satellite images which contains as many geographical locations as possible.
In our experience, the GeoSpatial Aid Application (GSAA) reference data offers the best reference labels for agricultural parcels. GSAA datasets are maintained by European Paying Agencies, and contain agricultural parcel polygons which are self-declared by farmers for the purpose of subsidies payment within the Common Agricultural Policy (CAP). These datasets are made openly available by some countries, which has spurred work aiming at unifying and standardizing their format to ease adoption. Two notable efforts in this direction are the AI4Boundaries and the EuroCrops datasets. The AI4Boundaries is specifically designed for the development and benchmarking of FD algorithms, and provides stratified samples of GSAA polygons and Sentinel-2, and high-resolution aerial imagery over Europe. On the other hand, EuroCrops collects and harmonizes GSAA datasets from several countries in the European Union, with the aim of providing a unified, machine-readable taxonomy of the possible crop-types present in the datasets. More details about these datasets can be found in this blog-post.
For the development of V2, we created a training dataset using a combination of the AI4Boundaries and EuroCrops, stratifying locations to ensure that samples from all available countries were considered, as well as different crop-types. GSAA polygons only represent agricultural land cover, so other negative samples of land cover (e.g. water, built-up, etc.) were added to the training dataset.
Automatic curation of reference labels
A major component of noise that affects the FD results is the accuracy of the reference polygons used to create the training dataset, namely, how well the polygon for a given parcel matches the visible boundaries on the satellite imagery at a given time. The main causes of inaccuracies are:
- The geometry of the polygon is incorrect.
- The boundaries are not visible on the satellite imagery at the given acquisition.
The latter is particularly tedious to deal with, and is inherent to the nature of the problem. In fact, agricultural parcels are dynamic entities that change appearance and possibly shape throughout the seasons. This means that there exist time periods where boundaries are more discernible than other periods, and, more importantly, there are time periods where such boundaries are not visible at all. Ideally, we don’t want to include such acquisitions in the training dataset. Fig. 6 shows the dynamic evolution of agricultural parcels in southern France.
We therefore set out to build a separate deep neural network to pinpoint inaccurate geometries and to select which time periods would be more suited for FD.
The result of this process is a probability score for each geometry and corresponding image at a given time period. For each image acquisition we can optionally filter out geometries with low probability scores that should represent wrong geometries or geometries with non-visible boundaries. Probability scores from the label curation network are shown in Fig. 7.
We use the resulting probabilities as a soft score for the filtering of geometries and time periods to use in the training dataset.
Super-resolution of inferred probabilities
We have some history in trying to squeeze out of satellite imagery as much information as possible with the use of super-resolution. The conclusion we came to is that it is better to let the FD architecture deal with the super-resolution task, rather than super-resolving the input satellite imagery. We therefore tweaked our deep neural network to include some super-resolution layers, which allow to generate probability images for the extent, boundary and distance to boundary at an enhanced spatial resolution compared to the input image.
Fig. 8 shows examples of super-resolved polygons estimated with a 2x and 4x increase in spatial resolution. A direct benefit of this is that V2 estimates larger parcels than V1, and is also able to provide estimates for smaller parcels.
Rectangularization of parcels
We have also been working on an experimental algorithm based on the concave hull to simplify the estimated geometries into more rectangular shapes, to produce polygons more similar to the reference polygons. This feature is still under development and validation, and is therefore not executed by default. Some examples of simplified geometries are shown in Fig. 9.
Automation of execution
The FD codebase in its original form was mostly a research tool, based on Python scripts and Jupyter notebooks. The current V2 version of the algorithm has largely diverged from V1 in several aspects, the most relevant being:
- It has been productionalized using eo-grow, which allows to automate the execution and scaling of entire workflows through the use of configuration files and Ray. In conjunction with Sentinel Hub, we are able to automatically execute FD on very large areas in a matter of hours.
- We switched to PyTorch as backend for the deep learning framework.
We have therefore decided to archive the open-source code for V1, ensuring though that it still works as intended.
What does V2 look like?
Enough chit-chat! Let’s look at some delineated fields! While the steps described above are valid for many input satellite imagery, we have for the moment developed and validated FD V2 on Sentinel-2 L1C imagery. To evaluate the performance of V2, we have applied it to test locations in Europe, e.g. independent locations not seen at training nor validation phases, and on test locations across the world to assess its generalization. Where reference data was available, we computed geometric errors based on Intersection over Union (IoU), over-segmentation (I.e. whether the estimated parcels tend to be smaller than the reference), and under-segmentation (I.e. whether the estimated parcels tend to be larger than the reference). In Fig. 10, V2b refers to V2 with simplified geometries to make them more rectangular. This process typically results in slightly bigger polygons.
We have also carried out a performance analysis in terms of false positive, i.e. parcels estimated by the model but not present in the reference dataset, and false negatives, missed parcels not estimated by the model but present in the reference. Results are shown in Fig. 11. F1-scores derived from false positives, false negatives, and true positives are V1=0.51, V2=0.61, and V2b=0.63.
We have already run V2 in production, and we have been able to get independent feedback about the performance of V2 for different regions in Italy (not included in the training dataset). Results of the validation are shown in Fig. 12 and were carried out by TerraSystem SRl, Viterbo, Italy. Increase in IoU is in line with what was seen for our test dataset, although absolute values are larger, due to the fact that the reference polygons in the area-of-interest are larger compared to the test dataset.
In Fig 13 you will find some examples of V2 predictions in Europe and outside of Europe, i.e. on geographical data not included in the training dataset. You can scroll through these results by visiting our updated demo webpage parcelio. Navigate around the world where red bounding boxes are displayed and zoom in to inspect the V2 delineated results.
How to get it?
For the time being, you can get in touch with us at info@sentinel-hub.com or eoresearch@sinergise.com. We plan to update the V1 version on the Euro Data Cube (EDC) marketplace in the very near future.
What does the future hold?
Here is our tentative roadmap going forward:
- Continuous improvements of the algorithm in terms of generalization to geographical locations across the world, and quality of results, in terms of estimating disjoint parcels;
- Development and validation of FD on Planet Scope imagery, which has a higher spatial and temporal resolution compared to Sentinel-2.
Thanks for reading. Get in touch with us at eoresearch@sinergise.com for any question, comment, appreciation and complaint.