Skip to Content
HeritageHeritage
  • Article
  • Open Access

19 August 2026

31 Pages

The Importance of Fit-for-Purpose Evaluation for Computer Vision in Archaeology: A Case Study in Extracting Geospatial Data from Legacy Archaeological Maps

and
Department of Anthropology, Florida State University, Tallahassee, FL 32306, USA
*
Author to whom correspondence should be addressed.
This article belongs to the Section Archaeological Heritage

Abstract

Hand-drawn field maps are an irreplaceable archive of archaeological sites, yet converting scanned images of analog field maps into geospatial data remains a significant bottleneck. Currently, prompt-driven large language models (LLMs) cannot reproduce human heads-up digitizing consistently or affordably at scale. LLMs do, however, allow users to quickly produce custom computer vision (CV) workflows. We describe an example of one such custom Python (3.13.9) pipeline that extracts polygons that represent terraces on maps of fortified settlements (called pā) in Aotearoa New Zealand. It starts with scanned archaeological maps, decides if the map is in a cartographic style it can process, finds shapes, and decides if these shapes are valid based on a model trained on human-annotated examples. It works extremely quickly, outputs clean geospatial datasets, and has excellent spatial and formal accuracy, with a mean intersection-over-union (mIoU) for matched detections of 0.89–0.94. Detection performance, as measured by F1 scores covered an extremely wide range, from 0.800 to 0.00, with a mean of 0.528 (median = 0.588) typical of marginally successful CV studies. In practice, for every four terraces correctly mapped, three are missed, and three false positive are created. Critically, when we did a fit-for-purpose evaluation using an archaeologically meaningful metric (the Gini coefficient), we discovered a sliding scale of reliability. The best results were comparable with human-traced maps (F1 scores > 0.80). Below that, introduced error meant they were reliable in some senses but unreliable in others (F1 0.53 to 0.80). The worst were totally unreliable for quantitative analyses (F1 < 0.53). The lesson for archaeology is this: standard CV benchmarks alone cannot tell us whether an automated output is fit for archaeological inference. Archaeology would benefit from discipline-specific fit-for-purpose metrics, like the example here, as a regularized part of computer vision studies.

1. Introduction

The aim of computer vision (CV), a subset of machine learning (ML), is to teach machines to become as good, or even better, than humans at recognizing and identifying objects in digital images. Artificial Intelligence now puts CV within reach of users who have strong subject expertise but lack coding skills. At the time of writing, large language models (LLMs) all have the capacity for Computer Vision. In our very limited experience, we note that they can mimic human heads-up digitizing; however, the quality varies widely (Figure 1). Current limitations notwithstanding (see Section 2.2), it is likely we are about to see a massive uptick in the use of CV by archaeologists. Thankfully, Berganzo-Besga et al. [1] have published an excellent guide to “help the correct development, acceptance and inclusion of ML-based CV approaches within the discipline.” Their best-practice guidance correctly concentrates on conventional detection metrics (precision, accuracy, F1 score, intersection over union) and on hold-out validation, in which a model is assessed against a held-out test set. Such guidance is essential to certifying how faithfully a model reproduces human annotation.
Figure 1. Attempts by large language model computer vision (LLM-CV) to trace features on an archaeology map. Three LLMs—Microsoft’s M365 Copilot (version 2.20260812.55.0), based on the GPT-5 chat model (top), Google’s Gemini 1.5 Flash (middle), and Anthropic’s Claude Sonnet 4 (bottom)—were prompted to trace terraces over the same map and produced wildly different results. North arrow edited out of these images (north is up).
How useful will CV be for archaeology? To answer this question, we need to recognize that benchmark success and inferential adequacy, while related, are independent evaluations of quality. A model can reproduce human annotations well by every conventional measure and still yield data that cannot support the analysis it was built for. In other fields, where CV is already commonplace, there are quality targets that are specific to applications (e.g., [2,3,4]). They use generalized measures of performance but recognize that different problems require different targets. Target metrics for radiology and self-driving cars, for example, are high, but are also distinct from each other since they are based on different sets of baseline studies. For archaeology, the lack of baseline studies means no such standards exist, but it is not too early to imagine how we can build CV datasets that are fit for purpose.
We conducted a CV case study with two methodological goals in mind. Our first goal was to use what is currently available to illustrate how someone without coding skills can create a custom CV for archaeology. For that, we chose a commonplace archaeological problem: extracting geospatial data from scanned versions of analog maps. We tried to mimic what we believe could reasonably be achieved by a single archaeologist, with human-classified maps, and help from an LLM, but no coding background. It is important to note here that human classification of scanned maps, which was done prior to this study, took much longer than the work described here, and the field mapping, which was done decades ago, of course, took even longer. Our model development and implementation were constrained to a single laptop (MacBook Pro, 2023, Apple M2 Max Processor; Tahoe 26.5.1 OS) and we used a lightweight classifier (Random Forest) to lower processing time and increase the speed of model development. Python (3.13.9) code produced by the LLM was run in a Jupyter Notebook (7.4.5). During development, we used common computer vision statistics to help work out if a change in the model was improving results (IoM, F1). We also “showed” the LLM the in-progress results as images (i.e., maps with predicted polygons) to help diagnose what the model was doing. In the last stage, we used the CV pipeline to extract features on maps where we had not given it any human data to train on, which is typical for this type of study. It was a marginal success and the model certainly could be reengineered to provide better results. But new feature detection was not our only goal. Instead, our goal was to determine if it produced data that was of a quality level to support a specific kind of archaeological research.
Our second goal was to evaluate the CV data to determine whether it was fit-for-purpose for an archaeological analysis. To be clear, the purpose of mapping in archaeology varies widely but tends to center on conservation or research, broadly defined. We originally created the human classification dataset for quantitative research on inequality, using the variability in the relative sizes of terraces at sites as a proxy for wealth, measured by the Gini coefficient [5]. This technique, where floor area is a stand-in for a household’s wealth, is gaining in popularity (e.g., [6]) but is not without its limitations [7] and critics [8,9]. Again, our goal was not to expand our sample. The goal here was to determine if the features extracted from maps via CV matched the Gini coefficient from our earlier study. We tested how close the predictions came to our previous results in several ways to explore potential sources of error and how we might improve in the future.
Our concern that standard performance measures may not capture archaeological adequacy is not new. Bickler [10] cautioned that ML’s internal checks “still rely on internal mathematical measures” and require archaeological scrutiny to confirm they are delivering usable results, warning more broadly that such models remain “less reliable than those of expert traditional methodologies.” Our fit-for-purpose test operationalizes that concern. It asks not whether the model reproduces a human tracing, but whether the data it yields can support a specific archaeological measurement. We are not advocating what is presented here as appropriate for all cases. But, based on the results, we do feel strongly there is a real need to bake in measures of fitness-for-purpose to ensure we are creating datasets that will give us results that are meaningful for archaeology.

2. Background

We are by no means the first to consider the value of CV for archaeology. Below we provide a brief overview of how CV has been discussed. We also present context for both the problem of legacy maps generally and the specific set of maps used in this study. We end with an explanation of benchmarking statistics for CV since these are not yet commonplace in the wider archaeological literature.

2.1. Computer Vision in Archaeology

Within archaeology, the densest cluster of work invoking “computer vision” is in remote sensing, where the term mostly refers to the automated detection, localization, and segmentation of features across large spatial datasets [11]. As we have seen data volumes outgrow what manual interpretation could handle, archaeologists have turned to convolutional neural networks (CNNs) as the natural choice for automated and semi-automated mapping workflows [12]. Early demonstrations applied region-based CNNs to localize and classify multiple object classes, such as prehistoric barrows and fields [13]. Others tested whether a model trained in one region could transfer to another [14]. These moved beyond point detection toward pixel-level semantic segmentation, fusing LiDAR-derived relief imagery with aerial orthophotos to generate binary masks of detected sites [15].
There is also a parallel tradition of using computer vision for artifact analysis. The earliest archaeological studies framed CV as an underexploited toolkit for classifying finds, illustrated through content-based retrieval of historical glass and automatic coin classification [16]. Ceramics later became the most active subfield, with the ArchAIDE project building image-recognition tools that identify pottery from a single photograph using two complementary methods, one based on the shape of a sherd’s fracture outline and the other on decorative features [17].
Reading across these literatures, a semantic shift in the term itself becomes visible. In the earlier work, computer vision denotes a family of classical techniques—contour and shape descriptors, texture statistics, feature detection—deployed deliberately and named precisely. From roughly 2018 onward, however, the phrase is used far more loosely, often as a near-synonym for CNN-based deep learning, with “computer vision system” standing in for any pipeline that takes an image as input. The shift is not merely terminological: it tracks a real methodological consolidation, in which heterogeneous, hand-engineered approaches gave way to a comparatively uniform deep-learning paradigm. For archaeological mapping specifically, this has the effect of collapsing what were once distinct tasks—locating sites, classifying them, and delineating their extent—into variants of a single image-analysis problem, even as authors continue to flag that the intricate and irregular shapes of archaeological features remain a genuine challenge for such systems [15].
Berganzo-Besga et al. [1] have recently published a guide to best practices for archaeologists using computer vision. It is an excellent resource, carefully considering the choices one must make at each step in the process, as well as a brief review of ethics, where they raise the problems of cultural bias in training ML, replicability, and the ever present question of balancing our obligations to share information and protect the location of heritage sites that could be targeted by those who would do harm to them.
We could find only two comparable examples of CV that deal with problems that are good matches to the central focus of our study (i.e., extracting vector polygons from archaeological maps). Berganzo-Besga et al. [18] use an open-source Mask R-CNN method to identify mounds and other sites that are drawn on maps in a similar style to the maps we discuss here (hachure). Reported precision was excellent, 0.823 to 0.703, and recall was good to acceptable, 0.708 to 0.526, with excellent F1 scores (0.800, 0.828). The other study by Garcia-Molsoa et al. [19] also looks at historic maps, but using proprietary software (Picterra). They report a wide range of false positives, from 3–4% to 40–44%. One important point of difference is that these studies were often working across much larger datasets than the one described here. They were also using maps that were prepared by professional cartographers, making them somewhat more challenging in the sense that they contain many more non-archaeological features than archaeological features, but also somewhat easier in that the degree of standardization was likely higher.
It is also important to note that computer vision approaches to detecting and mapping archaeological terraces in remotely sensed data have rapidly evolved thanks to the increase in the availability of high-quality data and more automated learned segmentation. The challenge of isolating human-made terraces from natural features and more recent human-made features was initially approached by searching for distinctive signals in metrics like slope, texture, and other information [20,21,22,23]. These naturally relied heavily on human interpretation. Deep learning, and the CNN U-Net architecture specifically, has reduced that dependence [24,25,26,27,28,29]. Most recently, Peker [30] compared early, intermediate, and late fusion, finding early fusion best (IoU = 0.754) yet only marginally ahead of an RGB-only baseline (IoU = 0.729). This and other studies report strong benchmark scores and validate against standard segmentation metrics, showing great progress in teaching computers to become expert digitizers. The next natural step, in our view, is to match these advances with an assessment of the specific archaeological inferences their outputs are meant to support.

2.2. Archaeological Maps as Geospatial Datasets

Archaeology has over the years developed cartographic best practices for recording evidence on surveys and excavations. These could be generally classified as quasi-standardized insofar as what is considered a good quality plan map is flexible and draws upon a loosely defined set of conventions. There is also an expectation that factors particular to a find—the nature of the evidence being recorded, the environmental setting, and other factors, such as regional conventions for recording—influence how we map sites and excavations. Indeed, archaeologists spend a lot of time training field recorders on how to record finds in ways that fit our needs. Over the past twenty years, even as our focus has shifted to field and remote sensing data that is born digital, archaeologists recognize legacy analog maps as more than archives. They are snapshots of sites that, in some cases, have been destroyed, either by development or nature. Maps from digs are especially important since the act of excavation is inherently destructive.
Many, but not all, archaeological maps have made the transition to digital but there remains a wide gap between digitization and datafication. Datafication, in this context, is the act of producing geospatial data from a digital copy of the map. Think, for example, of a digital version of a detailed hand-drawn plan map of an ancient city. The scanned image is a good representation of the city but it cannot give you information on how large the city is, or how many buildings are represented, or what the differences are in the sizes of people’s houses. It cannot help you make evidence-based decisions about modern development in and around the site. But bring that map into a GIS, trace the outlines of buildings and streets as geo-rectified vector data, and getting relevant information is trivially easy. It is hard to say what proportion of archaeological maps have made it from digitization to datafication. A search for “map” in the two largest global digital archives—Archaeology Data Service (ADS) and the Digital Archaeological Record (tDAR)—yields over 90,000 records. A search for “GIS” returns just over 4000 records. If one had to estimate just based on these figures alone, and it should be said this is an extremely rough estimate, then fewer than 5% of archaeological maps may have made the leap to geospatial data.
What about Artificial Intelligence (AI)? Can machines read archaeological maps? The machines certainly think they can. We prompted the current leading AI platforms, and they all claimed “yes,” they can read archaeological maps, but they also noted limitations. Each pointed to advances in the way AI can “see” by training on imagery that has been tagged and classified by a human. There are several barriers for current AI reading archaeological maps, including: recognizing non-standard cartography (symbols, style), making meaningful semantic connections between objects, and the lack of available training data relevant to archaeology. Training data is a big problem for CV. To be successful, the machine needs to learn using a large and diverse set of images that have been tagged with meaningful classifications by a human. There are workarounds, such as data augmentation (DA), where you add some noise into your existing training dataset to essentially create new cases to train on, but that only works in a limited set of circumstances (for more on DA, see [1]).

2.3. Mapping Sites in Aotearoa New Zealand

To explore how far CV has come to being able to turn legacy archaeological maps into meaningful geospatial data, we designed and implemented a small experiment using a series of legacy archaeological maps from Aotearoa New Zealand. We know that over 7000 fortified settlements (called pā) were built over several centuries beginning around 1500 CE, with most built long before first contact with people from outside the Pacific (Figure 2). They are not just our best material record of warfare but also critical for understanding daily life in this period. The 74 pā maps in our experiment have all already been classified by a human who traced the dominant feature at these sites: terraces. Terraces are a good target for benchmarking for several reasons. They occur at sites all over the world; they vary widely in shape and size; they are complex because sometimes, but not always, they have features on top of them (i.e., houses, pits); and they are drawn in ways that will reflect local topographic context. In these senses, they are the ideal test case for CV applied to archaeological maps. We note that the list narrowed to 66 maps, as we found some maps failed our CV pipeline.
Figure 2. An Example of a Fortified Settlement, Mt. Eden/Maungawhau, Aotearoa New Zealand. These images show a large fortified settlement (pā), located within the modern city of Auckland, represented as a legacy hand-drawn map (Historic Places Trust) and a GIS vector layer (polygon). Sources: https://www.cityraillink.co.nz/crl-privacy-policy (accessed on 15 July 2026); https://www.maungawhau.co.nz/archaeology/ (accessed on 15 July 2026); and [5].

2.4. Historical Background on Archaeological Mapping in Aotearoa New Zealand

The history of mapping fortified settlements (pā) began with early maps by European visitors and maps supplementing ethnographic research [31]. In the late 1950s, a national site recording system was launched by the newly formed New Zealand Archaeological Association, which included methods for field mapping sites and using aerial photography [32]. Over the years, pā became the focus of survey and targeted excavations, leading to our first picture of how these sites developed over time and varied in form (e.g., [33]). By the 1990s, we see an increase in scale, with a comprehensive evaluation of the radiocarbon data [34], and surveys that looked at sites across whole regions [35,36]. The transition to GPS-based survey began in this era, although selective availability delayed its more widespread adoption until after 2000 [37].
The fortified settlements (pā) maps made by Mark W. Allen for his PhD dissertation are a highwater mark for the hand-drawn archaeological map in Aotearoa New Zealand [36]. He notes “[t]he first step of my fieldwork was to conduct a 100 percent survey of pa in the study region through the use of existing site records in the New Zealand Archaeological Association (NZAA) recording system and the use of aerial photographs” [36]. The NZAA file, “provided site locations and plan maps for a large percentage of the pa in the study area which were recorded prior to my fieldwork” [36]. Newly identified pa “were mapped by tape, pace, and compass or by planetable and alidade,” with planetable mapping reserved for “larger or more complex sites which required … increased accuracy” [36]. In all, his fieldwork “recorded 60 new archaeological sites, including 22 pa” [36] (see Figure 3).
Figure 3. Examples of Maps from Sites in the Hawke’s Bay Region, North Island, Aotearoa New Zealand (Source: [36]). Note the wide variety of sizes, forms, arrangements, and numbers of terraces.
While many of these maps were made for archival purposes, as part of the national effort to record sites, they nonetheless served as the analytical foundation of Allen’s research. The distribution of mapped pā fed into a nearest-neighbor analysis “to help identify clusters of pa and the boundaries between them” [36], while surface measurements taken during mapping underpinned his labor and population estimates. Allen’s dissertation is important for this study, but we want to acknowledge that this was followed by decades of continued collaborative research rooted in Kaupapa Māori (Māori worldview, values, perspectives, and goals) [38,39].

2.5. Recent Studies of Fortified Settlements in Aotearoa New Zealand

A recent global study of inequality over the very long term included a small number of fortified settlements from Aotearoa New Zealand [5,40]. The way that inequality was compared in different contexts was through relative differences in the sizes of domestic architecture in the archaeological record. The central metric used was the Gini coefficient, an index that goes from 1.0 (perfect inequality) to 0.0 (perfect equality) and has been useful for quantifying differences between archaeological datasets. Hand-drawn maps of eight pā sites were heads-up digitized, resulting in 464 polygons representing terraces that could have supported domestic architecture (Supplemental Table S1). As part of an undergraduate thesis project, Moncrieff [41] expanded the investigation to include sites from Allen’s dissertation. Using a curated sample of 66 site maps, she created polygon features representing 1058 terraces as polygons [42] (Figure 4). For this study, we include within “terraces” several classes used by Allen [36]: terraces, houses, and tihi (chief’s house), to make the data consistent with the previous study. Also, to avoid errors introduced by small sample sizes, only sites with more than five terraces were included.
Figure 4. Example of Heads-Up Digitized Map. The “ground truth” (GT) polygons in this study come from a previous study. Source: [41].
This expanded dataset suggests that inequality (as measured by variance in terrace sizes) is extremely different across sites, ranging from a high of 0.704 to a low of 0.092 (Supplemental Figure S3). We recount this specific finding here because it sets the bar for the level of accuracy and precision necessary for an archaeological study built on data from hand-drawn maps. We will return to this in our discussion of archaeology-specific benchmarking of our computer vision model.

2.6. Explanation of Generalized Computer Vision Benchmarking Metrics

Archaeologists will be familiar with confusion matrix statistics: true positive (TP), false positive (FP), true negative (TN), and false negative (FN). These are foundational to understanding how benchmarking statistics are talked about in computer vision studies. Figure 5 is a schematic representation of precision (P), recall (R), and the F1 score. The F1 score is a metric used in ML to capture precision and recall in one statistic. F1 scores of 0.85–0.99 are considered excellent, typical of high-contrast, well-structured datasets such as optical character recognition or industrial defect inspection. Scores of 0.70–0.84 represent a good quality, but not excellent, result, typical of real-world detection tasks involving occlusions or variable image quality such as person walking down a street or facial detection. Scores of 0.50–0.69 are considered acceptable, typical of difficult tasks involving small or densely packed objects such as tumor detection in medical imaging. Scores < 0.50 fall below accepted standards for practical deployment.
Figure 5. Explanation of F1 Score.
Intersection over union (IoU), also known as the Jaccard Index, is another important metric for measuring the accuracy of object detection (Figure 6). A perfect match (1.00) requires the predicted object to be identical in both size and location. Scores above 0.90 are considered near-perfect matches. IoU in the range of 0.89 to 0.75 is generally excellent to good, with 0.69 to 0.50 being acceptable, especially with objects that are known hard targets. Below 0.50 is unacceptable.
Figure 6. Explanation of Intersection over Union (IoU).
We use IoU in several ways in this study. We report the global IoU (all predicted polygons vs. all human-traced polygons), which is good index of generally how well features map onto each other. We also report the mean IoU (mIoU), which is based on individual polygon IoU. mIoU is a good indicator of how well the computer vision pipeline is creating polygons of terraces. We also use IoU outside of evaluation. Our pipeline needed a way to decide which predicted polygon, if any, matched a human-drawn polygon. We instructed it to use >0.5 IoU to match predicted and human-drawn individual polygons. Thus, there is a degree to which we imposed a hard baseline on individual polygon IoU, since scores lower than that threshold were classified as total mismatches.

3. Methods

3.1. Computer Vision Pipeline for Vectorizing Terraces on Archaeological Maps

We developed an automated image processing pipeline to detect and delineate terraces on scanned paper archaeological maps. The pipeline operates directly on georeferenced map images, extracting candidate feature polygons through a sequence of image processing steps and classifying each candidate as a terrace or non-terrace feature using a ML model trained on human-annotated examples. The pipeline was implemented in Python 3.13.9 and runs as a single self-contained script, requiring no manual intervention once configured. All processing is performed in raster (pixel) space, with coordinates transformed to the New Zealand Transverse Mercator geodetic datum (NZTM2000, EPSG:2193) for spatial evaluation and output.
We began by probing of the capability prompt-driven Large Language Model Computer Vision (LLM-CV), essentially asking LLM to read a map and trace features (Figure 1). At present, LLM-CV have surprisingly good semantic computer vision, that is taking an image and recognizing what it is in it. Exactly how it does this is a black box, but at minimum, it uses text that it can lift off an image through OCR, and classified images (images that a person has labeled) that it has access to. But when it came to mimicking heads-up digitizing, the maps the AI produced were mixed, most were wildly incorrect, with some rare successes. Today, if your goal is to go from scanned-image to geospatial data for just one, or a handful, of maps, LLM-CV may be sufficient now. But in our limited experience, it was not practical to achieve at scale due to time and cost.
We discovered the most efficient way to build a method to transform scanned images of maps into vector geospatial data was by working iteratively with an LLM (Figure 7). We know that the LLM can “see” individual maps, and that it can produce Python code that leverages foundational CV models (i.e., OpenCV; Segment Anything Model). We used those capabilities to train, and refine, our CV pipeline first based on one map, then 9 maps, then 35 maps. Throughout that stage the LLM returned statistics to help us decide which functions worked best. We also were able to give it images along the way to “show” the LLM how different functions were performing. Next, we then validated the model on a different set of maps to measure how well the CV model performed relative to the current technical benchmarks set by other computer vision studies. We can do this because we have human classification datasets that we can use to compare with predicted data in the validation set of maps.
Figure 7. Improving AI-assisted computer vision pipeline. This image illustrates some examples of the late-stage improvements made through iterative prompts with an LLM while building the CV pipeline.

3.2. AI-Assisted Development of the Computer Vision Pipeline

The computer vision pipeline used in this study was developed interactively using Claude (Anthropic) Sonnet 4.6, a large language model assistant (Figure 8). Development took place over 21 h of sessions with a researcher and AI assistant. In Stage 1, we focused on the creation of the basic pipeline. In Stage 2 we tested and improved it. In Stage 3, we fixed outstanding issues and implemented it on the ‘blind’ data. In Stage 4, we made a correction to how the confusion matrix was calculated.
Figure 8. Final AI-assisted computer vision pipeline. This image illustrates steps for turning scanned image of a map into vector data (polygons).
Stage 1 was three working sessions spanning two days (9–10 June 2026), comprising approximately 96 researcher prompts and 98 assistant responses across roughly 13,200 lines of conversation, over 10 h. Over the course of these sessions, the pipeline passed through more than 36 named versions, from an initial genetic algorithm baseline through a series of SAM-based detection architectures, a systematic benchmark comparison across 95 detection configurations, and a final optimized version. The AI assistant generated all pipeline code in Python, analyzed quantitative output at each stage, diagnosed errors and performance regressions, and recommended architectural changes based on empirical results fed back by the researcher. Approximately 863 distinct error or anomaly mentions appear across the three session transcripts, reflecting the degree to which empirical failure—rather than a priori design—drove the development trajectory.
Stage 2 was an extended iterative dialogue conducted on 11 June 2026. The conversation spanned approximately three hours and involved over 150 exchanges, progressing from an initial problem statement through successive phases of implementation, evaluation, and refinement. The workflow was characteristic of what might be called “conversational software development”—the human researcher directed the analytical strategy while the AI generated, debugged, and revised code in response to empirical results fed back through the conversation.
Stage 3 was developed across three working sessions, 11–12 June 2026, comprising 122 conversational turns over approximately seven hours of active exchange. The first session ran for four hours (74 turns) and covered the core algorithm—binarisation, skeletonisation, contour extraction, feature extraction, and Random Forest classification—along with the identification and attempted resolution of the dashed-line map problem. The next session ran for three hours (48 turns) and covered pipeline cleanup, the expanded blind test on 31 new sites, shapefile and mapbook export, and evaluation statistics.
Stage 4 was a single 1-h session on 30 July 2026 to fix a systematic error in how the pipeline was counting true positives and false negatives. In previous runs, the model multiple predictions were allowed to claim the same GT terraces as a TP if they were above our IoU threshold, and silently ignored FN where terraces had no overlapping prediction at all. The corrected results above use Hungarian algorithm assignment at IoU ≥ 0.5. The way that cross-validation is calculated was updated to prevent data leakage.

3.2.1. Required Packages

The following packages are required to run the model: numpy, matplotlib, scipy, scikit-image, geopandas, shapely, pyproj, rasterio, opencv-python, scikit-learn, joblib, Pillow, and pytesseract. Note that pytesseract is a Python wrapper around the Tesseract OCR engine, which must be installed separately.

3.2.2. Prompting Approach

Prompts were predominantly short and task-oriented, typically between one and four sentences. The researcher described the goal, pasted output or error text, and asked for a specific action. The assistant then produced a full revised script or analysis, which the researcher ran in a Jupyter Notebook on an Apple M2 Max machine and returned the terminal output. This cycle—prompt, generate, run, return results—constituted the basic unit of development and repeated continuously across all sessions.
Prompts fell into four broad categories. The first was implementation requests, in which the researcher asked for a specific function or architectural change to be built or modified. The second was error diagnosis, in which stack traces, unexpected metric values, or zero-output failures were pasted and the researcher asked for an explanation and fix. The third was analytical requests, in which tabular results from pipeline runs were shared and the researcher asked for interpretation, comparison, or visualization. The fourth was design questions, in which the researcher asked for the assistant’s assessment of what should be tried next or why a particular approach was failing. These four categories were not mutually exclusive; a single prompt often combined a result paste with a question about what it meant and an implicit request to fix something. When sessions exceeded context limits, the assistant generated a structured summary of all prior decisions, parameter values, benchmark numbers, and open issues, which was carried forward.

3.2.3. How Functions Were Added and Evaluated

New pipeline components were introduced in response to specific observed failures in the current version. The researcher did not specify implementation details in advance; instead, a problem was identified from quantitative output, the assistant proposed a solution and implemented it, and the researcher ran the new version and returned the results. If performance improved the change was retained; if not, the change was rolled back or modified.
A representative example of this process involves the development of the union-IoU scoring function, which passed through four distinct implementations within a single session. The initial scoring method matched each ground-truth polygon to its single best-matching AI polygon and computed intersection-over-union for that pair. The researcher observed that this penalized sites where SAM had over-segmented a single terrace into two adjacent fragments. The assistant proposed a union-IoU approach—for each human polygon, union all AI polygons whose pairwise IoU with it exceeded a minimum threshold, then compute IoU against the union—and implemented it. When the researcher returned results showing that site V22_302 had collapsed from IoU = 0.911 to IoU = 0.013, the assistant diagnosed that the threshold used to qualify polygons for the union (intersection divided by AI polygon area ≥0.30) was too strict for sites where SAM had split a terrace into many small fragments, each covering less than 30% of the human polygon. A second threshold of 0.05 was tried and still failed. Diagnosis of the second failure established that large background false-positive polygons were passing the area-fraction threshold and inflating the union, causing the denominator of the IoU calculation to balloon. The correct solution—using pairwise IoU (intersection divided by the union of both polygon areas) rather than area fraction—was identified analytically and implemented in the final scoring function, which recovered performance. The entire diagnostic arc took approximately five prompt-response cycles.
The assistant was used often to handle unexpected errors. For example, the researcher initiated a run and then returned to the AI assistant with the following output: “Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn’t support float64. Please use float32 instead.” No further context was provided. The assistant identified that this was a known constraint of SAM vit_h, which uses float64 operations internally in its mask decoder regardless of the model weight dtype, and that the prior fix of calling torch.set_default_dtype(torch.float32) before sam.to(“mps”) was insufficient because SAM re-casts internally at runtime. The fix—forcing SAM to run on CPU regardless of device availability—had been validated throughout the exploratory series and was confirmed to run at approximately 30 s per inference pass on the M2 Max CPU. The assistant implemented the fix, updated the parallelization logic to reflect that CPU-based SAM is thread-safe (enabling ThreadPoolExecutor), and noted in a code comment that this constraint had been verified across multiple earlier versions.
The AI assistant generated and compared results of versions. For example, after returning a run using 10-sites, the researcher asked simply asked to compare it to a previous run and pasted a 37-row table that the python code had produced. The assistant produced a structured comparison identifying that the new version had achieved a mean IoU of 0.561 versus the previous 0.384, that the gap was largest on V22_302 (0.789 versus 0.000), and that the root cause was the post-filter threshold (0.92/0.95) cutting too many fragment masks before the union-IoU scorer could combine them.
Some cases proved so difficult to resolve that the solution was to build a tool to detect maps that could not be resolved and filter them out as not being within the style of map that the pipeline could handle. For example, R11/12, a map drawn in a hachure convention with dense short dashes rather than solid outlines, was consistently scoring zero F1 despite multiple attempted fixes (morphological closing, confidence threshold adjustment, Hough line reconstruction). After an extended diagnostic sequence that spanned roughly two hours, the researcher concluded: “I give up, filter this track out at Phase 0 as not a map style fail that can be processed.” Claude acknowledged this decision but flagged that three other sites (V21/3, V22/88, V22/6) were near the same fragmentation threshold and asked whether they should also be excluded. The researcher replied: “I am not done with those other sites, filter at +3.00 = z.” This single prompt resulted in Claude designing the branch density z-score gate—computing a population baseline from training sites and excluding only maps more than 3.0 standard deviations above the mean. R11/12 fell at z = +3.77 and was excluded; all other sites remained in the pipeline. This exchange illustrates, among other things, how a researcher decision stated at a high level (“filter at +3.00 = z”) was interpreted and translated into a calibrated, population-referenced implementation without further specification from the researcher.

3.2.4. Advice for AI-Assisted Computer Vision Pipeline Development

The state of LLM is rapidly changing but there are some basic lessons we learned that we think will be valuable to anyone who is a subject expert, but not a coder, looking to run their first computer vision study. First, LLM-assistance is not like software instructions, do not expect the same series of prompts to lead you to replicate a pipeline. That is why we summarize our interactions rather than publishing every prompt and response over the development of the code. Instead, if you want to replicate our study, or tinker with our model, we provide the pipeline code, and example results, as Supplemental Data. Start by giving them to an LLM and then build up from there. Second, if you are using the LLM-assistant to add functions or edit your code, have it estimate how long the new code will take to run on the specific computer you where you will run the code. In development we found that once we started to ask the LLM to find a faster solution to the problem we were working on, that made the back-and-forth trouble shooting much more efficient. Third, we recommend having your code produce a range of different formats—spreadsheets, images, shapefiles, PDFs, etc. That allows the researcher different ways to detect and diagnose problems with the pipeline. And, those statistics, files, and images, can be uploaded to the LLM so your AI assistant has a better chance of understanding the problem you are trying to fix. Finally, we cannot overstate the importance of human review of results. Our last stage of development was to fix a rather glaring systematic error that was only caught by reviewer who noticed that our numbers were not adding up.

3.3. Source Material

Input maps were scanned paper archaeological site plans rendered as georeferenced JPEG images with associated world files (.jgwx or .jgw format). World files encode the georeferencing parameters, the real-world coordinates of the upper-left pixel and the ground distance represented by each pixel, allowing the pipeline to convert pixel coordinates to projected map coordinates. Maps vary in scale, scan resolution, and drawing convention; thus, as georeferenced rasters, they range from approximately 0.05 to 0.56 m per pixel. Ground truth (GT) terrace polygons were digitized by a human analyst in ArcGIS Pro 3.4 and stored as shapefiles in EPSG:3857 (Web Mercator), which the pipeline reprojects to EPSG:2193 for evaluation. The full dataset comprises 66 sites: 35 used for training and internal cross-validation, and 31 held as a “blind” test set whose ground truth was withheld from the pipeline during development but later used to assess the results. Several additional maps were used in the model development stage that were excluded due to missing map files, bad georeferencing, or incompatible drawing conventions.

3.4. Map Style Classification

Before any feature detection is attempted, the pipeline assesses whether each map image is suitable for processing. Two exclusion criteria are applied. The first detects GIS-rendered maps; these are clean, digitally produced plans that lack the ink texture and tonal variation of scanned paper originals. The pipeline computes a geometry regularity score from the binary image: the mean ratio of the convex hull area to the actual area (solidity) across all connected components of ink. GIS-rendered maps produce highly regular, vector-like shapes with mean solidity above 0.49, while hand-drawn maps produce irregular ink textures with lower scores. Maps exceeding this threshold are flagged and excluded from processing. The second criterion detects maps drawn in a dashed-line or hachure convention, in which terraces are represented by short, repeated strokes rather than solid outlines. This convention produces a characteristic fragmentation signature in the skeletonized image: a very high number of skeleton branch endpoints per unit image area. The pipeline calibrates a population baseline from the training sites, computing the mean and standard deviation of skeleton branch density (branches per 100,000 pixels) across all training maps, and excludes any map whose branch density exceeds 3.0 standard deviations above the training mean. This gate filtered a map with much more use of dashed lines (R11/12, z = +3.77).
It was important for us to evaluate what automated detection pipeline could do with same images that humans had used to create the ‘ground truth’ polygons. Thus, we did not trial different resolutions of images and we used the same jpg format as the human classifiers had used. We recognize that jpgs are not idea for computer vision studies because lossy compression permanently deletes fine details, introduces structural noise, and causes models to overfit to compression artifacts. In a more comprehensive study we would evaluate how much the decision to hold the file type constant on human vs computer vision was a source of error.

3.5. Image Processing

Detection of terrace outlines proceeds through four sequential image processing stages applied to each map image.

3.5.1. Binarization

The greyscale image is converted to a binary (black-and-white) image using Otsu’s method, an algorithm that automatically selects an optimal threshold value by minimizing the variance of pixel intensities within the two resulting classes. This separates the dark ink lines of the map from the light paper background without requiring manual threshold selection. The result is a binary image where ink pixels are “True,” and background pixels are “False.”

3.5.2. Noise Filtering and Margin Removal

The binary image is cleaned through two operations. First, isolated small regions, connected groups of ink pixels smaller than a minimum area threshold, are removed. Specifically, circular blob-shaped regions with high compactness (eccentricity below 0.85 and solidity above 0.6) are removed as likely map symbols rather than terrace outlines. Second, a spatial margin filter identifies the extent of the meaningful map content by computing the union bounding box of all connected ink components whose area is at least 1% of the largest component’s area. Ink components whose centroid falls outside this bounding box (expanded by 30 pixels on each side) are removed. This step eliminates border annotations, map titles, and edge artefacts that lie outside the site plan area cleaned binary image is reduced to a one-pixel-wide skeleton using Zhang–Suen thinning, a standard morphological algorithm that iteratively removes border pixels from ink regions while preserving connectivity and the overall shape of lines. Skeletonization converts the variable-width pen strokes of the original map into single-pixel-width lines, which is necessary for the subsequent “contour detection” step to work correctly regardless of how thickly or thinly lines were drawn on the original map.

3.5.3. Contour Polygon Detection

The skeleton image is passed to OpenCV’s findContours function, which traces the boundaries of connected ink regions and returns them as ordered sequences of pixel coordinates. This is a standard computer vision technique for extracting closed shapes from binary images. The term used for these is “contours,” which is of course confusing, since maps can have elevation contours. A contour is simply a curve that joins continuous points along a boundary that share a value (i.e., same color or intensity), and thus, in computer vision, the polygons made are called “contour polygons.”
The pipeline uses hierarchical contour polygon detection, which additionally records the nesting relationships between contours: whether a given outline is enclosed within another. Contours smaller than 50 pixels2 in area are discarded as noise fragments. There is no upper area limit, allowing large terrace platforms to be detected. The nesting depth of each contour, how many other contours enclose it, is retained as a feature for the subsequent classification step.

3.6. Feature Extraction

Each candidate “contour polygon” is described by a vector of ten geometric and photometric features, which are used as inputs to the machine learning classifier (Table 1).
Table 1. Features used by the Random Forest classifier to distinguish terrace polygons from non-terrace candidates.
Feature names correspond to variable names in the pipeline code. All features are computed per candidate contour polygon from pixel coordinates and greyscale image values.

3.7. Machine Learning Classification

Candidate contours are classified as terrace or non-terrace using a Random Forest (RF) classifier. RF is an ensemble method that builds many decision trees, each trained on a random subset of the training data and a random subset of the features and combines their votes by majority rule. The use of many diverse trees makes the classifier robust to overfitting and to the presence of noisy training examples. The present model uses 200 trees (n_estimators = 200).
Because terrace polygons are outnumbered by non-terrace candidates on most maps (the approximate ratio across the training set is 1:2.2), the classifier uses balanced class weighting (class_weight = “balanced”), which automatically up-weights the minority (terrace) class during training to prevent the model from learning to predict “non-terrace” for everything.
The classifier is trained on the 35 training sites. For each training site, the pipeline runs the full image processing sequence described above, extracts features for all candidate contours, and assigns binary labels (terrace = 1, non-terrace = 0) by comparing each contour against the human ground truth (GT) polygons. A contour is labelled as a terrace if its polygon geometry overlaps a GT terrace polygon with an Intersection over Union (IoU) score of at least 0.5. IoU is defined as the area of the intersection divided by the area of the union of the two polygons; a threshold of 0.5 is a standard benchmark in computer vision, meaning that at least half of the combined area must be shared. The trained model is saved to disk and reused across pipeline runs to avoid unnecessary retraining. It is important to note that the way IoU is being used as a metric in training to help refine the model is separate from IoU as a metric for how well the predicted terraces match the maps, where the model is not given any human information (blind).
Initially, internal cross-validation uses stratified 5-fold cross-validation on the training set, reporting mean F1 score and standard deviation as an indication of model stability. While this was a helpful internal metric that led to improvements, it is important to note that a random cross-validation was not the best choice here. Our model was likely learning site-specific quirks in training and reusing them in validation. We upgraded to site-grouped folds (GroupKFold) to ensure that all polygons from a given site remained in a single fold to prevent data leakage. The updated site-grouped cross-validation F1 (mean 0.647) suggests the model generalizes reasonably consistently.
Style calibration and model training use the same 35 sites. The two tasks are separated in the pipeline: style calibration runs first and its outputs are saved; model training runs second and reads the calibration outputs. Both caches are invalidated and regenerated whenever the training site list changes.
Each predicted polygon is matched against the human GT polygons using one-to-one bipartite matching. Pairwise IoU scores are computed for all predicted–GT polygon pairs; the Hungarian algorithm then finds the globally optimal assignment. A pair is accepted as a true positive (TP) only if its IoU meets or exceeds 0.5. Each GT terrace and each predicted polygon participates in at most one match. Again, this is for the purpose of matching polygons, and different from IoU as an evaluation measure.
From these counts the pipeline computes, per site: Precision = TP/(TP + FP): the fraction of predicted terraces that correspond to a real terrace; Recall = TP/(TP + FN): the fraction of real terraces that were successfully detected; F1 score = 2 × Precision × Recall/(Precision + Recall): the harmonic mean of precision and recall, giving equal weight to both; Mean match IoU (mIoU): the mean IoU score across all matched TP pairs, measuring the spatial precision of correctly detected terrace; Global IoU (gIoU): the total intersection area divided by total union area across all matched pairs, a polygon-area-weighted spatial accuracy measure.
Aggregate metrics are computed across all blind test sites by pooling all TP, FP, and FN counts before calculating precision and recall. Mean F1 is the unweighted average of per-site F1 scores.

3.8. Outputs

For the “blind” test sites, the pipeline exports two products in addition to the tabular results report. A merged shapefile (blind_predictions.shp, EPSG:2193) contains all predicted terrace polygons with per-polygon attributes including site identifier, RF confidence score (the proportion of the 200 trees voting “terrace”), best-match IoU against the nearest GT polygon, true-positive flag, and site-level F1, precision, recall, mIoU, and gIoU scores. A PDF mapbook (blind_mapbook.pdf) provides one letter-format landscape page per site showing the map image with predicted polygons overlaid in cyan, a statistics panel, and a scale bar derived from the world file pixel dimensions. The purpose of the mapbook is to create a way to quickly examine the results outside of a GIS.

4. Results

Unlike most computer vision studies, our goal was not to discover and map new sites or features. Instead, we asked two basic questions: (1) How well did our computer vision (CV) model perform relative to the current benchmarks set by other computer vision studies? And, (2) Is the output sufficiently high quality to be used in quantitative studies in archaeology? To answer the second question, we looked at the Gini coefficient. We want to know if the CV-predicted dataset would be useful in evaluating the size distribution of terraces at sites, specifically based on a metric used to assess inequality through archaeological evidence.

4.1. General Performance Benchmarking

Compared with other CV studies, our model was a success in some regards and a failure in others (Table 2; Figure 9). When we check the “blind” results (blind in the sense that these were not maps used as training data) against human-mapped terraces, the mean intersection over union (mIoU) is extremely high (above 0.89). What that tells us is that when the predicted models mapped onto human-traced terraces, the model performed excellently in terms of the shape of the terrace and its location. The F1 score tells a different story. Detection performance, as measured by F1 scores, is moderate, with a mean of 0.528 (median = 0.588), but with an extremely wide range, from 0.800 to 0.00. Some sites were good (26%), with some poor but acceptable by CV standards (45%), and others that were failures, well below even the most generous thresholds (29%). If we break that down to the feature level, there are 227 true positive terraces, 176 false positives, and 181 false negatives. That means for every four terraces that are correctly found and drawn, there will be an additional three that show up somewhere that no terraces were drawn by a person, and three that were missed by the computer vision model. As we will see in the next section, this has real consequences for archaeological studies.
Table 2. Per-site terrace detection results on the 31 blind test sites, ordered by F1 score. Results use one-to-one bipartite matching (IoU ≥ 0.5).
Figure 9. Evaluation of blind predicted terraces. Mean intersection over union (mIoU) (y-axis) is in the excellent to near-perfect range, between 0.894 and 0.942, meaning that when the terraces were correct, they were solid matches. The F1 scores (x-axis) fall across F1 Tier thresholds: Excellent ≥ 0.85, Good ≥ 0.70, Acceptable ≥ 0.50, Below < 0.50.

4.2. Archaeological Benchmarking: Gini Coefficient Comparison

We compared the human-derived Gini coefficient to the predicted Gini coefficient to try and determine the degree to which the automated feature extraction introduces bias and/or noise. To be clear, the Gini coefficient (from 0.0 to 1.0) represents the variance in terrace sizes at a site. Higher scores mean more area within a few polygons. Lower scores mean a more even spread in the sizes of terraces.

4.2.1. Trends in Mean Gini Coefficient

Across the 30 blind sites that produced detections, the model-predicted terrace-area Gini coefficient was systematically lower than the value derived from the human-traced terraces. The mean predicted Gini was 0.275 against a ground-truth mean of 0.333, a mean signed difference of −0.057 that a Wilcoxon signed-rank test confirms is statistically significant (W = 128, p = 0.031). The same downward bias is visible in the training data, where the model under-predicts Gini by a similar margin, indicating that this is a property of the detection-and-measurement pipeline rather than an artifact of this specific blind sample. Because the Gini coefficient of a terrace assemblage is driven disproportionately by its largest members, the bias is consistent with a pipeline that tends to miss or under-size the small number of large terraces that generate inequality at a site.
The predicted Gini also compressed the range of values relative to the truth (Figure 10). The standard deviation of the predicted coefficients across sites was 0.104, against 0.144 for the ground truth—a reduction of roughly 28% (a predicted-to-true SD ratio of 0.72). The predicted values spanned 0.077 to 0.586, whereas the human-traced values spanned a wider range, 0.092 to 0.704. In other words, the model not only shifted the average downward but also pulled the extremes toward the center, flattening the high-inequality sites more than the low-inequality ones.
Figure 10. Distribution of predicted versus ground-truth Gini coefficients across the blind test sites. The model-predicted terrace-area Gini is both shifted downward (mean 0.275 vs. 0.333) and compressed in range relative to the human-traced ground truth, flattening high-inequality sites more than low-inequality ones. (A) Predicted vs. True Gini (per site); (B) Absolute Error (per site).
This attenuation is the more consequential of the two trends. The purpose of measuring the Gini coefficient is to capture variation in terrace-size inequality between sites, and a pipeline that compresses that variation actively erodes the signal it is meant to recover. A constant offset could in principle be corrected with a calibration factor, but a compression of the spread cannot be undone post hoc without site-specific information that, by definition, is unavailable at prediction time. The combination of a downward bias and a narrowed range therefore sets a ceiling on how faithfully the predicted Gini can reproduce real between-site differences, a limitation that the following sections quantify directly.

4.2.2. Absolute Error in Gini Coefficient

The absolute error in the predicted Gini, the unsigned difference between the predicted and ground-truth coefficient at each site, was, unsurprisingly, related to detection quality (F1 score) (Table 2). Sites with poorer detection tended to have larger Gini errors (Figure 11). The relationship, however, was not a smooth gradient. Rather than error rising steadily as F1 fell, the sites separated into two distinct populations with a sharp step between them, a structure better described by a two-level (step) model than by a linear fit.
Figure 11. Absolute error in the predicted Gini coefficient as a function of detection quality (F1 score). Error does not rise smoothly as F1 falls; instead, the sites separate into two populations with a sharp step near F1 = 0.53, where the high-F1 group (Good + upper Acceptable) has a smaller mean absolute error than the low-F1 group (lower Acceptable + Below).
A search for the breakpoint that best separates the two populations placed the division at an F1 of approximately 0.53, and a Mann–Whitney test confirmed that the error distributions on either side differ significantly. Important for this fit-for-purpose evaluation, it falls almost exactly on the boundary between the combined F1 Excellent–Good tiers and the Acceptable–Below tiers. The implication is that the pipeline does not degrade predictably as detection worsens; instead, sites in the upper tiers behave as one coherent group and those in the lower tiers as another, with comparatively little middle ground.
The magnitude of the difference between the two groups is large. The high-F1 group (Good + upper Acceptable, n = 18) had a mean absolute Gini error of 0.068 (95% CI [0.038, 0.097]), whereas the low-F1 group (lower Acceptable + Below, n = 12) had a mean error of 0.198 (95% CI [0.110, 0.285])—nearly three times higher (Figure 11). For context, the typical difference in true Gini between two sites is on the order of 0.144, so the low-F1 group’s average error alone exceeds a typical between-site difference, while the high-F1 group’s error remains below it. Detection quality, in this binary high-versus-low sense, is thus a strong determinant of whether a predicted Gini is fit for purpose.

4.2.3. Comparing Sites: Pairwise Rank Agreement

Mean error quantifies how close each predicted Gini is to the truth, but the question of practical interest is whether the predictions preserve the ordering of sites; in other words, whether the predicted values correctly judge between any two sites which is more unequal. We assessed this with pairwise rank agreement: for every pair of sites, we asked whether the predicted Gini placed them in the same order as the ground-truth Gini. A score of 100% means the model always agreed with the human result about which site of the pair was higher; any shortfall represents pairs where the predicted ordering was reversed (Figure 12).
Figure 12. Pairwise rank agreement between predicted and ground-truth Gini coefficients. For every pair of sites, agreement records whether the predicted Gini placed the two sites in the same rank order (higher/lower) as the human-traced ground truth. Overall agreement was 62%, but it collapsed to 50% (chance) within the low-F1 group and rose to roughly 89% for sites with F1 above 0.80.
Taken across all 30 sites, agreement was only 62%, meaning that more than a third of pairwise comparisons were reversed relative to the human-traced ground truth. Disaggregating by detection quality, however, shows that this poor overall figure conceals two very different trends. Within the low-F1 group, agreement collapsed to 50%, exactly chance, so that the predicted Gini carried essentially no information about which of two poorly-detected sites was the more unequal. Comparisons involving these sites are, in effect, no better than a coin toss.
Within the high-F1 group, the picture was considerably better, and improved further as detection quality rose. Restricting comparisons to the better-detected sites raised agreement substantially; for sites with F1 above roughly 0.70, the predictions reproduced the correct ordering about 86% of the time, and among the very best-detected sites agreement approached unanimity. The predicted Gini is therefore usable for ranking sites, but only conditionally: reliable between-site comparison requires that both sites fall in the high-F1 group, and confidence in the comparison scales with how well each site was detected. Comparisons that reach into the low-F1 group should not be made based on the predicted coefficient.

4.2.4. Uncertainty in Gini Coefficient: Bootstrap

To characterize the uncertainty in each site’s Gini coefficient, we used a bootstrap, resampling the terraces at each site 2000 times to generate a 95% confidence interval for both the predicted and the ground-truth Gini, and classifying a site as being in poor agreement when these two intervals did not overlap (Figure 13). This approach is related to, but not the same as, the sampling-based treatment of Crema et al. [42]; it is closer in spirit to the confidence-interval-overlap criterion used by Thompson et al. [43] to judge whether two Gini estimates are distinguishable. It provides a per-site, distributional test of agreement that complements the point-error and rank analyses above.
Figure 13. Bootstrap uncertainty in the per-site Gini coefficient. Terraces at each site were resampled 2000 times to generate 95% confidence intervals for the predicted and ground-truth Gini; a site is flagged when the two intervals do not overlap. The procedure flagged six suspect sites: three robustly poor and three borderline, all but two falling in the low-F1 group.
The procedure flagged six suspect sites. Three of these were robustly poor, failing the overlap test consistently across resampling, while the remaining three were poor, but borderline, flipping in and out of poor agreement depending on the random state of the bootstrap (Figure 13). It should be stressed that this is a relatively generous criterion. Interval overlap tends to understate disagreement, and yet a non-trivial number of sites still fail it, which underscores how much of the assemblage is not being reliably reproduced.
As with absolute error and rank agreement, the F1 grouping drove the result. In the high-F1 group, about 17% of sites (3 of 18) were flagged as borderline and none as robustly poor, whereas in the low-F1 group, fully 33% (4 of 12) were flagged as poor or borderline. Critically, however, the two borderline high-F1 sites (Table 3) demonstrate that good detection does not guarantee a reliable Gini: a site can score well on F1 yet still produce a Gini whose confidence interval fails to overlap the truth, because the specific terraces it misses are the ones that govern the shape of the size distribution.
Table 3. Gini results on the 31 blind test sites, ordered by F1 score.
These relationships are summarized together in Figure 14, which overlays the three diagnostics developed in this section onto the high- and low-F1 partition: the good-versus-poor match in absolute delta-Gini, the best pairwise rank agreement (the top ten sites by F1), and the mismatches identified as borderline or poor in the bootstrap. Read together, the three views converge on the same conclusion: fitness-for-purpose of the predicted Gini is governed primarily by detection quality, that the high- and low-F1 groups behave as qualitatively different populations, and that a small number of well-detected sites nonetheless remain unreliable for inequality measurement.
Figure 14. Errors in predicted terraces at site V21/73. This site from the “blind” dataset is a good example of how a result can have a high mean Intersection over Union (in this example, mIoU = 0.909), a good F1 (in this example, 0.778), but still be misleading for a study using the Gini coefficient, which looks at the difference in terrace sizes. The ground truth Gini is low since terraces are close to the same size (Gini 0.103), as is the predicted Gini (0.168), but it is nonetheless a 63% greater inequality than our estimate based on human tracing of terraces.

5. Discussion

The study set out with two goals. First, to show how a custom computer vision pipeline can be rapidly created with the help of an LLM. Second, to conduct a simple fit-for-purpose test to evaluate whether its output is good enough to support quantitative archaeological analysis. The results, in our view, show that general CV measures are useful but not sufficient for archaeology. Crucially, our fit-for-purpose test was not a single evaluation but a sequence of them: (1) direct comparison of Gini coefficient, (2) absolute error, (3) pairwise rank agreement between sites, and (4) bootstrap uncertainty. This layered approach exposed structure a single evaluation would have hidden, including two apparent natural breakpoints in detection quality with distinct practical meanings.
The two important detection quality thresholds emerged from different evaluations that carry different operational meaning. The first, near F1 = 0.53, divides sites into a higher-quality population (Good and upper Acceptable tiers) whose predicted Gini is broadly trustworthy and a low-quality population (lower Acceptable and Below) whose predicted Gini is not. The second, near F1 = 0.80, emerged specifically from the pairwise rank-agreement test and marks where the predictions become reliable enough to compare one site against another. The practical gain of holding to the stricter 0.80 standard is therefore not better absolute estimates so much as the ability to make defensible between-site comparisons. Our discovery of two thresholds, rather than a single pass/fail line, in our view, is something that we can expect to be commonplace when fitness-for-purpose is evaluated from several angles instead of one.
The most important methodological lesson is this: had we evaluated this pipeline using only conventional CV benchmarks, reporting the excellent mIoU and marginally successful F1 scores, we would have concluded that the method was a success and proceeded to analyze the resulting terrace dataset. The discipline-specific metric reveals that, in a genuinely blind application, we would have generated unreliable data without any indication from the standard benchmarks that something was wrong. This is a general caution for AI-assisted archaeology. Performance metrics inherited from computer vision measure whether a model reproduces a human annotation, not whether the resulting data can bear the inferential weight an archaeological argument places on it. As workflows increasingly incorporate automated feature extraction, fitness-for-purpose must be assessed against the specific use to which the data will be put.
It is worth being explicit about why the standard benchmarks gave no warning. Looking over the mapbook output (see Supplemental Materials), it is easy to see different sources of error (see Figure 14). In some cases, real features on the map were predicted to be terraces. We anticipated that this might happen given there are plenty of non-terrace features that have similar qualities, but we wanted to see how much of a problem that would present to the CV pipeline. In other cases, features were missed, often small terraces, especially close to other terraces or represented in an incomplete fashion. We worked through several versions of the pipeline to make sure that we were not getting single terraces represented by more than one polygon. We did not fully succeed. How does the lesson learned here impact how we deploy a pipeline like this for genuine site detection? The procedure would be exactly the one we follow here, but with roles reassigned: the blind comparison set becomes a validation set held against human-traced ground truth, used not to tune the model but to estimate how fit-for-purpose its output is likely to be on the new, unverified maps that follow. Rather than reporting a single accuracy figure, such a deployment would carry forward the fit-for-purpose profile measured on validation. For this specific case, that would be the F1 thresholds at which estimates and between-site comparisons become trustworthy. Those become a confidence framework for the newly extracted data. In effect, the validation step estimates how much of the new results we can believe before seeing their ground truth.
Finally, we stress that there is no single fitness-for-purpose test, because archaeology is done for many purposes, and each implies its own standard. The Gini coefficient was the right yardstick here because our intended analysis was the size distribution of terraces, but a different goal would demand a different evaluation. If the purpose were conservation, the relevant test might be how well predicted features align with the footprint of current or planned modern infrastructure (roads, buildings, utilities). The question then becomes whether the extracted data is accurate enough to flag what is at risk. If the research question required a spatial statistic such as nearest-neighbor distance, or another measure of arrangement, the evaluation would instead be scaled to that statistic’s sensitivities. The general principle is that the fitness-for-purpose test should be chosen to match the measurement the data must ultimately support, and we expect the archaeological community will need a family of such tests rather than any one of them.
While we hope these results will serve as a model for others looking to do similar work with legacy archaeological maps, we do want to highlight several limitations that qualify these findings. We built a “gate” early in the pipeline to filter out maps that did not fit the drawing conventions used on most of the other maps. Specifically, our pipeline deliberately excludes maps drawn in dashed-line or hachure conventions, and clean GIS-rendered plans, so the reported figures do not describe the worst results we got in the development stage. In addition, in our comparison we treat the human heads-up digitization as “ground truth,” but there will be inter-analyst variation in manual digitizing. In a larger study, we would have quantified inter-observer error. That would, in part, help create empirical bounds on the benchmark targets used to assess an automated method. Also, our selection of maps was based mainly on the availability of human-created data, which represent less than 1% of the known fortified settlements in Aotearoa New Zealand. Thus, our benchmarks do not, and could not, come close to capturing the variety of sites, mapping styles, and other factors necessary to fully evaluate this one site type. We also recognize that there are approaches to classified data that we did not explore here, such as Data Augmentation. That type of workflow holds a lot of potential, and was certainly something we considered, but felt more appropriate for the next scale above this level of test. Finally, it should be said that there are probably underlying conditions that cause the thresholds we describe; however, without a much larger sample size, we are unable to speculate what those are or how they might be overcome.

6. Conclusions

This case study set out to do two things: (1) to illustrate how a custom computer vision pipeline can now be assembled with the help of a large language model, and (2) to evaluate if the result is fit for the archaeological research purpose we had in mind. By the standards of the wider computer vision literature, the pipeline succeeds: matched detections reproduce terrace shape and position with near-human spatial fidelity (mIoU 0.89–0.94), and at many sites the model performed acceptably in precision and accuracy (F1). By the standard that matters for our intended analysis, it does not. Detection error made the Gini coefficient based on extracted features unreliable without ample warning from the conventional metrics that anything was wrong. Because we evaluated fitness-for-purpose from several angles rather than one, we could be specific about where different quality boundaries fall: predicted Gini coefficients become usable as site-level estimates above an F1 of about 0.53, but become reliable enough to compare one site against another only above roughly 0.80. The two thresholds reflect two different uses of the same data revealed by layered evaluation.
The lesson is, for archaeology, standard computer vision metrics are necessary but not sufficient for evaluating AI-assisted datasets. Benchmarks such as IoU and F1 measure whether a model reproduces a human annotation; they do not measure whether the resulting data can bear the inferential weight we might place on it. Importantly, that use is going to vary from case to case. As automated feature extraction becomes a routine part of archaeological workflows, fitness-for-purpose should be assessed directly, against the specific use to which the data will be put, using discipline-relevant measures of the kind demonstrated here.
We see the greatest near-term value of human-in-the-loop workflows, in which a pipeline of this kind rapidly proposes candidate features for expert verification, pairing the speed of automation with the reliability that quantitative archaeology requires. More broadly, we hope this study encourages the development of shared, discipline-specific fitness-for-purpose benchmarks, so that the coming wave of AI-assisted geospatial datasets can be evaluated not only for how well they imitate human mapping, but for whether they can answer the questions archaeologists ask. In such a deployment the blind comparison we report here becomes a validation step, profiling in advance how far the newly extracted data can be trusted before any of it is checked by hand. And because archaeological questions are many, we expect no single benchmark will suffice.

Supplementary Materials

The following supporting information can be downloaded at https://www.mdpi.com/article/10.3390/heritage9080327/s1. Supplemental Materials include Python code and GIS data (shapefiles), and a PDF with details on the human digitized terraces and the predicted terraces mapbook.

Author Contributions

Conceptualization and design, M.D.M.; implementation, M.D.M. and H.M.; writing—original draft, writing—review and editing, M.D.M. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

Data available in Supplementary Materials.

Acknowledgments

We thank Thegn N. Ladefoged and Mark W. Allen for comments on an early draft and members of H.M.’s honors committee: K. Ann Horsburgh and Elizabeth Murphy. Many of these maps would not exist if not for Ngāti Kahungunu Iwi, and we want to acknowledge their mahi (work) here, specifically mapping by Robert Hunter. Elsie McCoy provided valuable technical expertise. Claude version 1.14271.0 was used for Python coding and preparing descriptions and illustrations of the methods. We thank three reviewers whose comments both helped significantly improve the manuscript and identified a systematic error in our initial calculations.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Berganzo-Besga, I.; Orengo, H.A.; Lumbreras, F. Best practices for the application of computer vision-based machine learning in archaeology. J. Archaeol. Sci. 2026, 191, 106577. [Google Scholar] [CrossRef] [Scilit]
  2. Grigorescu, S.; Trasnea, B.; Cocias, T.; Macesanu, G. A survey of deep learning techniques for autonomous driving. J. Field Robot. 2020, 37, 362–386. [Google Scholar] [CrossRef] [Scilit]
  3. Litjens, G.; Kooi, T.; Bejnordi, B.E.; Setio, A.A.A.; Ciompi, F.; Ghafoorian, M.; van der Laak, J.A.W.M.; van Ginneken, B.; Sánchez, C.I. A survey on deep learning in medical image analysis. Med. Image Anal. 2017, 42, 60–88. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  4. Wang, M.; Deng, W. Deep face recognition: A survey. Neurocomputing 2021, 429, 215–244. [Google Scholar] [CrossRef] [Scilit]
  5. McCoy, M.D.; Birch, J.; Chirikure, S.; Cruz, P.; Green, A.S.; Gronenborn, D.; Lawrence, D.; Roscoe, P. War both reduced and increased inequality over the past ten thousand years. Proc. Natl. Acad. Sci. USA 2025, 122, e2400695121. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  6. Kohler, T.A.; Bogaard, A.; Ortman, S.G. Introducing the Special Feature on housing differences and inequality over the very long term. Proc. Natl. Acad. Sci. USA 2025, 122, e2401989122. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  7. Fochesato, M.; Bogaard, A.; Bowles, S. Comparing ancient inequalities: The challenges of comparability, bias and precision. Antiquity 2019, 93, 853–869. [Google Scholar] [CrossRef] [Scilit]
  8. Peterson, C.E.; Drennan, R.D. Letting the Gini out of the bottle: Measuring inequality archaeologically. In Ten Thousand Years of Inequality: The Archaeology of Wealth Differences; Kohler, T.A., Smith, M.E., Eds.; University of Arizona Press: Tucson, AZ, USA, 2018; pp. 39–66. [Google Scholar]
  9. The Mismeasure of Human History? Available online: https://www.stone-econ.org/news-and-blogs/the-mismeasure-of-human-history (accessed on 22 June 2026).
  10. Bickler, S.H. Machine Learning Arrives in Archaeology. Adv. Archaeol. Pract. 2021, 9, 186–191. [Google Scholar] [CrossRef] [Scilit]
  11. Bellat, M.; Figueroa, J.D.O.; Reeves, J.S.; Taghizadeh-Mehrjardi, R.; Tennie, C.; Scholten, T. Machine Learning Applications in Archaeological Practices: A Review. J. Comput. Appl. Archaeol. 2025, 8, 282–321. [Google Scholar] [CrossRef] [Scilit]
  12. Caspari, G.; Crespo, P. Convolutional neural networks for archaeological site detection—Finding “princely” tombs. J. Archaeol. Sci. 2019, 110, 104998. [Google Scholar] [CrossRef] [Scilit]
  13. Verschoof-van der Vaart, W.B.; Lambers, K. Learning to look at LiDAR: The use of R-CNN in the automated detection of archaeological objects in LiDAR data from the Netherlands. J. Comput. Appl. Archaeol. 2019, 2, 31–40. [Google Scholar] [CrossRef] [Scilit]
  14. Landauer, J.; Maddison, S.; Fontana, G.; Posluschny, A.G. Archaeological site detection: Latest results from a deep learning based Europe-wide hillfort search. J. Comput. Appl. Archaeol. 2025, 8, 42–58. [Google Scholar] [CrossRef] [Scilit]
  15. Canedo, D.; Fonte, J.; Dias, R.; do Pereiro, T.; Gonçalves-Seco, L.; Vázquez, M.; Georgieva, P.; Neves, A. Automated detection of hillforts in remote sensing imagery with deep multimodal segmentation. Archaeol. Prospect. 2025, 32, 297–311. [Google Scholar] [CrossRef] [Scilit]
  16. van der Maaten, L.; Boon, P.; Lange, G.; Paijmans, H.; Postma, E. Computer vision and machine learning for archaeology. In Digital Discovery: Exploring New Frontiers in Human Heritage. CAA2006; Clark, J.T., Hagemeister, E.M., Eds.; Archaeolingua: Budapest, Hungary, 2007; pp. 476–482. [Google Scholar]
  17. Anichini, F.; Dershowitz, N.; Dubbini, N.; Gattiglia, G.; Itkin, B.; Wolf, L. The automatic recognition of ceramics from only one photo: The ArchAIDE app. J. Archaeol. Sci. Rep. 2021, 36, 102788. [Google Scholar] [CrossRef] [Scilit]
  18. Berganzo-Besga, I.; Orengo, H.A.; Lumbreras, F.; Alam, A.; Campbell, R.; Gerrits, P.J.; de Souza, J.G.; Khan, A.; Suárez-Moreno, M.; Tomaney, J.; et al. Curriculum learning-based strategy for low-density archaeological mound detection from historical maps in India and Pakistan. Sci. Rep. 2023, 13, 11257. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  19. Garcia-Molsosa, A.; Orengo, H.A.; Lawrence, D.; Philip, G.; Hopper, K.; Petrie, C.A. Potential of deep learning segmentation for the extraction of archaeological features from historical map series. Archaeol. Prospect. 2021, 28, 187–199. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  20. McCoy, M.D.; Asner, G.P.; Graves, M.W. Airborne lidar survey of irrigated agricultural landscapes: An application of the slope contrast method. J. Archaeol. Sci. 2011, 38, 2141–2154. [Google Scholar] [CrossRef] [Scilit]
  21. Sofia, G.; Marinello, F.; Tarolli, P. A new landscape metric for the identification of terraced sites: The Slope Local Length of Auto-Correlation (SLLAC). ISPRS J. Photogramm. Remote Sens. 2014, 96, 123–133. [Google Scholar] [CrossRef] [Scilit]
  22. Capolupo, A.; Kooistra, L.; Boccia, L. A novel approach for detecting agricultural terraced landscapes from historical and contemporaneous photogrammetric aerial photos. Int. J. Appl. Earth Obs. Geoinf. 2018, 73, 800–810. [Google Scholar] [CrossRef] [Scilit]
  23. Tubog, M.V.; Emsellem, K.; Bouissou, S. Detection of Agricultural Terraces Platforms Using Machine Learning from Orthophotos and LiDAR-Based Digital Terrain Model: A Case Study in Roya Valley of Southeast France. Land 2025, 14, 962. [Google Scholar] [CrossRef] [Scilit]
  24. Zhao, F.; Xiong, L.Y.; Wang, C.; Wang, H.R.; Wei, H.; Tang, G.A. Terraces mapping by using deep learning approach from remote sensing images and digital elevation models. Trans. GIS 2021, 25, 2438–2454. [Google Scholar] [CrossRef] [Scilit]
  25. Lu, Y.; Li, X.; Xin, L.; Song, H.; Wang, X. Mapping the terraces on the Loess Plateau based on a deep learning-based model at 1.89 m resolution. Sci. Data 2023, 10, 115. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  26. Ciglič, R.; Glušič, A.; Štaut, L.; Čehovin Zajc, L. Towards the deep learning recognition of cultivated terraces based on Lidar data: The case of Slovenia. Morav. Geogr. Rep. 2024, 32, 66–78. [Google Scholar] [CrossRef] [Scilit]
  27. Gravel-Miguel, C.; Snitker, G.; Hirniak, J.N.; Peck, K.; Fetterhoff, A. Semantic Segmentation of Archaeological Features on Public Lands: Case Study of Historical Cotton Terraces within the Piedmont National Wildlife Refuge, Georgia, USA. Adv. Archaeol. Pract. 2025, 13, 291–314. [Google Scholar] [CrossRef] [Scilit]
  28. Zhao, Y.; Zou, J.; Liu, S.; Xie, Y. Terrace Extraction Method Based on Remote Sensing and a Novel Deep Learning Framework. Remote Sens. 2024, 16, 1649. [Google Scholar] [CrossRef] [Scilit]
  29. Wang, Y.; Liu, C.; Tiwari, A.; Silver, M.; Karnieli, A.; Zhu, X.X.; Albrecht, C.M. Deep Semantic Model Fusion for Ancient Agricultural Terrace Detection. In Proceedings of the 2022 IEEE International Conference on Big Data, Big Data, Osaka, Japan, 17–20 December 2022; IEEE: Piscataway, NJ, USA, 2022; pp. 4888–4892. [Google Scholar]
  30. Peker, E.A. Deep Learning–Based Detection of Ancient Agricultural Terraces Using Multisensor Data Fusion: A Case Study from the Bozburun Peninsula, Turkey. Adv. Archaeol. Pract. 2026, 14, 198–217. [Google Scholar] [CrossRef] [Scilit]
  31. Davidson, J.M. The Prehistory of New Zealand; Longman Paul: Auckland, New Zealand, 1984. [Google Scholar]
  32. Golson, J.; Green, R.C. A Handbook to Field Recording in New Zealand; New Zealand Archaeological Association: Auckland, New Zealand, 1958. [Google Scholar]
  33. Irwin, G. Land, Pa and Polity: A Study Based on the Maori Fortifications of Pouto, New Zealand; New Zealand Archaeological Association: Auckland, New Zealand, 1985. [Google Scholar]
  34. Schmidt, M. The Commencement of Pa Construction in New Zealand Prehistory. J. Polyn. Soc. 1996, 105, 441–460. [Google Scholar]
  35. Barber, I.G. Culture Change in Northern Te Wai Pounamu. Ph.D. Thesis, University of Otago, Dunedin, New Zealand, 1994. [Google Scholar]
  36. Allen, M.W. Warfare and Economic Power in Simple Chiefdoms: The Development of Fortified Villages and Polities in Mid-Hawke’s Bay, New Zealand. Ph.D. Thesis, University of California, Los Angeles, CA, USA, 1994. [Google Scholar]
  37. Watson, T. GPS use and archaeological site recording. Archaeol. N. Z. 2002, 4, 293–296. [Google Scholar]
  38. Allen, M.W.; Tomoana, N. The Chiefdom of Hāwea Whakapapa (Genealogy) and Fortifications in Heretaunga, New Zealand. In Warfare and the Dynamics of Political Control; Billman, B.R., Ed.; University of Arizona Press: Chicago, IL, USA, 2025; pp. 45–64. [Google Scholar]
  39. Allen, M.W.; Tomoana, N.; August, S.; Moore, W. Māori Archaeology and History of Heretaunga, New Zealand Six Centuries of Power and Place; Springer: New York, NY, USA, 2024. [Google Scholar]
  40. Kohler, T.A.; Bogaard, A. World Prehistory of Wealth Inequality. In Proceedings of the National Academy of Sciences, Santa Fe, NM, USA, 14 April 2025. [Google Scholar]
  41. Hannah, M. Visible Wealth in Past Societies: A Case Study of Domestic Architecture in Fortified Settlements in Aotearoa New Zealand 2025. Undergraduate Honors Thesis, Florida State University, Tallahasse, FL, USA, 2025. [Google Scholar]
  42. Crema, E.R.; Fochesato, M.; Mejía Ramón, A.G.; Munson, J.; Ortman, S.G. Toward multiscalar measures of inequality in archaeology. Proc. Natl. Acad. Sci. USA 2025, 122, e2400700121. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  43. Thompson, A.E.; Feinman, G.M.; Prufer, K.M. Assessing Classic Maya multi-scalar household inequality in southern Belize. PLoS ONE 2021, 16, e0248169. [Google Scholar] [CrossRef] [Scilit] [PubMed]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.