Testing the detection of large, secretive snakes using camera traps

Novel technologies, such as camera traps, have expanded the opportunities for species detection, especially for rare species. Corresponding changes in data processing must occur to handle the large volume of data gathered from technology like camera traps. Automated image data processing, usually by running images through different types of computer algorithms, is an overarching goal to reduce the number of images that researchers must manually review. However, differences in camera trap setups

A common goal of both PIR and time-lapse triggered camera trapping techniques is to maximize the number of true positive detections and minimize the number of false negative detections (i.e., misses) for the target species. A criticism of PIR techniques is that success is dependent on camera sensor performance, which has been shown to be impacted by a variety of factors, including vegetation density, background surface temperature, their combination (i.e., dappled shade/sun), relative humidity, target animal body size, and temperature and distance from camera (Glover-Kapfer et al. 2019). In addition, research has shown the heat-inmotion functions used to trigger detections in PIR techniques can be as variable within camera trap brands or models as between them (Meek et al. 2014(Meek et al. , 2015Falzon et al. 2019). Product variation is thought to be market driven as camera trap manufacturers typically focus on satisfying needs of the hunting community, which typically involve animals with large heat signatures that can be detected with cheaper, lower quality components and thus reduce product costs for consumers . Wildlife research markets will likely never be as large as the hunter market, so manufacturers may not be incentivized to address the PIR factors described above that increase uncertainty in estimates of rare species detection, and by extension, inferences of absence.
For time-lapse triggered camera trapping techniques, the goal of maximizing the number of target species detections and minimizing the number of empty images (i.e., images without target species) can be accomplished without physical camera alteration by decreasing the time-lapse interval, thus taking pictures more frequently, assuming the target species is present. Decreasing the time-lapse interval to increase detections exacerbates a major criticism of the time-lapse technique, which is that thousands to millions of images are generated in the dataset and must be evaluated for target species, a time-consuming manual task in the absence of automation. Though accurate, this criticism is not unique to time-lapse techniques, as PIR techniques can generate empty images via factors contributing to poor sensor performance described above. Thus, regardless of the camera trapping technique employed, computational solutions working first on reducing the number of images to be evaluated and second on target species identification will be a huge benefit to practitioners globally .
Recently, there have been a variety of developments in automated image processing, and each has specific limitations depending on target species and image capture technique (Young et al. 2018. For example, several convolutional neural networking algorithms (CNN) have been designed to process images, but many of them are based on large mammals surveyed with PIR techniques to reduce the number of false positives prior to analysis (Tack et al. 2016, Villa et al. 2017, Tabak et al. 2018, Yousif et al. 2019).
Fundamental to the neural networking approach was the availability of hundreds to thousands of in situ target species images from a wide variety of habitats or backgrounds used to train the algorithms (Young et al. 2018). The minimum number of training images required to ensure optimal model accuracy across all datasets varies depending on species and habitat characteristics (Shahinfar et al. 2020), and the minimum number of training images available for rare species, especially rare snake species, typically do not meet training image number requirements.
An alternative to CNN algorithms is pixel change detection algorithms, which compare images on a pixel-bypixel basis to detect changes (Ílsever andÜnsalan 2012, Hussain et al. 2013). Paired with time-lapse triggered camera trapping techniques, pixel change detection algorithms may provide an opportunity to increase detections of rare snake species and reduce the number of false positive detections. Given that pictures taken closer together in time are more similar, camera traps set with short time-lapse intervals will take more similar pictures thus increasing detections of target species when present and increasing the probability that an arrival of the target species will provide a large enough change in subsequent images to be detected with pixel change algorithms. Here, we evaluate the detection accuracy and efficiency of a time-lapse triggered camera trapping technique paired with a pixel change detection algorithm in an on-going monitoring program for a translocated population of the federally threatened Louisiana Pinesnake (Pituophis ruthveni; U.S. Fish andWildlife Service 2016, 2018). Specifically, we evaluate (1) the number of snakes captured on camera vs. by automated pit tag readers, (2) the number of snake images captured by the change detection algorithm vs. manual researcher review, and (3) characteristics of the images that may make detection by the change detection algorithm more or less likely.  (Daigle et al. 2006). Forest management on the site includes sporadic thinning operations (every 20 years) and frequent prescribed burning (every 4 years) which helps maintain a generally open canopy, low midstory density, and a well-developed herbaceous understory. The climate is considered humid subtropical, consisting of long, hot summers and short, mild winters. Total precipitation during the period of our study (

Study design
Between 2010 and 2019, 123 uniquely pit-tagged P. ruthveni individuals were released into the translocation area and monitored using automated pit tag readers buried at the intersection of cross-shaped drift fences made of 6.4 mm mesh hardware cloth (15 m long x 61 cm tall). By design, the tag reader monitoring system recorded the true number of pit-tagged P. ruthveni drift fence crossings and the individual pit-tag number, therefore it provided the opportunity to evaluate P. ruthveni detection accuracy and efficiency using both the time-lapse triggered camera trapping technique and pixel change detection algorithm. We mounted a camera trap 2 m above 5 different tag readers (pairwise distances between tag readers averaged 831 ± 398 m [SD], range = 284-1,630 m). Due to the size of the site and the home range size of P. ruthveni, the traps and cameras are not considered independent, meaning individual P. ruthveni could encounter multiple traps in the course of their normal movements.
Following the procedures of Neuharth et al. (2020), we mounted cameras facing the ground at the drift fence intersection, and we programmed them to take an image every 30 seconds with a time-lapse trigger. Since P. ruthveni are primarily diurnal snakes (Himes et al. 2006), we ran cameras from 0530 to 2115 hours daily.
We deployed them on 28 March 2019 and removed them for the winter between 28 September and 15 October 2019, a typical monitoring season for P. ruthveni. We replaced memory cards and batteries approximately every 3 weeks and we backed up images from memory cards onto external hard drives prior to analysis.

Data collection
We evaluated the full image dataset both manually (i.e., researchers looking at each individual picture to determine if a snake was present) and using a pixel change detection algorithm. First, we evaluated all images manually from the 5 cameras using multiple reviewers, but only a single reviewer per image in a blind design. We reviewed the images using RECONYX MapView Professional Software v.3.7.2.2 (https://www.reconyx.com/software/mapview) which plays images as a slideshow at changeable speeds. For images containing snakes, we recorded the species, date, and time, along with qualitative information to help us evaluate the accuracy and efficiency of the algorithm in detecting snakes, including P. ruthveni. Specific information included relative snake size (estimated categories: small < 33 cm, 33 < medium < 66 cm, and large > 66 cm), approximate amount of snake showing in the image (little = less than 1/3; some = 1/3 to 2/3, most = more than 2/3), and whether half or more of the showing length of the snake was covered by vegetation or the drift fences. We also included an unknown snake category for images where species identification was not possible, often due to only part of the snake being captured on camera or lowlight images where identifying characteristics were not visible. When the same snake stayed in the frame for multiple consecutive images, we considered those a single observation of an individual snake. One subject matter expert verified all observations of the snake species in each image, along with the relative snake size. Finally, we also examined the camera images encompassing the times a pit-tagged P. ruthveni was detected by the tag reader to ensure that all detections of the target species were included in the snake detection database.

Change detection algorithm
To reduce the number of empty images a researcher needed to review, we used a pixel-based change detection algorithm (Appendix A) to evaluate the difference between consecutive images and retain only images where the change met a specified threshold. The cameras used automatically adjusted ISO and shutter speed to approximate the image to that perceived by the human eye. As such, and because of the variability of lighting in the environment, the images were not adjusted to account for ISO and shutter speed, meaning the images used were normalized for visibility and not absolute measures of color and light.
For each of the 5 cameras, we compared reference images of P. ruthveni ( Figure 1A), identified before image review from the tag reader records, from that camera to a set of snake-free images adjacent in time to create difference thresholds in the extent (i.e., number of contiguous changed pixels) and brightness (i.e., per-pixel mathematical difference in grey-scale value from one image to the next) of pixel change between the snake and snake-free images.
First, to reduce processing time we converted each image to grayscale by averaging the pixel values between the RGB (Red, Green, Blue) layers for each pixel. Then, we created difference images by taking the absolute value of the difference of 2 images adjacent in time for both the snake reference images (i.e., 2 consecutive images, the reference image and the one immediately preceding it) and for random consecutive empty images for each camera.
To determine the optimal brightness band (i.e., the band of grayscale brightness that may provide the optimal indicator of movement by the target organism), we partitioned the pixel values into 11 categories: true zero and by 0.1 intervals (i.e., 0.0 to 0.1, 0.1 to 0.2, etc.). Then we calculated the number of pixels in each category and compared the snake reference difference image with the random empty difference images to determine which category had the greatest difference in pixels between the 2 types of difference images. From the sample of reference images, we determined brightness values in the 0.1-0.2 range were optimal for the detection of P. ruthveni (i.e., had the largest difference compared to the empty images). We used the sum of the changes of pixels falling within the optimal brightness band as thresholds to determine which difference images were retained as part of the algorithm image set. Thresholds were specific to the individual cameras, based on the reference images retained from each camera. Finally, we ran the folders of images through the change detection algorithm and any image that met or exceeded the threshold for change was copied to a new folder for manual image review. All image processing was done in R v. 3.6.1 (R Core Team 2019) using package jpeg (Urbanek 2019).

Data analysis
We manually evaluated all images flagged by the algorithm. We confirmed each image was evaluated by a reviewer who had not previously seen that batch of images (i.e., providing 2 independent reviews of the images). We then coded each snake image as being found by the first reviewer only (in the full image set), by the second reviewer only (in the algorithm-reduced image set), or by both researchers (in both image sets). Using this coding system, we verified whether all the snake images found by the first reviewers were present or not present in the algorithmreduced image set, classifying each image as true positive (i.e., there was a snake in the image flagged by the algorithm) or false negative (i.e., there was a snake in an image and the algorithm did not flag that image). We then calculated the number of algorithm false positive detections (i.e., an image flagged by the algorithm not containing any snake) and true negative detections (i.e., an image with no snake not flagged by the algorithm) by comparing images flagged by the algorithm with snake images found by the second reviewers.
Using logistic regression, we tested for the effects of relative snake size, the amount of snake showing, or whether there was cover (i.e., vegetation or fencing) obscuring the snake on the number of true positive snake detections by the algorithm (i.e., successes) compared to snake detections manually detected only, or false negatives (i.e., algorithm misses). We evaluated a global additive model (containing all 3 variables) and 5 additional models with different variable combinations determined a priori. We ranked the models and selected the best model using corrected Akaike's Information Criteria (AIC c ), where ΔAIC c < 2.0 indicates the best model (Burnham and Anderson 2002). We set statistical significance at α = 0.05.

RESULTS
Over the 7 month period the cameras were deployed, the 5 camera traps ran for 764 trap days in total (x = 152.8, SD = 12.3, range = 134-171 trap days per camera). We had a malfunction in 1 of the 5 cameras (C7), so it was not active from mid-May to early July 2019. Reviewers evaluated a total of 1,500,187 images and we detected 2,425 6 of 16 | images of 161 individual snake observations comprising 14 identifiable species (Figure 1, Table 1, S1, available in Supporting Information). Individual snake observations consisted of between 1 and 1,779 consecutive images of the individual snake (x = 15, SD = 140, median = 2). Almost 75% of the images captured were from a single Agkistrodon contortrix (Eastern Copperhead) present under the camera for approximately a full day (1,779 images), which we considered an outlier and removed from our regression analysis, leaving us with 646 images of 160 snake observations (x = 4, SD = 7, median = 2, range = 1-68 images per individual observation).
We detected 18 P. ruthveni observations with the 5 tag readers from 28 March 2019 to 15 October 2019. Seven of the 18 observations were not captured on camera because of the malfunctioning camera (C7) during the middle of the study, but the 11 remaining tag reader P. ruthveni observations were captured when all 5 cameras were functional. However, one of the tag reader P. ruthveni observations also captured by the cameras was missed in the manual review of the images, because the image captured only a small fraction of the snake's tail.
As a result, that image was not counted as a successful camera trap observation. Only one camera trap observation (2 images) was not also detected by the tag reader. In those 2 images, the individual P. ruthveni reached the drift fence and then turned towards the distal end of the drift fence rather than the center where the tag reader was located. Thus, both camera traps and tag readers captured the same 10 P. ruthveni observations and a single unique observation each.
For the 10 overlapping observations, the tag readers identified 4 unique individuals. Two of the individual P. ruthveni were detected once each at one camera (C12). The other 2 individuals were detected at 2 cameras each, with no overlap between the camera pairs: C7 (twice) and C9 (once) for one individual and C11 and C12 for the T A B L E 1 Number of observations and number of images (in parentheses) for each relative size category (small ≈ <33 cm, medium ≈ 33-66 cm, and large ≈ >66 cm) and total, for the 14 snake species identified, along with an unknown snake group that contained observations of snakes where the images were not identifiable. Images captured by camera traps in the Kisatchie National Forest, Louisiana, USA, during 28 March-15 October 2019. other individual (twice at C11, and thrice at C12; Figure 3). All individual P. ruthveni detected by the cameras were large adults and distributed almost evenly in the amount of snake showing in the images ( We were also interested in determining how generalizable reference images were to detect other similarly sized snakes, i.e., the large snakes from the relative snake size category. We made 47 observations of 7 species of large snakes (mean = 1.8, SD = 2.1, n = 84 images, range = 1-14 images per observation), excluding P. ruthveni, along with 2 unidentified large snake observations (3 images; Tables 1, S1 and S2). Some of the common snake

Change detection algorithm
The pixel changes between consecutive empty and reference P. ruthveni images varied greatly between the different cameras. The threshold for the difference images ranged between 26,383 and 2,800,000 pixels (x= 644,112, SD = 1,211,218 pixels) among the 5 cameras. The pixel counts are the total number of pixels within the (0.1-0.2] brightness band in the whole difference image that was used as the threshold to retain images for manual review. The algorithm did not retain any images falling under the thresholds as they were determined to not have a significant change based on the reference image for each camera. The algorithm reduced the number of images reviewers evaluated by an average of 78.5% per camera (range = 37.3-98.7%) but had a 54.5% success rate at detecting observations of P. ruthveni (47.1% for individual images), and a slightly lower 48.9% success rate detecting other large snake observations and images (Figure 2, Table S1). The number of false positives averaged 64,384 images per camera (without the A. contortrix: x = 64,387 false positive images per camera), however, false positive average was skewed high by the very low percent reduction in algorithm images for tag reader and camera C12 (i.e., only 37.3% reduction; Figure 4, Table S1). The  Table S1). One of those false negatives included one of the reference images used by the change detection algorithm to determine the pixel change threshold for flagging images. The single top logistic model (ΔAIC c < 2) was the full additive model, comparing the effects of relative size, amount of snake showing, and at least half covered (no or yes), accounting for 0.81 of the AIC c weight ( Table 2).
The odds ratio for relative size of the snake indicated large snakes were approximately 4 times more likely to be flagged by the algorithm than small snakes (Table 3). Additionally, snakes with approximately some, or most of their body length showing in the images were 2 and 1.3 times, respectively, more likely to be flagged by the algorithm than snakes with little of their body length showing (Table 3). Finally, counterintuitively, snakes at least half covered by vegetation or fencing in the images were 1.8 times more likely to be flagged by the algorithm (Table 3).

F I G U R E 4
The number of images in each picture category for each camera (not including the Eastern Copperhead [Agkistrodon contortix] at C7). Our goals were to maximize true positives (algorithm flagged an image containing a snake) and true negatives (algorithm did not flag the image and there was no snake in it), while minimizing false negatives (algorithm did not flag the image containing a snake) and false positives (algorithm flagged an image and there was no snake in it). The true positives and false negatives (top row) reflect snake presence in images, while true negatives and false positives (bottom row) reflect effort reduction by the algorithm for manual review. All images were collected from the Kisatchie National Forest in Louisiana, USA during 28 March-15 October 2019.

DISCUSSION
Our time-lapse triggered camera trapping technique performed well with respect to P. ruthveni detection accuracy.
All but one of the pit-tagged P. ruthveni crossings were detected, and the single miss occurred because the image included only a small portion of the snake's tail (i.e., the camera caught the snake, but the manual image reviewers did not). Even with the missed observation, our camera trapping technique detected the same number of pit-tagged P. ruthveni as the tag reader, because one individual captured on camera did not cross the tag reader. Importantly, the camera-detected, but tag reader-missed, individual was the only observation of a P. ruthveni at that camera site (C4) during the study. Camera trapping detection accuracy suggests a 30 second time-lapse interval set to take pictures during daylight hours was sufficient for monitoring large-bodied snakes like P. ruthveni. Indeed, all the cameras detected at least one P. ruthveni while operational, albeit with considerable variation in detection rates.
While the causes of variation in detection rates in our study are unknown (Rovero and Marshall 2009), the range of variation in detection rates is extremely important for drawing inferences about survey and monitoring results from other studies on the species.
T A B L E 2 Model selection results for all binomial logistic regression models. We used the difference in Akaike's Information Criterion adjusted for small sample sizes (ΔAIC c < 2) to identify the model that best predicts whether the algorithm would flag the snake image captured by camera traps in the Kisatchie National Forest in Louisiana, USA during 28 March to 15 October 2019. K = number of parameters, AIC c = Akaike's Information Criterion, ΔAIC c = change in AIC c , w i = model weight. A previous camera trapping study using time-lapse triggered camera trapping technique to survey for P. ruthveni in potentially suitable habitats in Texas was also successful at detecting large-bodied snake species but failed to detect the target species (Anderson et al. 2020 present, they are present at very low densities, suggesting that much more effort may be required to detect them (Rudolph et al. 2018). Clearly more research is needed to understand variation in detection rates of P. ruthveni using time-lapse triggered camera trapping technique, but the results of our study can begin to help discern inferences of absence from inadequate sampling for rare species like P. ruthveni.
In addition to recording species' detections, camera traps have been considered useful in recording information on individuals, in particular recaptures. Individual identifications work well with species that have unique markings or scars and have been used for large cats (e.g., bobcats, Mendoza et al. 2011;tigers, Karanth et al. 2011;leopards, Hedges et al 2015). changes in application could expand population monitoring and modeling of P. ruthveni beyond that which is feasible with tag readers, which require initial capture of individuals to implant the pit-tag. The camera trapping drift fence arrays described here can monitor new individuals that do not have pit-tags implanted, such as young produced on site or immigrants to the site. In bypassing the initial capture requirement for pit-tagging, the camera trapping drift fence arrays could fully automate the mark-recapture sampling of P. ruthveni populations, where individuals are never physically captured but instead are monitored through image recapture potentially capable of tracking body condition, growth, movement, and survival over time.
Using the change detection algorithm we developed, we found approximately a 50% success rate in the detection of both P. ruthveni and other similarly sized snakes (Table 3). Given the low rate of snake observations in general, and P. ruthveni in particular (i.e., 2 camera sites had only a single P. ruthveni detection), increasing the success rate should be a major focus of future research. However, an average reduction of 78.5% of pictures to evaluate (~1.17 million fewer) potentially saves 175 hours of evaluation time, assuming a manual evaluation rate of 10,000 pictures per 1.5 hours (Adams et al. 2017). The potential reduction in effort is also worth further evaluation of the program to see if the picture setup and algorithm could be further refined.
The algorithm was successful at reducing false positives across all sites, but it also reduced true positives of both P. ruthveni and other snake species at 4 of 5 sites. At the remaining site, camera C9, the algorithm performed extremely well by flagging the single true positive P. ruthveni detection at that camera while also eliminating 87.9% of true negative images. The variation in algorithm snake detections observed across sites is likely due to the background noise in the images (e.g., moving vegetation, changing cloud cover), which complicated threshold determination. We expected that snakes that were not covered would present more of a pixel change and thus be more likely to be flagged by the algorithm, but the opposite was true. The positive association of cover in images shows that vegetation may have played 2 specific roles. First, it influenced the brightness band we used to calculate the change detection threshold (i.e., [0.1-0.2]); snakes in the reference images that had partial cover had a smaller change in pixel brightness, compared to snakes that were in the open, thus pixel changes from snakes in the open was not necessarily included in the threshold calculation. Additionally, it suggests that background noise may have played a larger than preferred role in the flagging of the images (i.e., snakes entering the field of view are not the sole cause of pixel change calculated by the algorithm). For our study, we attempted to keep the trapping area as natural as possible to minimize disturbance to the landscape. However, future camera trapping efforts could work on ways to reduce background noise, such as creating and maintaining an open, uniform space beneath the camera to reduce the noise and cover of vegetation, in order to achieve a more efficient threshold and one that could potentially be applied across multiple cameras.
For the current version of the change detection algorithm presented here, finding the best threshold across sites for maximizing true positives and minimizing false negatives while optimizing the number of false positives was a challenge. There is clearly a large amount of further research to be performed in order to improve quality assurances of camera trap image filtering and object recognition algorithms across different sites or environments (Shahinfar et al. 2020). Nonetheless, our research provides detailed information supporting the establishment of long-term monitoring sites with a high degree of visual similarity in the image background. In addition, our study provides another source of labelled images for snake species that are necessary for the practical implementation of deep learning algorithms in the field of camera trapping (Shahinfar et al. 2020). Our study remains equivocal regarding comparisons between PIR and TL camera trapping approaches, but we suggest advancements in TL approaches are more feasible for researchers, as most researchers cannot improve sensor technology to increase trapping success, but they can improve algorithm success.

MANAGEMENT IMPLICATIONS
For many rare and secretive species requiring conservation actions like P. ruthveni, non-detections can be just as important as detections in guiding allocation of resources. The results on variation in detection rates of our study can begin to help discern robust inferences of absence from inadequate sampling for rare species like P. ruthveni, as well as improve our understanding of how best to apply time-lapse triggered camera trapping technique with a change detection algorithm for monitoring of biodiversity more broadly. Long-term trapping for P. ruthveni indicates that trapping success is highly variable across years (Rudolph et al. 2018) and, given the large home ranges of this species (Himes et al. 2006, Pierce et al. 2014, longer term camera studies should be undertaken before declaring