Towards the analysis of coral skeletal density-banding using deep learning

X-ray micro–computed tomography (µCT) is increasingly used to record the skeletal growth banding of corals. However, the wealth of data generated is time consuming to analyse for growth rates and colony age. Here we test an artificial intelligence (AI) approach to assist the expert identification of annual density boundaries in small colonies of massive Porites spanning decades. A convolutional neural network (CNN) was trained with µCT images combined with manually labelled ground truths to learn banding-related features. The CNN successfully predicted the position of density boundaries in independent images not used in training. Linear extension rates derived from CNN-based outputs and the traditional method were consistent. In the future, well-resolved 2D density boundaries from AI can be used to reconstruct density surfaces and enable studies focused on variations in rugosity and growth gradients across colony 3D space. We recommend the development of a community platform to share annotated images for AI. AI can help facilitate the expert identification of coral density boundaries in well-resolved regions following minimal training. AI can be used to automate and upscale non-destructive coral density-banding analysis across museum collections. Holistic analyses of coral density banding are central to understand coral growth responses to changing environments. AI can help facilitate the expert identification of coral density boundaries in well-resolved regions following minimal training. AI can be used to automate and upscale non-destructive coral density-banding analysis across museum collections. Holistic analyses of coral density banding are central to understand coral growth responses to changing environments.


Introduction
Here we introduce a novel technique based on artificial intelligence (AI) for skeletal density boundary detection in coral colonies at fine spatial scales (0.01 mm) using supervised machine learning in the form of a convolutional neural network (CNN) architecture. Many massive scleractinian corals deposit skeletal material cumulatively as annual band couplets of higher and lower density. The growth rate characteristics of a specimen can then be quantified by (1) the width of subsequent pairs of low-or high-density ('linear extension rate'; mm/ yr) and (2) the mass of CaCO 3 deposited over a year per area ('calcification rate'; g/cm 2 yr), which is the product of (3) skeletal density (g/cm 3 ) and annual extension rate, reviewed in Lough [1]. Records of linear extension, calcification and skeletal densities capture the life history of the individual colony. When averaged over many individuals, these skeletal growth records provide a population-wide response to changes on reefs and regional environmental gradients [2][3][4].
Traditionally, linear extension rates were measured from 2D X-ray positive prints of thinly-slabbed colonies and skeletal density via gravimetric and liquid displacement methods [5]. The need for large-scale population and regional studies involving hundreds of specimens led to the development of 1D gamma-densitometry analysis on sliced specimens [6], although data collection was still time consuming and reliant on the cumulated density measured through a thick slab to enhance the banding features [7]. More recently, with the advance of non-destructive X-ray computed tomography (CT) scanning techniques, it is possible to digitally reconstruct entire coral cores and colonies in 3D [8] without physically cutting through the skeleton. When calibrated with appropriate CaCO 3 standards, CT scanning can be used to determine absolute skeletal density. However, sample processing and data extraction remain time consuming and requires expertise to interpret the topological features of coral skeletons. Therefore, while the volume of data collected per specimen has increased and represents valuable information of 3D colony growth rate characteristics, the applied measurements remain manual [9,10].
Further advances with the development of X-ray micro-computed tomography (µCT ), means even greater potential to understand coral skeletal growth. For example, 3D-resolved density surfaces from highresolution µCT reconstructions could be used to quantify surface rugosity metrics as the colony ages, define the interaction between individual corallites and density boundary surfaces, or the volume of material deposited between density layers across a whole colony. However, all these advances require the analysis of a large volume of virtual slices, and demand image analysis beyond tracing a smoothed density boundary generated by averaging through a thickness equivalent to a traditional planar 2D slab.
Here we explore AI outputs to define density boundaries and estimate linear extension rates of independent virtual slices of Porites colonies (i.e. not used during CNN training). Additionally, we qualitatively demonstrate how our 1-voxel slice-trained CNN would perform on a digitally reconstructed mm-thick slab. With this approach, the community will be able to more efficiently tackle the labourintensive and time-consuming aspects of coral density surface analysis. When coupled with the human expertise required for quality control and output interpretation, supervised machine learning would enable studies involving a high volume of samples and an enhanced analysis of coral growth datasets.

Coral micro-CT datasets
High resolution 3D µCT (Nikon X-TEK 225) scans of three massive Porites coral colonies from the collection of the Natural History Museum, London, were used as the primary data source for the study and are described in Summerfield [11] (see SI, Table S1). 2D slices were extracted from raw scans using Thermo Scientific Avizo 2019.4 software and stored as PNG 16-bit greyscale images. Selected slices were manually labelled using the open-source software GIMP (https:// www. gimp. org) to produce binary masks for training (Figs. 1 and S1). This process involved tracing one-pixel white curves to mark each density boundary against a black background. Each slice and its binary mask were broken down into 256 × 256-pixel patches using a sliding window technique. The pool of patches was separated into training, testing and validation sets. Extensive online augmentation was used to artificially expand the variance contained in the training portion of the dataset during learning ( Fig. 1; see SI Figs. S6-S7 therein).

Deep learning architecture and training
We used a Keras-based Python implementation of the U-Net architecture [12] as our backbone convolutional neural network (CNN). The network design consists of three sections: a contracting path, a central bottleneck and an expanding path (Fig. 1). The contracting path follows the typical architecture of a convolutional network, where the image is gradually down-sampled via convolutional and max-pooling layers, whilst the number of feature channels is increased. The expansion path gradually reconstructs the image via up-convolutions. Backed by an ablation study, we opted to remove feature inputs from the contracting layers to the expanding layers, leading to a smaller network producing smoother boundary estimations (see SI). Learning was performed on Nvidia P100 Pascal GPU nodes. A grid search technique was used to find a locally optimal set of hyperparameters. The network was trained using the Adam optimiser [13] with a learning Fig. 1 Workflow of coral density-band detection using µCT slices and deep learning. Diagram showing how µCT images are processed for training, the cross-validation path and how predictions on unseen independent samples are produced by the CNN (dashed arrow pathway). First element is the 3D volume rendering of the colony. The grey rectangle 'cuts' the volume, producing a digital slice shown on the right. The 2D slice is a negative image (brighter pixels correspond to higher density skeletal material) which is manually labelled by an expert and both the 2D slice and the labels are broken into small 256 × 256-pixel patches via a sliding window to then be used for training. Corresponding slice patches and manual patches are augmented the same way before entering the training loop (see SI for more)

Coral linear extension estimates from AI and manual approaches
Density boundary predictions were transformed into single-pixel-wide curve segments by binarisation using Otsu's method [14] followed by skeletonisation using Zhang's method [15] (Fig. S1). Annual linear extension rates were calculated as the average distance between each of the pixels of one boundary to the closest pixel on the second predicted single-pixel boundary. Averaging across these measurements gave an estimate of annual linear extension. Areas containing well-predicted bands were selected for direct comparison with traditional manual 1D point measurements (Regions of interest, ROIs; Fig. 2). Manual estimates in ROIs were based on high-resolution µCT slices exported from AVIZO 2019.5 and analysed using the image processing package FIJI [16]. Straight transects were traced for each couplet using the 'Straight Line' tool to extract mean lengths in pixels. Annual linear extension rates were obtained by converting pixel size to mm as given by µCT metadata for each scan. AI-based and human-based estimates of linear extension rates for each slice are available in Table S2 (see SI). The significance of any difference between methods was tested using a 2-tailed paired-t test for the nine paired ROIs.

Results and discussion
The CNN was successfully trained to identify density transitions in thin (0.07-0.10 mm thickness) digital slices of < 10 year-old massive Porites colonies from µCT scans (Figs. 2 and S1). The reliability of the predictions is demonstrated by the portions of the slices where reconstructed density band boundaries are well resolved (Fig.  S1a, b) and continuous across the mosaic formed by individual patches (Fig. 2). However, we also show examples of poorer resolution (Fig. S1d) and disagreement with manually labelled banding (Figs. 2 and S1e) which highlight current limitations. In particular, the shortest band lengths within a patch were often miss-identified, presumably due to lack of adjoining information and topological complexity of the samples. Topological artefacts occurred 10  for a variety of reasons including µCT resolution, lack of training across different topologies, and biases in the network towards certain features given the small number of specimens.
Our preliminary investigation reveals promising concordance between manual and AI-derived measurements. For example, no significant difference was found between the mean linear extension rates calculated from CNN boundary predictions and independent manual point estimates (ROIs, Fig. 2; paired t-test, t (9) = 1.98, p = 0.08). The mean values measured by the two approaches were also significantly correlated (R 2 = 0.90) with no evidence of bias (Table S2; Fig. S5). Colony age estimates for RS0030 (Fig. 2a) were ~ 8 years according to CNN density band couplets and within error of manual counts by independent recorders (age estimate 5-7 years) given that small colonies are not the simplest growth structures to interpret [11], and that independent dating methods show typical errors of ± 2 years per century [17]. The only observed difference was that AI-based extension rate measurements were less variable than those estimated manually (Table S2; Fig. S5), which suggests the new technique could improve the precision of coral growth measurements. Further investigations with multi-expert annotations, ablation studies and significantly larger data volumes are needed to identify both cause and significance for linear extension estimates.
AI can help generate new data required for novel insights into coral growth. Deep learning applied to 2D density-band detection allows time effective analysis of growth measures across the whole specimen in contrast to selecting an optimal growth axis for targeted measurement. This holistic approach would increase representativeness of the data by deriving entire colony extension and calcification rates across a contiguous layer that could be used in reef carbonate production estimates. Moving forward, the advancement of the technique into 3D would allow data from adjacent slices to be factored in to record a density-layer volume, further refining extension estimates for the colony within a single year. There is also potential for generating additional information on, for example, variability in width and rugosity of a single band couplet around the colony itself. Such metrics might be more representative of how growth of massive coral colonies respond to environmental conditions. This is especially true in small colonies where multiple growth axes occur within close proximity and density-banding features can be complex. Although our approach is to predict density boundaries on single pixel slices along the maximum vertical growth axis of the colony, we also present an example of how the CNN performs on a reconstructed 3 mm-thick slab, which is an ideal thickness to capture corallite growth presentation for visualising annual banding in massive Porites species [18,19] (Fig. 2d and; see also SI Fig S8 and  discussion therein).
Other research fields reliant on chronological techniques are also employing deep learning to detect banding in layered structures, such as fish otoliths [20,21], glacial deposits [22] and tree-rings [23][24][25]. These studies used different methods to generate and pre-process training images as well as varying architectures. For instance, the proposed tree-ring implementation [24] suggests optimal prediction of band position when input images containing only the V component of the HSV colour space are used, whereas the CNN designed by Moen et al. [21] to specifically predict otolith age from colour photographs indicated input images could be stretched or shrunk without affecting age estimates. Further adapting these observations could improve coral-density banding detection and colony age estimation. These studies face similar challenges moving forward regarding expanding labelled datasets for training and increasing input resolutions. Tackling these challenges in a cross-disciplinary approach might be a valuable collective exercise towards gathering labelled training datasets more effectively. CNN training with a larger, more heterogeneous population of coral specimens is likely to improve feature extraction and the precision of boundary predictions. Robust coral band dating from AI approaches will also require a much larger training set to systematically deal with potential errors such as stress bands (i.e. biannual banding or multiple thin high-density bands), growth hiatuses and endobionts. Expert knowledge must be used, especially during further fine tuning by implementing frequent quality control checks, where false positives can be penalised for example.
This first attempt towards automating density boundary identification and deriving growth measures of coral from µCT data confirms that: 1) density transitions are detectable at high resolution and 2) deep learning could potentially speed up density-banding analysis and significantly enhance the data generated. As this preliminary approach continues to develop, it can become an auxiliary tool to support the expert community in the identification of bands over the entire skeleton and across a greater number of specimens, thus opening up new perspectives for coral research. Our results demonstrate that the CNN can perform as well as the human-trained eye in detecting the position of density-bands in well-resolved regions. However, limited training data led to the network struggling to confidently predict density boundaries in areas of higher topological complexity. The technique could rapidly move forward with the establishment of a collaborative platform where the coral research community shares expert-labelled µCT and X-ray images for the development of future AI applications. Availability of data and materials Coral micro-CT raw data are available from the Natural History Museum data portal. Registration numbers NHMUK 2001.6090, NHMUK 1937.11.17.674 and NHMUK 1937.11.17.613, specimens hereby identified as scans RS0030, RS0128 and RS0116 respectively.

Code availability
The AI implementation is publicly available on https:// github. com/ ainsl eyrut terfo rd/ deep-learn ing-coral-analy sis. Training, validation and independent testing sample data are also included.

Declarations
Conflict of interest The authors declare that there are no competing interests.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http:// creat iveco mmons. org/ licen ses/ by/4. 0/.