Introduction

In the context of global climate change, increasing human disturbances, and ongoing habitat fragmentation, obtaining fundamental ecological data on endangered species is essential for wildlife conservation. These environmental pressures have significantly impacted the population distribution and abundance of numerous species, driving some to extinction1,2. Ungulates play a critical role in ecosystem functioning, maintaining ecological balance by shaping vegetation patterns, facilitating seed dispersal, and serving as prey for carnivores3,4. The dietary habits of ungulates are central to wildlife ecology, offering valuable insights into habitat selection, interspecific competition, and their potential resilience to climate change5,6,7,8. Therefore, understanding the diet of endangered species is vital for informing effective conservation strategies and habitat management.

The water deer (Hydropotes inermis), a small ungulate once widely distributed across China—including the Liaodong Peninsula, North China Plain, and areas along the Yangtze River9,10—is now primarily confined to southern and northeastern regions. Significant declines in their geographic range and population have been driven by habitat loss and fragmentation resulting from climate change and anthropogenic activities11. Historically, water deer were believed to be absent from northeastern China for the past 50 years, but recent research has confirmed their presence in this region12. Despite this rediscovery, critical gaps remain in understanding their ecology, particularly their dietary habits. Water deer are classified as concentrate selectors within the mixed feeder category, exhibiting a diverse diet dominated by tender leaves and shoots of woody plants, shrubs, and forbs13,14,15. This study aims to address these gaps by investigating their diet to elucidate how they adapt to the habitat and climatic conditions of northeastern China. Such knowledge is essential for developing scientifically informed conservation and management strategies to protect this endangered species.

Traditional methods for studying ungulate diets, such as fecal microhistological analysis and fecal DNA analysis16, remain widely used but are often time-consuming and costly. Fecal microhistological analysis, despite its labor-intensive nature, offers several advantages, including low cost, non-invasiveness, and methodological simplicity. These attributes have made it a popular choice for ungulate diet studies. However, its limitations are significant, particularly when researchers must compare numerous fecal microscopic slides with plant cell reference slides. The vast diversity of plant species and the similarity in cell structures often lead to identification challenges, even for experienced researchers. These limitations underscore the need for innovative approaches to improve accuracy and efficiency in dietary analysis. Deep learning, with its exceptional capabilities in self-supervised feature learning and multi-class classification, has shown great promise in addressing complex image recognition tasks. Its application to ecological research, particularly in the analysis of plant cell structures, has demonstrated both accuracy and efficiency17. By integrating deep learning with traditional fecal microhistological analysis, this study seeks to overcome the limitations of conventional methods and provide novel insights into the diet of water deer.

This study aims to: (1) evaluate the reliability of deep learning algorithms for microhistological diet analysis of wild herbivores, (2) identify the plant species and their proportions in the diet of water deer in northeastern China across seasons, and (3) explore seasonal dietary variations and their implications for the species’ adaptation to environmental changes. The findings are expected to provide a scientific foundation for conserving water deer populations by safeguarding their food resources in northeastern China. Furthermore, the integration of deep learning with traditional ecological methods holds potential for advancing research on other endangered species.

Materials and methods

Sampling area

Fecal samples of water deer were collected from northeastern China, encompassing Changbai, Baishan, and Ji’an in Jilin Province, as well as Kuandian, Fengcheng, and Huanren in Liaoning Province (40°2′–42°13′N, 123°33′–128°18′E; Fig. 1). The sampling area in Jilin Province is characterized by a north temperate continental monsoon climate, with an average annual temperature of 4.6 °C and an average annual precipitation of 883.4 mm. In contrast, the sampling area in Liaoning Province experiences a warm temperate humid monsoon climate, with an average annual rainfall ranging from 800 to 1,200 mm and an average annual temperature of 6–9 °C. The study area is located along the north and northwest banks of the Yalu River, featuring a well-developed water system with numerous tributaries, including the Hun River, Ai River, and Cao River.

Fig. 1
figure 1

Map depicting sampling area and sampling sites generated with ArcGIS 10.8 (Environmental Systems Research Institute, Inc. in Redlands, California, USA. https://www.esri.com/en-us/arcgis/products).

The sampling area supports a diverse mammalian community, including species such as musk deer (Moschus moschiferus), roe deer (Capreolus pygargus), black bear (Ursus thibetanus), and lynx (Lynx lynx). The region is rich in vegetation resources and comprises varied habitat types, such as broad-leaved forests, mixed coniferous and broad-leaved forests, coniferous forests, shrubs, and grasslands. Dominant tree species include Gmelin larch (Larix gmelinii), Korean pine (Pinus koraiensis), and Mongolian oak (Quercus mongolica).

Fecal sampling procedure

Fresh fecal samples of water deer were collected from June to December 2021 within their suitable habitats in the study area, which included grassland/cropland, shrub/orchard, and Gmelin larch habitats12. Sampling was conducted along systematically planned transects to detect signs of water deer presence. Upon locating fresh feces, samples were collected using 50 ml sampling tubes, with elevation and environmental data recorded at each sampling point. To minimize the risk of false repetitions, a minimum distance of 500 m was maintained between consecutive fecal collection points when encountering grouped feces18. Although musk deer and roe deer also inhabit the study area, their preferred habitats differ from those of water deer, as they are typically found at higher elevations with steeper slopes. Water deer fecal pellets were identified following the methods described by Li et al.12,19. Compared to roe deer feces, water deer feces are characterized by smaller, more elongated pellets and denser fecal piles with shorter inter-pile distances. These distinct morphological and habitat features allowed for confident attribution of the collected fecal samples to water deer. Fresh feces excreted within three days were collected based on the approach outlined by Gao20. A total of 203 fresh fecal samples were collected during the warm season (July to August), and 451 samples were obtained during the cold season (November to December).

Microhistological analysis

The preparation of fecal samples for microhistological analysis followed a standardized protocol to ensure consistency and accuracy21. A few pellets were extracted from each sample to create composite samples for the warm and cold seasons, which were then crushed using a GIANXI coffee grinder. The crushed samples were sieved through 0.45 mm and 0.15 mm filters, with the material retained on the 0.15 mm filter stored for further analysis22. For each sample, 1 g of the sieved material was placed into a culture dish containing 40 ml of 10% sodium hypochlorite solution22. The mixture was thoroughly stirred to ensure homogeneity and processed for 3–5 h. After processing, the samples were poured onto a 0.075 mm filter and rinsed for 2 min22. The rinsed material was spread onto glass microscope slides using glycerol, and cover slips were secured with neutral gum. Three slides were prepared for each composite sample. The slides were examined under 100× magnification using a Leica DM1000 biomicroscope and Leica EZ software. Each slide was systematically photographed, capturing 10 to 20 fields of view in a left-to-right and top-to-bottom sequence to ensure comprehensive coverage.

Construction of plant cell image library

Plant cell images obtained from Ding23 and Zhou24 were incorporated into the image library for training the deep learning model. Ding’s study area overlapped with ours, while Zhou’s study area shared similar climatic and vegetation conditions, ensuring the appropriateness and reliability of these images for model training. The collected images were meticulously reviewed to exclude overlapping, unclear, or irrelevant samples, resulting in a final selection of 701 images representing 130 plant species. To optimize model training accuracy, each image was individually cropped to remove blank areas and converted to grayscale. Due to the limited number of images per plant species, data augmentation was performed using the cv2 library in OpenCV25 and the NumPy tool in PyCharm (2023.1.1)26. Specific augmentation techniques included resizing images by a factor of 1.5, horizontal and vertical flipping, 180° rotation, brightness adjustment, and the addition of salt-and-pepper noise27. These operations generated a total of 4,907 images for model training.

Model training, validation, and predicting

Model training was performed using the ResNet-50 (Residual Network with 50 layers) architecture28,29 in PyCharm (2023.1.1), with the training parameters specified in Table 1. ResNet-50, a deep convolutional neural network within the ResNet family, is distinguished by its residual learning blocks30. These blocks incorporate shortcut connections (skip connections) that enable the network to bypass one or more layers during training. This design addresses the vanishing gradient problem and facilitates the training of very deep networks. ResNet-50 has been widely applied in image recognition tasks, including image classification, object detection, and image segmentation31,32.

Table 1 The model training parameters of the Resnet50 model used in the current study.

Before model training, the image library was partitioned into three subsets: a training set (60%, 3,019 images), a test set (20%, 903 images), and a validation set (20%, 985 images)33. The training set was used to train the ResNet-50 model over 20 epochs, with model accuracy evaluated using the validation set34. Subsequently, the trained deep learning model was employed to classify plant cell images from fecal samples. Prior to prediction, each image was individually cropped to remove blank areas and retain clear cellular structures. Additionally, images were converted to grayscale to improve prediction accuracy. Following processing, a total of 916 plant images were obtained from fecal composite samples during the warm season, and 625 images were obtained during the cold season.

Data analyses

The relative abundance of plant species a = Number of plant a identifications by deep learning model / Total plant images in warm or cold season. Differences in seasonal consumption proportions of specific plant types were assessed using the Mann-Whitney U test. To evaluate diet selectivity, α-diversity analyses were conducted by calculating the Shannon diversity index and inverse Simpson index using the vegan package (version 2.6-4)35. β-diversity analyses were performed to examine seasonal differences in diet composition, with compositional dissimilarities visualized through nonmetric multidimensional scaling (NMDS) plots based on Bray-Curtis distances. NMDS ordination was implemented via the metaMDS function in the vegan package35. Detected plants were categorized into four functional groups: woody species, ferns, graminoids, and forbs. All visualizations were generated using the ggplot2 package (version 3.3.5)36 and OriginPro 202337. Statistical analyses were performed in R (version 4.3.1)38, with significance thresholds set at P < 0.05.

Results

Accuracy of trained model

The accuracy of the training set progressively increased, reaching 99.83% after 20 training epochs, while the validation set accuracy surpassed 84% (Fig. 2). Additionally, the model was evaluated using a test set of plant cell images, achieving an accuracy of 88.8%. These results demonstrate that the deep learning model developed in this study is highly effective for identifying plant cell images in water deer fecal samples. During the warm season, the model successfully identified 96 distinct plant species, compared to 93 species recognized in the cold season (Fig. 3).

Fig. 2
figure 2

Training and validation accuracy of the deep learning model.

Fig. 3
figure 3

Comparison between the images in the training set and the images photographed from the fecal microscope slides. a, b, c: The plant cell images collected from Ding23 and Zhou24, which was set as training set of the deep learning model; d, e, f: the images photographed from the fecal microscope slides in current study, which were recognized by the deep learn model; a, d: Clematis terniflora; b, e: Populus davidiana; c, f: Polygonum sieboldii.

Plant species composition

The results indicated that water deer consumed a total of 110 plant species, encompassing 86 genera from 42 families throughout the year (S1). During the warm season, their diet consisted of 96 species from 78 genera and 39 families, whereas in the cold season, they consumed 93 species from 75 genera and 38 families (S1). The most frequently consumed families, along with their respective relative abundances over the year, were Fabaceae (10.38%), Asteraceae (8.76%), Poaceae (7.72%), Polygonaceae (6.88%), Salicaceae (6.16%), Rosaceae (5.45%), and Malvaceae (5.26%) (Fig. 4a, S1). In the warm season, Kummerowia striata (2.95%) was the most frequently consumed plant within the Fabaceae family, while in the cold season, Amphicarpaea edgeworthii (3.2%, S1) was the most consumed. Within the Poaceae family, Poa sibirica (4.26%) was the predominant plant during the warm season, whereas Alopecurus aequalis (1.28%) was more prevalent during the cold season (S1).

Fig. 4
figure 4

a: Relative abundance (%) of plants at family level (Families with a feeding ratio of more than 2% by water deer); b: Relative abundance (%) of plants at genus level (Genus with top 15 feeding ratios by water deer).

Similarly, Fabaceae and Asteraceae exhibited high feeding ratios in both the warm and cold seasons, accounting for 10.07% and 8.95% of Fabaceae, and 9.92% and 8.48% of Asteraceae, respectively (Fig. 4a, S1). However, the feeding ratios for Poaceae (10.15%, P = 0.004) and Salicaceae (9.5%, P = 0.002, S2) were significantly higher during the warm season, while they decreased to 4.16% and 1.28%, respectively, during the cold season (Fig. 4a, S1). In the cold season, water deer consumed 8.3% of Rosaceae (P = 0.004) and 8.48% of Cannabaceae (P = 0.002, S2), whereas during the warm season, only 3.17% and 2.29% of these two families were consumed, respectively (Fig. 4a, S1).

At the genus level, Populus (5.45%) was the most dominant throughout the year, followed by Tilia (5.26%), Polygonum (5.26%), Humulus (4.8%), Euonymus (4.54%), Acer (4.09%), and Picea (4.02%, Fig. 4b, S1). During the warm season, the top four genera most consumed by water deer were Populus (8.52%, P = 0.002), Tilia (6.44%, P = 0.036), Polygonum (6.44%, P = 0.036), and Juncus (5.68%, P = 0.002). In contrast, during the cold season, the top four genera were Humulus (8.48%, P = 0.002), Euonymus (6.24%, P = 0.240), Picea (5.76%, P = 0.054), and Acer (4%, P = 0.733) (Fig. 4b, S1, S2).

Plant form composition

The overall composition of plants, classified by growth morphology, was dominated by woody species (47.63%) and forbs (41.99%), with smaller proportions of graminoids (7.72%) and ferns (2.66%). This compositional pattern remained consistent across seasons. During the warm season, the proportions were 47.38% woody species, 39.3% forbs, 10.15% graminoids, and 3.17% ferns. In the cold season, the proportions shifted slightly to 48% woody species, 45.92% forbs, 4.16% graminoids, and 1.92% ferns (Fig. 5).

Fig. 5
figure 5

Relative abundance (%) of plants classified by growth morphology.

Plant species diversity

Diversity analysis illustrated the significant differences in plant diversity between the warm and cold seasons, as measured by the Shannon diversity index (Fig. 6a) and the Simpson index (Fig. 6b). For the Shannon diversity index, the values were significantly higher during the warm season compared to the cold season (P = 0.00028). Similarly, the Simpson index also showed significantly higher values during the warm season (P = 0.0012). The NMDS plot illustrated the differences in plant composition between the cold and warm seasons (Fig. 7). Samples from the warm season cluster on the right side of NMDS1, while cold season samples are more dispersed on the left, indicating a gradient driven by seasonal changes. The stress value of 0.089 suggested a good fit of the model to the data, supporting the reliability of the observed patterns.

Fig. 6
figure 6

Alpha diversity indices. (a) Inverse Simpson index by season. (b) Shannon diversity index by season.

Fig. 7
figure 7

Non-metric multidimensional scaling (NMDS) plot showing the Bray-Curtis dissimilarity based on relative abundance of plant species fed by water deer.

Discussion

Diet comparison of water deer between warm and cold season

Water deer exhibited a consistent preference for Fabaceae and Asteraceae plants across both warm and cold seasons (Fig. 4a, S1), likely due to the year-round availability of these plant families. However, notable seasonal variations were observed in the consumption of other plant families. During the warm season, the proportion of Poaceae and Salicaceae in the diet was significantly higher, whereas their consumption decreased during the cold season (Fig. 4a, S1, S2). This pattern may reflect the vigorous growth, high palatability, and nutritional value of Poaceae and Salicaceae plants during the warm season, as well as their widespread distribution. In contrast, water deer consumed a higher proportion of Rosaceae and Cannabaceae during the cold season, with significantly lower proportions observed in the warm season (Fig. 4a, S1, S2). This shift may be driven by the availability of fallen Rosaceae leaves and dried Humulus scandens (Cannabaceae) during the cold season. Conversely, the greater diversity of food resources available in the warm season likely reduced the reliance on these plant families.

The relative abundance of plant genera consumed by water deer differed significantly between warm and cold seasons. During the warm season, the top four genera in their diet were Populus, Tilia, Polygonum, and Juncus (Fig. 4b, S1, S2). In contrast, during the cold season, the dominant genera shifted to Humulus, Euonymus, Picea, and Acer (Fig. 4b, S1, S2). These patterns suggest that the palatability and availability of these plants may be more favorable during the cold season, driving their increased consumption by water deer. Notably, water deer exhibited similar genus-level dietary preferences to other ungulates in northeastern China, such as red deer (Cervus elaphus) and sika deer (Cervus nippon), which also primarily consumed Euonymus, Acer, Abies, Pinus, and Corylus39. This aligns with the broader behavior of ungulates in northern and cold regions, which adjust their food choices seasonally to meet nutritional demands39. Winter, in particular, represents a critical period for ungulate nutrition in these regions, as cold climates and limited food resources pose significant challenges40,41. Consequently, the ability to adapt dietary preferences to seasonal changes is essential for the survival of ungulates under such harsh environmental conditions.

The diversity indices of plant species consumed by water deer were significantly higher during the warm season compared to the cold season (Fig. 6). This pattern can be attributed to the vigorous growth of plants in the warm season, which increases the availability and variety of forage. Additionally, the birthing period of water deer, typically occurring in May-June, coincides with elevated energy demands for lactation and offspring rearing, further driving the need for a diverse and abundant diet. Analysis of the specific plants consumed revealed a relatively balanced distribution of plant species during the warm season (Fig. 8). In contrast, the cold season exhibited pronounced variability in the relative abundance of consumed plants, ranging from 8.48% (Humulus scandens, P = 0.002) to as low as 0.16% (Populus cathayana, P = 0.002; Fig. 8, S2). This disparity reflects the reduced diversity and availability of plant species during the cold season, compounded by the limited nutritional value of deciduous leaves from woody plants such as Populus cathayana, which are high in fiber but low in essential nutrients.

Fig. 8
figure 8

Relative abundance (%) of plants at species level (Species with top 15 feeding ratios by water deer).

Notably, significant differences were observed in the consumption of specific plant species between seasons. Plants more frequently consumed during the warm season, such as Picea koraiensis (P = 0.054), Euonymus macropterus (P = 0.002), and Filipendula palmata (P = 0.014), showed reduced proportions in the cold season, with differences reaching up to 6.19% (Fig. 8, S2). Conversely, plants preferred during the cold season, including Juncus effusus (P = 0.002), Populus davidiana (P = 0.002), Poa sibirica (P = 0.008), and Populus cathayana (P = 0.002), were less prominent in the warm season, with maximum differences of 5.2% (Fig. 8, S2). These shifts highlight the adaptive foraging strategies of water deer, which adjust their dietary preferences in response to seasonal changes in plant availability and nutritional quality. In summary, the reduced variety and quantity of plant species during the cold season necessitate increased reliance on a limited number of available forage options. Water deer demonstrate remarkable dietary flexibility, modulating their consumption patterns to meet energy and nutritional requirements in response to fluctuating environmental conditions.

Diet comparison of water deer between current study and other regions

From a plant family perspective, our findings demonstrated a high degree of dietary similarity between water deer in northeastern China and those in other regions. In this study, the dominant plant families consumed by water deer align closely with results from a fecal DNA analysis of water deer in Korea, which reported a diet dominated by Salicaceae (27.5%), Fabaceae (17.5%), and Poaceae (14.2%)42. Similarly, another fecal DNA study in Korea identified Rosaceae (22.0%), Moraceae (19.0%), Betulaceae (10.0%), and Fabaceae (8.7%) as the primary plant families in their diet43. Further supporting this pattern, a microhistological study of water deer in the Zhoushan Islands, Zhejiang Province, China, documented their consumption of 137 plant species from 115 genera and 61 families, with Fabaceae, Fagaceae, Ericaceae, and Rosaceae representing a significant proportion across all four seasons13. Additionally, multiple dietary studies of water deer in China have consistently highlighted the prominence of Fabaceae, Asteraceae, Rosaceae, and Poaceae throughout the year23,44. Collectively, these findings indicate that water deer in the present study, as well as those in Korea and southern China, exhibit a strong preference for Fabaceae and Rosaceae plants. This consistency in dietary patterns across geographically distinct populations suggests a potential influence of inherent genetic factors on food selection. Furthermore, the observed dietary similarities may also reflect convergent evolutionary adaptations to similar ecological niches, as water deer in these regions face comparable environmental pressures, such as seasonal resource availability and predation risks. The preference for Fabaceae and Rosaceae plants, which are often rich in nutrients and widely distributed, may represent an optimal foraging strategy shaped by natural selection.

The number of plant species consumed by water deer in the current study was relatively lower than that reported in southern China (137 species)13, but the number of genera was higher than that observed in Korea (63 genera)43. This discrepancy may be attributed to climatic and vegetation differences across regions. Both northeastern China and Korea fall within the temperate monsoon climate zone, resulting in similar vegetation compositions. In contrast, the distribution area of water deer in southern China experiences a subtropical monsoon climate, characterized by higher plant diversity and distinct vegetation conditions. Consequently, water deer in southern China consume a significantly greater number of plant species compared to those in northeastern China. This regional variation in dietary breadth may reflect adaptive responses to local ecological conditions, such as resource availability and competition. For instance, the higher plant diversity in southern China likely provides water deer with a broader range of foraging options, while the temperate regions may favor specialization on fewer, more abundant plant species.

Variations in the number of plant species consumed by water deer across regions may also be influenced by factors such as study duration, methodologies, and geographic locations. For instance, a comparison between traditional microhistological analysis and DNA-based methods reveals that the latter tends to overemphasize chloroplast-rich tissues, potentially underestimating the contribution of seeds or roots to the diet. Additionally, DNA analysis exhibits limitations in detecting non-angiosperm materials, such as mosses and ferns, and is entirely ineffective for identifying fungi45. Notably, fecal microhistological analysis has been widely employed in studies of deer feeding ecology, including those referenced above. For example, Guo et al. identified the highest number of plant species consumed by deer13, a finding that may reflect either the methodological reliability of microhistological analysis or the exceptional plant diversity in their study area. This underscores the precision and effectiveness of fecal microhistological analysis in identifying plant species, further supporting its utility in dietary studies.

The dietary composition of water deer consistently featured a high prevalence of woody plants and forbs across all studied regions. These findings align closely with those of Ding et al.23, who reported a diet dominated by forbs (52.94%) and woody plants (35.29%). In contrast, Guo et al.13 observed somewhat divergent patterns, with woody plants representing a substantial proportion of the diet year-round (up to 61.15%), while forbs were prominent only in spring (48.39%) and summer (49.73%), declining significantly in autumn (~ 30%) and winter (< 20%). These differences may reflect the contrasting climatic conditions. The prevalence of evergreen woody plants in their study area likely contributed to the elevated consumption of woody plants during autumn and winter. This suggests that water deer may exhibit dietary plasticity, adapting their foraging strategies to maximize energy intake under varying environmental conditions. Further variations were observed in the study by Lee et al.43 on Korean water deer, where woody plants dominated the diet (68.6%), while forbs and graminoids accounted for only 7.0% and 0.7%, respectively. These disparities may be attributed to subspecies differences, as the Korean water deer (H. i. argyropus)46,47,48 is distinct from the Chinese water deer (H. i. inermis)12,49, which was the focus of other studies. The observed dietary differences between subspecies may reflect evolutionary divergence driven by local adaptation to distinct ecological niches, highlighting the role of environmental factors in shaping foraging behavior.

The application of deep learning in ecological studies

Deep learning has emerged as a highly efficient and accurate tool for ecological research. Among deep learning models, ResNet-50 has proven particularly valuable, playing a pivotal role in species identification and population monitoring through the analysis of camera trap images50. Its applications extend to biodiversity assessment, where it enables the precise identification and classification of both plant and animal species within complex ecological datasets51. Furthermore, ResNet-50 contributes to evaluating the impacts of climate change on ecosystems by monitoring shifts in vegetation patterns and wildlife distributions52. In the current study, the ResNet-50 model achieved an impressive accuracy of 99.83%, providing robust support for our findings and highlighting the transformative potential of deep learning in ecological studies. The utility of deep learning is further exemplified by its application in identifying morphologically similar species within the Podarcis hispanicus complex of wall lizards, where it achieved high accuracy rates53. These results demonstrate that deep learning models are powerful tools for field identification and monitoring of cryptic species complexes, offering a reliable alternative to traditional methods reliant on expert knowledge or genetic analysis.

Deep learning is increasingly being integrated into wildlife ecological research, offering significant reductions in researchers’ workloads54,55. For instance, deep convolutional neural networks have been employed to identify, count, and describe the behaviors of 48 species within the Snapshot Serengeti dataset, which comprises 3.2 million images. This approach saved over 17,000 h of manual labeling effort while achieving an identification accuracy exceeding 93.8% 51. In the current study, we innovatively applied deep learning algorithms to plant cell recognition, achieving high accuracy and substantially reducing the time required for plant image classification. Traditional methods for comparing 1,541 images across 130 plant species could take several months and often yielded inconsistent results. In contrast, our deep learning-based approach completed data organization, labeling, model training, and prediction within a few days. These findings underscore the potential of deep learning algorithms to significantly enhance the efficiency and accuracy of wildlife ecological research.

The collection of high-quality datasets is a critical step in training deep learning models. In this study, the acquisition of plant cell images played a pivotal role in the initial stages, significantly contributing to model development. We utilized plant cell images from prior studies, sourced either from the study region or from areas with similar plant compositions and climatic conditions. This approach eliminated the need for dedicated collection of plant samples and preparation of cell slides, substantially reducing both the workload and time required for the study. For other research leveraging deep learning in image recognition, such as species identification from infrared camera images, the initial identification and labeling of large image datasets remain labor-intensive and time-consuming. Therefore, the establishment of comprehensive resource databases—such as plant cell image databases, animal image databases, and animal sound databases—could streamline preliminary research efforts. However, this strategy is not without limitations. For instance, the plant cell images used in this study may not encompass all plant species consumed by water deer in the study area, potentially restricting the model’s ability to recognize certain food sources. To address this, future studies should focus on expanding the model library by accumulating cell images from a wider range of plant species. This will enable a more comprehensive representation of the dietary composition of water deer and improve the accuracy of the results.

Conclusions

This study demonstrates the efficacy of integrating fecal microhistological analysis with deep learning algorithms to elucidate the dietary ecology of water deer in northeastern China. Our deep learning model, trained on plant cell images from prior studies, achieved an identification accuracy of 99.83%, enabling the detection of 110 plant species (86 genera, 42 families) consumed by water deer across seasons. Notably, the observed dietary composition exhibited strong congruence with water deer populations in other regions13,23,42,43,44,56, validating both the methodology and the ecological consistency of the species’ foraging behavior. Significant seasonal shifts in plant consumption patterns were identified, with woody species and forbs dominating the diet in both warm (July–August) and cold (November–December) seasons. These adaptive dietary adjustments underscore the importance of temporal resource dynamics in shaping the species’ foraging strategies. Such insights are critical for informing habitat management plans aimed at supporting water deer populations, particularly in the context of climate-driven vegetation changes. The integration of deep learning with traditional microhistological techniques has substantially accelerated dietary analysis while maintaining high precision. This approach not only advances research on water deer ecology but also establishes a scalable framework for studying dietary patterns in other endangered herbivores. As deep learning algorithms continue to evolve, their application in ecological studies promises to enhance our capacity to monitor biodiversity and design targeted conservation strategies.