## 2 Materials and Methods
### Software Development and Image Analysis  
The software package developed in the ForestMind project for monitoring deforestation extends the capabilities of the Python for Earth Observation (PyEO) package [14; 19]. PyEO was developed primarily as an implementation of automated near-real-time satellite  
Figure 1: Overview map of the study areas in Guatem and Brazil described in this paper. The red tiles (squares) are the Sentinel-2 tile footprints of the 100 km \(\times\) 100 km area. The grid shows latitude and longitude coordinates. Background map © OpenStreetMap. image processing chains to provide timely forest alerts, which show forest cover loss detections based on two land cover maps that have been classified by a trained machine learning model. PyEO contains many useful generic functions that can also be used for other image analysis and change detection tasks. As a source of imagery, Sentinel-2 products are currently supported as the primary data source, but other satellite constellations such as Planet and Landsat have been used in past trials. Sentinel-1 Synthetic Aperture Radar (SAR) images could be accommodated within the same framework in future developments. Working from the Sentinel-2 image data stream, PyEO can deliver forest cover loss alerts every 5 days at 10 m spatial resolution, subject to possible occlusion by cloud cover and haze in the imagery. A flowchart of the PyEO-based image processing pipeline is given in Figure 2. For ForestMind, we introduced several methodological developments to our earlier PyEO forest alerts algorithm [14] to meet the project's requirements. These are described below. The version of PyEO in this paper has been released as the 'ForestMind Extensions' of PyEO, version 0.8.0 on GitHub ([[https://github.com/clcr/pyeo/releases/tag/v0.8.0](https://github.com/clcr/pyeo/releases/tag/v0.8.0)]([https://github.com/clcr/pyeo/releases/tag/v0.8.0](https://github.com/clcr/pyeo/releases/tag/v0.8.0)), accessed on 27 November 2023) and Zenodo [20]. Figure 2: Overview of the ForestMind image processing pipeline for monitoring the extent of forest cover loss (‘deforestation’) in user-selected farm locations. Referencing a set of user specifications (left-hand column) the pipeline and tools enable a random forest classifier model to be built from user-supplied training data (second column), the generation of a temporal median over a chosen time period as a cloud-free composite reference image (third column), the use of the random forest model to classify incoming live imagery and compare it to the composite reference to detect changes (fourth column) and analysis of the time series of detected changes to generate reports for the analyst and company (righthand column). The machine learning approach taken in this work has evolved from earlier work [14]. Previously, change detection was based on direct, single-step differential detection of transitions between land cover classes by classifying forest change directly based on a vector of spectral reflectances from two time points from image pairs with a random forest classifier. The classifier was trained, pixel by pixel, on examples of inter-class land cover changes, such that a class label could be 'forest cover to non-forest cover' between the image pairs, for example. In practice, however, the relatively rare nature of the forest cover loss classes in some areas made it very difficult to collect consistent, high-quality training data to provide good coverage over all transitions of interest--ultimately limiting change detection capability. Creating a multi-temporal training dataset was challenging and time-consuming because it is harder to visually find areas of a particular type of change. A single image is much easier to understand by a human interpreter. Based on this experience, the PyEO forest alerts algorithm now adopts a direct classification of land cover classes (instead of land cover change classes), followed by post-classification change detection through cross-tabulation of land cover classes at times 1 and 2.