Abstract
Reliable individual identification is essential for precision livestock farming. To reduce the performance disparity among coat-color groups in open-set sheep face recognition, this study proposes a color-adaptive recognition method. A coat color classifier routes images to dedicated recognition models, each equipped with a tailored preprocessing pipeline. The method introduces a Retinex-Guided Gradient Perception Convolution (RGPConv), which embeds Retinex physical priors into the convolution operator and generates spatially adaptive modulation maps from the illumination component to dynamically control gradient enhancement intensity, enabling illumination-aware adaptive gradient feature extraction. A Multi-scale Channel Attention Fusion (MCAF) mechanism is further designed to integrate multi-level semantic information. Experiments on the LSFW dataset show that the proposed method achieves an open-set recognition accuracy of 96.08%, outperforming the baseline Li-SheepFaceNet by 1.50 percentage points. Compared with the corresponding routing-only subset baselines, accuracy improves by 2.41 and 2.00 percentage points for black-faced and white-faced sheep, respectively. On the cross-scene RealSheepFace and cross-species GoatFace datasets, accuracy improves by 4.26 and 2.00 percentage points, suggesting potential cross-domain transferability.
1. Introduction
Reliable individual identification is essential for precision livestock farming because it supports health monitoring, breeding management, disease tracing, and behavior analysis. Traditional contact-based methods, such as ear tags and branding, are prone to detachment, require manual maintenance, and may induce animal stress. Computer-vision-based sheep face recognition therefore provides a promising non-contact alternative for automated farm management.
Sheep face recognition can be divided into closed-set and open-set settings [1]. Closed-set methods assume that all test individuals are known during training, which is often unrealistic on farms where animals may be introduced, transferred, or removed. Open-set recognition is more suitable for such dynamic scenarios because it must verify known individuals while rejecting unknown ones [2]. Nevertheless, open-set sheep face recognition remains challenging because of limited data, uncontrolled acquisition conditions, and large visual variation among individuals.
Existing open-set sheep face recognition studies have made progress, but most use a unified processing pipeline for all sheep. For example, Li-SheepFaceNet [3] previously reported 96.13% accuracy on LSFW. Under our experimental protocol, the reproduced Li-SheepFaceNet baseline achieves 94.58% accuracy. More importantly, its performance differs across coat-color groups, with lower accuracy for black-faced and white-faced sheep than for parti-colored sheep. This imbalance may reduce reliability in practical tasks such as individual record management and disease tracing.
These performance differences are closely related to coat-color-dependent imaging characteristics. Black-faced sheep often have low facial brightness but rich local gradients, making dark-region detail extraction important. White-faced sheep usually have higher brightness and weaker texture contrast, making them more sensitive to overexposure and illumination variation. Parti-colored sheep contain both dark and bright facial regions and therefore provide richer contrast and texture cues. These observations motivate a color-adaptive recognition framework that explicitly accounts for coat-color-dependent visual characteristics.
To address these issues, this paper proposes a color-adaptive sheep face recognition method. The method uses coat-color-dependent photometric differences as a unified design cue, coordinating routing, preprocessing, feature extraction, and loss design around reflectance consistency and illumination invariance. The main contributions are as follows: (1) a MobileNetV3-based coat color classifier is designed to route images to dedicated recognition models; (2) Retinex-Guided Gradient Perception Convolution (RGPConv) is introduced to embed Retinex physical priors into convolution and generate spatially adaptive modulation maps from illumination-related features; (3) a Multi-scale Channel Attention Fusion (MCAF) module is designed to integrate multi-level features; and (4) differentiated preprocessing pipelines, RGPConv configurations, and reflectance-consistency constraints are designed for black-faced and white-faced sheep.
Experimental results show that the proposed method achieves an overall recognition accuracy of 96.08%, improving the baseline accuracy of 94.58% by 1.50 percentage points. Compared with the corresponding routing-only subset baselines, accuracy improves by 2.41 percentage points for black-faced sheep and by 2.00 percentage points for white-faced sheep, reducing the performance imbalance caused by coat-color differences.
2. Related Work
Early sheep face recognition studies mainly relied on traditional feature descriptors. Corkery et al. [4] used Principal Component Analysis (PCA) to extract features from sheep face images and verified the feasibility of the task on a small dataset. Tharwat et al. [5] compared handcrafted descriptors, including Local Binary Pattern (LBP) and Histogram of Oriented Gradients (HOG), for livestock identification.
With the development of deep learning, convolutional neural networks have become the dominant approach. Ning et al. [6] improved goat face recognition by adding SimAM attention and CARAFE upsampling to YOLOv5s. Xue et al. [7] studied multi-view appearance fusion for goat identification and proposed a strategy that balances accuracy, computation, and time cost. Huang et al. [8] proposed DWT-GoatNet by combining wavelet transform and convolutional networks, achieving high accuracy under different lighting conditions. Zhang et al. [9] designed a lightweight sheep face recognition model with knowledge distillation and attention modules for edge deployment. These studies are mainly closed-set methods; they perform well when all test individuals are known, but they cannot reject unknown individuals.
Open-set recognition must accept same-individual pairs and reject different-individual pairs, making it more suitable for practical farm scenarios. However, open-set sheep face recognition is still at an early stage. Xue et al. [10] constructed SheepBase with 6559 images of Inner Mongolia fine-wool sheep and Sunite sheep and proposed SheepFaceNet based on Euclidean metric learning. With SheepFaceRepair for face alignment, the method achieved 89.12% accuracy in open-set recognition, although its cross-scene robustness still requires further verification. We [3] proposed Li-SheepFaceNet, which uses lightweight Seesaw blocks and Li-ArcFace to learn discriminative angular features. Sun et al. [11] proposed LAD-RCNN for cross-livestock face detection and normalization, providing a useful preprocessing reference for sheep face recognition.
Despite this progress, most existing open-set sheep face recognition methods still use a “one-size-fits-all” pipeline. They do not fully consider the visual differences among black-faced, white-faced, and parti-colored sheep. Black-faced sheep images are dark but often contain rich local gradients; white-faced sheep images are bright but have weak texture contrast; and parti-colored sheep contain mixed dark and bright regions. A unified pipeline can therefore produce biased performance across coat-color groups. In addition, standard convolution has limited sensitivity to subtle texture cues in low-contrast regions. These limitations motivate the proposed color-adaptive strategy and the Retinex-guided gradient perception convolution.
3. Color-Adaptive Sheep Face Recognition Method
The proposed method uses coat-color-dependent imaging characteristics as the design basis of the framework. Coat color is used not only for image routing, but also to guide preprocessing, feature extraction, and loss design. Specifically, preprocessing compensates for coat-color-specific brightness distributions; RGPConv adaptively modulates gradient enhancement according to illumination-related features; and the loss design encourages reflectance consistency under illumination variation. Together, these components form a physically motivated pipeline for illumination-invariant feature learning. The framework consists of a coat color classifier, color-adaptive preprocessing, an RGPConv-based feature extractor, an MCAF module, and a Li-ArcFace classifier. Each dedicated model shares the same overall architecture but uses hyperparameters optimized for its coat-color group. The overall framework is shown in Figure 1.
Figure 1.
Overall architecture of the color-adaptive sheep face recognition framework.
3.1. Coat Color Classifier Design
Analysis of LSFW shows that coat color strongly affects baseline performance. Li-SheepFaceNet performs best on parti-colored sheep, followed by black-faced sheep, and performs worst on white-faced sheep. The Fisher Discriminant Ratio (FDR) [12] is further used to quantify inter-class separability, where a higher FDR indicates stronger class discrimination. Parti-colored sheep have the highest FDR, black-faced sheep rank second, and white-faced sheep have the lowest FDR. This pattern is consistent with the visual characteristics of each coat color. In HSV space, the V-channel values of black-faced sheep are mainly in the 30–80 range, while those of white-faced sheep are mainly in the 180–230 range. Parti-colored sheep contain both dark and bright regions, providing richer texture cues. Accurate coat color classification is therefore necessary for the dedicated-model strategy.
As shown in Figure 2, the coat color classifier adopts MobileNetV3-Small [13]. The backbone starts with a 3 × 3 convolution (stride = 2), followed by inverted residual BNeck modules whose channels expand from 16 to 576. Each BNeck contains 1 × 1 pointwise expansion, depthwise convolution, SE attention, and 1 × 1 pointwise projection, with residual connections where applicable. Global Average Pooling (GAP) and a 1 × 1 convolution produce a 1024-dimensional feature. The classification head contains fully connected layers (576 → 1024 → 3), Hardswish activation, Dropout, and Softmax, producing probabilities for black-faced, white-faced, and parti-colored sheep. The model is initialized with ImageNet pre-trained weights and optimized using cross-entropy loss:
where N is the number of samples per batch, is the ground-truth label of sample i for class c, and is the predicted probability. Through end-to-end learning, the model extracts color, texture, and spatial features, improving classification stability for boundary samples compared with traditional HSV thresholding.
Figure 2.
Architecture of the color classifier network.
3.2. Color-Adaptive Preprocessing Strategy
Images from different coat-color groups exhibit distinct visual characteristics. In the LSFW dataset, the average V-channel values of black-faced sheep are mainly concentrated in the 30–80 range, whereas those of white-faced sheep are mainly in the 180–230 range. This brightness difference motivates differentiated preprocessing strategies.
Black-faced sheep dedicated preprocessing pipeline: The first step applies Gamma correction to enhance overall brightness. Gamma correction is a nonlinear grayscale transformation method [14] that adjusts image brightness through a power-law function. When , it improves the visibility of dark-region details:
where is the input pixel, is the corrected output, and γ is the correction parameter.
Contrast enhancement is then performed through a linear transformation. The gain coefficient controls contrast intensity, and the offset controls the overall brightness level:
with contrast gain α and brightness offset β.
White-faced sheep dedicated preprocessing pipeline: Contrast Limited Adaptive Histogram Equalization (CLAHE) is first applied. CLAHE [15] divides an image into local blocks and performs histogram equalization within each block while limiting contrast amplification. It is therefore suitable for local contrast enhancement in high-brightness images:
where is the CLAHE output, c is the contrast limit, and t is the block grid size.
The next step applies Laplacian sharpening to enhance edge details. The Laplacian operator is a second-order differential operator that detects abrupt grayscale changes; adding it to the original image enhances edge and texture information [16]:
with sharpening intensity and Laplacian operator .
Parti-colored sheep contain both high-reflectance white regions and low-reflectance black regions, producing richer texture and illumination distributions. Therefore, the network can learn robust representations with the standard Li-SheepFaceNet preprocessing pipeline without additional targeted compensation.
3.3. RGPConv-Based Feature Extraction
Sheep face images show clear coat-color-dependent photometric differences. Black-faced sheep usually have low overall brightness but dense gradient information, whereas white-faced sheep have high brightness and weak texture contrast. These illumination-dependent differences require convolution operators that can adaptively enhance gradients according to local lighting, rather than relying only on fixed kernels to extract absolute intensity features. Retinexformer [17] has shown the effectiveness of Retinex priors for low-light enhancement. Existing dynamic convolution methods, such as CondConv [18], ODConv [19], and FDConv [20], can adapt convolutional weights from input features, but their modulation relies on data-driven statistics without explicitly incorporating illumination-related physical constraints. Brightness-guided Retinex decomposition [21] further demonstrates the value of illumination–reflectance separation, but it is mainly designed for pixel-space image enhancement. Based on these observations, this study introduces Retinex priors into the gradient enhancement mechanism of convolution and designs Retinex-Guided Gradient Perception Convolution (RGPConv), which generates modulation maps from illumination-related components in feature space to achieve illumination-aware adaptive gradient extraction.
Specifically, according to Retinex theory [22], an image I can be decomposed into the element-wise product of reflectance R and illumination L:
where ⊙ denotes element-wise multiplication, R represents the inherent texture and color properties of the object, and L represents the ambient illumination conditions. Taking the gradient of I yields the following:
Equation (7) shows that the observed gradient contains both texture information and illumination variation. The texture term is modulated by L: it is compressed under low illumination and amplified under high illumination. The second term introduces pseudo-gradients at illumination boundaries that are unrelated to reflectance. Therefore, robust extraction of requires compensation based on L and suppression of the interference term . Rather than performing explicit pixel-space Retinex decomposition for image reconstruction, this paper uses the Retinex assumption to modulate gradient responses and constructs an illumination-aware operator, RGPConv, that embeds Retinex physical priors into convolution. The key idea is to adapt the gradient enhancement strength according to local illumination, thereby improving robustness to illumination variation.
As shown in Figure 3, RGPConv follows a three-stage architecture: “decomposition–modulation–enhancement”. A lightweight Retinex decomposition module first decomposes the input feature F into reflectance-analogous and illumination-analogous components in the learned feature space. To estimate illumination reliably, two depthwise separable convolution branches are used to capture local and broader illumination structures while keeping the computation lightweight:
Figure 3.
Structure diagram of Retinex-Guided Gradient Perception Convolution (RGPConv). In the figure, ∗ denotes convolution, the circle with a slash denotes element-wise division, the circle with a dot denotes element-wise multiplication, and + denotes element-wise addition.
Subsequently, the dual-scale estimates are adaptively fused through pointwise convolution, and the reflectance component is computed:
where denotes concatenation along the channel dimension, and fuses the dual-scale illumination estimates into a single map. The 3 × 3 kernel captures local illumination details, while the 7 × 7 kernel models non-smooth illumination boundaries with a larger receptive field. Their fusion improves the perception of non-uniform illumination and helps suppress pseudo-gradient interference caused by the term. denotes 3 × 3 depthwise separable convolution, σ is the Sigmoid function, ⊘ denotes element-wise division, and ϵ is a numerical stability constant. The Sigmoid range also satisfies the Retinex constraint L > 0.
This decomposition uses the Retinex physical structure as an inductive bias. Shallow CNN features are closely related to the low-frequency illumination distribution of the input image, so the decomposition–modulation–enhancement structure is reasonable in feature space. Unlike RetinexNet, Retinexformer, and other image restoration methods that perform explicit pixel-space Retinex decomposition, the proposed method embeds decomposition inside the convolution operator to guide gradient enhancement. This transfers Retinex physical priors to feature extraction and enables end-to-end optimization without paired image supervision. In addition, the differential convolution operates on the reflectance component. According to the quotient rule, this operation implicitly contains the correction term and can reduce the dependence of gradient extraction on when the illumination estimate is accurate. Multi-scale fusion improves estimation near abrupt illumination boundaries; the Sigmoid constraint and reduce the risk of numerical explosion when ; and the clamp operation limits the modulation map to , suppressing noise amplification in extreme illumination regions.
Subsequently, the illumination component is used to generate a spatially adaptive modulation map that controls the gradient enhancement intensity at each spatial position:
where denotes pointwise convolution, and the output is constrained to . The modulation map has a clear physical meaning. In low-illumination regions where is small, M tends toward and strengthens gradient extraction to compensate for illumination compression. In high-illumination regions where Fl is large, M tends toward and suppresses gradient enhancement to avoid noise amplification. This design approximates the inverse compensation effect of L in Equation (7). The inverse relationship is learned through end-to-end training. The mean weights of the converged black-faced and white-faced sheep models are −0.23 and −0.31, respectively, indicating compensation behavior consistent with the physical expectation.
Finally, differential convolution is applied to the reflectance component to extract gradient features. The differential convolution kernel is constructed by subtracting the spatial mean from the standard convolution kernel:
where k is the spatial size of the convolution kernel, and Ω is the spatial index set of the convolution kernel. The final output of RGPConv fuses the standard convolution branch and the modulated gradient enhancement branch:
where is the standard convolution output, which preserves global feature information, and is the gradient feature weighted by the modulation map. The enhancement weight is spatially adaptive rather than globally fixed. Moreover, enhancement is applied to the reflectance component instead of the original feature, reducing illumination interference in gradient extraction. The modulation map is derived from the illumination component; it carries a clear physical interpretation. Compared with existing adaptive convolutions, RGPConv differs in two main aspects. First, M is directly generated from Fl and approximates the 1/L compensation coefficient, whereas dynamic convolutions such as CondConv and ODConv learn weights from global features without Retinex constraints. Second, differential convolution operates on the de-illuminated component rather than F, thereby reducing illumination interference at the source.
According to the Weber–Fechner law [23], perceived brightness change is inversely related to background brightness. In sheep face images, the V-channel values of black-faced sheep are mainly in the low-brightness range (30–80), whereas those of white-faced sheep are mainly in the high-brightness range (180–230). For the same absolute gradient change, black-faced sheep therefore show higher relative contrast, while white-faced sheep show lower relative contrast. This analysis suggests that RGPConv should use different configurations for different coat colors:
The black-faced sheep model adopts a strong-gradient mode with a 3 × 3 differential convolution kernel and a modulation range of [0.3, 0.8]. The higher lower bound preserves gradient enhancement even in relatively bright regions, which helps exploit the dense gradient information of black-faced sheep images (average gradient magnitude approximately 18.7). The white-faced sheep model adopts a texture-protection mode with a 5 × 5 differential convolution kernel and a modulation range of [0.1, 0.5]. The larger kernel expands the receptive field and smooths noise, while the lower modulation range limits noise amplification in bright regions. In addition, the white-faced model uses a denoising gate based on the spatial distribution of the illumination component to suppress noisy gradient responses. These differentiated settings adapt RGPConv to the visual characteristics of each coat-color group.
3.4. MCAF-Based Feature Fusion
In sheep face recognition, discriminative cues appear at different semantic levels for different coat colors. Black-faced sheep mainly rely on mid-level gradient textures, whereas white-faced sheep depend more on low-level fine textures. The color-adaptive framework therefore needs a fusion mechanism that can integrate multi-level features in a coat-color-aware manner. Multi-scale feature fusion is widely used in computer vision to combine information from different resolutions. For example, Lin et al. [24] proposed the Feature Pyramid Network (FPN), which uses top-down pathways and lateral connections for object detection. Based on the three-stage architecture of Li-SheepFaceNet, the proposed MCAF mechanism uses channel attention to adaptively allocate weights across feature levels [25].
As shown in Figure 4, MCAF integrates multi-scale features through three stages. First, the network extracts three feature maps from the input image:
where F1, F2, and F3 are the low-level, mid-level, and high-level feature maps, respectively.
Figure 4.
Principle of Multi-scale Channel Attention Fusion (MCAF) mechanism. The circle with a dot denotes element-wise multiplication between channel weights and feature maps.
Stage 1: Adaptive channel attention weighting. A dedicated channel attention module is applied to each feature layer. Global average pooling first compresses the spatial dimensions into channel descriptors:
Channel weights are then generated using a dimensionality-reduction fully connected layer, ReLU activation, a dimensionality-expansion fully connected layer, and Sigmoid activation:
where is the dimensionality-reduction matrix, is the dimensionality-expansion matrix, and σ is the Sigmoid function. The weighted features are .
Stage 2: Spatial scale unification. Bilinear interpolation upsamples the low-level and mid-level features, and the aligned features are concatenated along the channel dimension.
Stage 3: Dimensionality compression and feature fusion. A 1 × 1 convolution performs cross-channel interaction and dimensionality compression:
MCAF converts the original 320-channel concatenated representation into a 128-channel fused feature, reducing redundancy and improving discrimination efficiency. Through channel attention, it adaptively weights different feature levels: low-level features provide texture details, mid-level features provide discriminative semantic cues, and high-level features provide global structural constraints. This design also matches the visual differences among coat colors. The black-faced sheep model tends to emphasize mid-level semantic features to exploit dense gradient information, whereas the white-faced sheep model assigns more weight to low-level texture features to compensate for weak texture contrast.
3.5. Loss Function Design
This paper adopts the Li-ArcFace loss function proposed in our previous work [3]. Li-ArcFace is designed for sheep face recognition by applying a linear transformation to the angular mapping of the traditional ArcFace:
where is the logit value for class j, s is the scale factor, and the modified angle is calculated as follows: for the ground truth class, an angular margin m is added to the original angle. is the angle between the feature vector and the class weight vector:
Compared with traditional ArcFace, this linear transformation improves training stability, which is useful for small-sample animal face recognition. Because photometric characteristics differ across coat colors, the two dedicated models use different margins. The black-faced sheep model uses a smaller margin to match its dense gradient information, while the white-faced sheep model uses a larger margin to improve compactness under low-contrast conditions.
To reduce overfitting and improve generalization, Label Smoothing [26] is introduced. It softens hard labels by reducing the probability assigned to the true class and assigning small probabilities to other classes:
where is the soft label probability for class i, is the Kronecker delta function, K is the number of classes, and ε is the smoothing parameter. This strategy reduces overconfidence and smooths the decision boundary.
To address the sensitivity of white-faced sheep images to illumination changes, two auxiliary loss functions are designed with clearly separated responsibilities: an illumination consistency loss that operates on the final embedding space and a reflectance consistency loss that operates on the intermediate reflectance-analogous features produced by RGPConv.
Illumination consistency loss. This loss constrains the feature representations of the same individual to remain consistent under different illumination conditions:
where is the set of image pairs of the same sheep captured under different brightness conditions within the training set (see Section 4.2 for pair construction details), is the number of image pairs, and , are the corresponding embedding vectors.
Reflectance consistency loss. This loss directly constrains the reflectance-analogous component produced by the RGPConv decomposition module, enforcing that the intrinsic texture representation of the same individual is invariant to illumination changes:
where and are the reflectance-analogous feature maps of the same individual under different illumination conditions. Unlike which operates on the final embedding, provides a direct supervisory signal to the Retinex decomposition module, encouraging it to produce illumination-invariant reflectance features.
The total loss function of the white-faced sheep model combines the three losses through weighted summation:
where α is the illumination consistency loss weight, and β is the reflectance consistency loss weight. The two auxiliary losses have complementary roles: ensures global feature-level illumination invariance, while directly regularizes the intermediate Retinex decomposition to produce physically meaningful reflectance features. The black-faced sheep model uses only as its training loss, since its low-brightness images benefit primarily from gradient enhancement via RGPConv rather than explicit illumination consistency constraints.
3.6. Method Workflow
The implementation of the proposed method consists of a training phase and a testing phase.
During training, the coat color classifier routes images to the corresponding dedicated recognition model. Each dedicated model uses Li-ArcFace to learn a discriminative embedding space from known individuals in the training set, and the network parameters are updated by backpropagation until convergence.
The testing phase uses an open-set verification protocol. Unlike closed-set classification, which assigns each input to a class observed during training, the test individuals are unseen during training. The model therefore does not identify a specific identity; instead, it determines whether two images belong to the same individual in the learned metric space. For each image pair, sheep face detection, coat color classification, and feature extraction are performed separately. The two images are then processed by the same dedicated model, and cosine similarity is computed between their feature vectors. If the similarity is greater than a preset threshold τ, the pair is accepted as the same individual; otherwise, it is rejected as different individuals. TPR and TNR are used as the core evaluation dimensions of open-set verification. Figure 5 illustrates the complete workflow.
Figure 5.
Flowchart of the proposed sheep face recognition method.
4. Experiments
4.1. Dataset Sources
This study uses three datasets: LSFW for model training and in-domain evaluation, and RealSheepFace and GoatFace for cross-domain testing. LSFW contains 3801 multi-view facial images from 212 Ujimqin sheep. According to facial coat color, it is divided into 75 black-faced sheep, 55 white-faced sheep, and 82 parti-colored sheep. RealSheepFace contains images from 42 sheep, including 3 black-faced, 13 white-faced, and 26 parti-colored sheep, and is used for cross-scene open-set testing. GoatFace contains 10 white-faced goats, each with 20 images, and is used for cross-species open-set testing. Since cross-scene data collection is costly and access to additional breeds is limited, the current cross-domain datasets remain limited in scale. Therefore, the in-domain experiments provide the main quantitative evaluation, while the cross-domain datasets are used as preliminary transferability probes. Larger-scale cross-domain validation will be conducted in future work as more data become available from cooperative farms.
4.1.1. Multi-View Sheep Face Dataset LSFW
The LSFW data were collected at the Zhimu Cooperative in Xilingol League, Inner Mongolia Autonomous Region, between 8:00 and 10:00 a.m. in April 2023. Three MOKOSE C100 cameras (Shenzhen Yunlang Technology Co., Ltd., Shenzhen, China) were installed along a sheep-pen corridor. The center camera was mounted 1.3 m above the ground, while the left and right cameras were mounted 0.8 m above the ground and angled inward at 30 and 45 degrees, respectively. Multi-angle facial videos of 212 Inner Mongolia Ujimqin sheep were recorded at 60 FPS with a resolution of 1920 × 1080. During recording, each sheep walked slowly through the corridor in an uncontrolled state. Facial images were extracted from the videos after duplicate frames were removed, and images from different views were stored by individual identification number.
LSFW has clear coat-color diversity. Its 212 sheep can be grouped into black-faced, white-faced, and parti-colored categories, and these groups show different photometric characteristics. Black-faced sheep have low overall brightness, and facial regions often blend with dark fur, reducing local contrast. White-faced sheep have high brightness and may suffer from overexposure under strong light, which weakens texture details. Parti-colored sheep contain both black and white regions, producing richer contrast and texture cues. These differences motivate adaptive processing for different coat colors. Representative LSFW samples are shown in Figure 6.
Figure 6.
LSFW dataset samples.
4.1.2. Cross-Scene Sheep Face Dataset RealSheepFace
To evaluate cross-scene recognition, RealSheepFace was collected at the No. 3 Ranch of Hailar Nuomin Company, Hulunbuir City, Inner Mongolia Autonomous Region. Data were recorded between 5:00 and 6:00 a.m. on 7 October 2023, using a MOKOSE C100 visible-light camera mounted 1.2 m above the sheep-pen corridor. Multi-angle facial videos of 42 Inner Mongolia Ujimqin sheep were captured at 30 FPS with a resolution of 1280 × 720.
RealSheepFace was collected under variable farm conditions, including bright sunlight, overcast diffuse light, and low-angle dawn light. The environment also contains dust, grass debris, other sheep, and farm facilities in the background. Because of practical collection constraints, the number of images differs across individuals, reflecting the imbalance often present in real farm data. These characteristics make RealSheepFace suitable for probing practical cross-scene challenges. Representative RealSheepFace samples are shown in Figure 7.
Figure 7.
RealSheepFace dataset samples.
4.1.3. Cross-Species Sheep Face Dataset GoatFace
To further evaluate cross-species recognition, this study uses a publicly available animal face dataset [27] to construct GoatFace. The dataset contains 10 visually similar milky-white goats, each with 20 images.
4.2. Dataset Configuration
This study includes two training tasks, coat color classification and sheep face recognition, which use different data partition strategies.
Coat color classifier data partition: The coat color classification task adopts an individual-level partition strategy, randomly selecting 182 out of 212 sheep for the training set, with the remaining 30 for the test set. The training set contains a total of 3547 images, and the test set contains a total of 254 images.
Sheep face recognition data partition: Open-set recognition in this study follows a metric-learning-based verification paradigm rather than classifier-based open-set classification. Open-set classification identifies known classes while rejecting unknown samples. In contrast, open-set verification evaluates whether two images belong to the same individual, although the test individuals were never seen during training. This protocol follows the LFW face verification benchmark [28] and has been widely used in face and sheep face recognition [3,8]. Each coat-color subset is partitioned independently, ensuring no individual-level overlap across the training, validation, and test sets. For the black-faced sheep subset, 45 of 75 individuals are used for training, 10 for validation, and 20 for testing. For the white-faced sheep subset, the split is 33/7/15, and for the parti-colored sheep subset, it is 50/10/22. All images from training individuals are used for model optimization; validation pairs are used for threshold determination and hyperparameter selection; and test individuals are used only for final evaluation.
Test pair generation and evaluation protocol: Following the LFW protocol, model evaluation is based on image pair matching. In the in-domain open-set experiments, 600 test pairs are randomly generated for each coat-color subset, including 300 same-individual pairs and 300 different-individual pairs. For the in-domain LSFW comparison experiments, each method was evaluated over four independent random test-pair generations. In the cross-scene experiments, 30 pairs are generated for black-faced sheep and 64 pairs for white-faced sheep. In the cross-species experiments, 200 pairs are generated for the white-faced subset. During testing, feature vectors are extracted for each pair, and cosine similarity is computed. Given a threshold τ, a pair is predicted as the same sheep if its similarity is greater than or equal to τ; otherwise, it is predicted as different sheep.
Illumination consistency training pair construction: The image pairs used for and are constructed from naturally captured training images, not from synthetic brightness augmentation. Because LSFW was collected across three mornings with different weather and lighting conditions, each training individual has images under different natural illumination, such as direct sunlight, overcast light, and dawn/dusk lighting. In each training batch, positive pairs are selected from the same individual when their V-channel brightness difference is greater than 15 on a 0–255 scale. This real-data pairing strategy encourages illumination invariance from genuine farm illumination changes rather than synthetic artifacts.
Threshold determination method: The recognition threshold τ is determined exclusively on the validation set. For each coat color subset, 200 image pairs (100 same-individual pairs and 100 different-individual pairs) are generated from the validation set individuals. The optimal threshold is selected as the value that maximizes accuracy on these validation pairs:
The selected threshold is then fixed and directly applied to the test set without further adjustment. This procedure ensures that test set performance reflects genuine generalization rather than threshold overfitting.
4.3. Experimental Configuration and Evaluation Metrics
All experiments were conducted on a server equipped with an NVIDIA Tesla P100 GPU (16 GB), an Intel Xeon E5-2686 v4 CPU, and 16 GB memory. The software environment included PyTorch 1.12.0, Python 3.8.10, CUDA 11.3, and OpenCV 4.5.5.
The black-faced sheep dedicated model uses a batch size of 64 and the SGD optimizer with cosine annealing learning rate scheduling. The initial learning rate is 0.03. The network uses a 5/6/3 three-stage depth configuration, consistent with the three-layer feature fusion design of MCAF, and the embedding dimension is 512. RGPConv uses a 3 × 3 differential convolution kernel and a modulation range of [0.3, 0.8], based on the low-illumination characteristics of black-faced sheep images (average V-channel value approximately 52). The ArcFace scale factor is , and the angular margin is , selected by grid search over {0.10, 0.15, 0.20, 0.25} on the validation set. The dropout rate is 0.05, the Label Smoothing parameter is , the number of training epochs is 150, and the recognition threshold is (selected on the validation set).
The white-faced sheep dedicated model uses the same network architecture but different hyperparameters to address high brightness and weak gradients. RGPConv uses a 5 × 5 differential convolution kernel to expand the receptive field and smooth noise, with a modulation range of [0.1, 0.5]. The lower upper bound limits gradient enhancement and reduces noise amplification in bright regions. The ArcFace angular margin is , larger than that of the black-faced model, encouraging more compact intra-class feature distributions under illumination variation. In addition, the illumination consistency loss weight is (selected from {0.1, 0.2, 0.3, 0.4, 0.5} on the validation set), and the reflectance consistency loss weight is (selected from {0.1, 0.2, 0.3} on the validation set). The recognition threshold is (selected on the validation set), slightly higher than that of the black-faced model to accommodate the low-contrast characteristics of white-faced sheep images.
4.3.1. Coat Color Classifier Evaluation Metrics
The coat color classification task follows a closed-set category classification protocol. The individual sheep in the test set are unseen during training, but the coat color categories are predefined. The evaluation metrics include overall accuracy and per-class accuracy. Overall accuracy is defined as follows:
where is the number of correctly classified samples, and is the total number of samples.
4.3.2. Sheep Face Recognition Evaluation Metrics
The sheep face recognition task follows an open-set verification protocol. Test individuals are unseen during training, and the model determines whether two images belong to the same sheep. Image-pair verification is evaluated using the following metrics:
Recognition accuracy (Accuracy) is the proportion of correctly predicted image pairs among all test pairs. is the number of same-individual pairs correctly predicted as the same sheep, is the number of different-individual pairs correctly predicted as different sheep, and is the total number of test pairs.
True Positive Rate (TPR) is the proportion of correctly identified same-individual pairs, where P is the total number of same-individual pairs (300 pairs).
True Negative Rate (TNR) is the proportion of correctly rejected different-individual pairs, where N is the total number of different-individual pairs (300 pairs).
False Accept Rate (FAR) is the proportion of different-individual pairs incorrectly judged as the same individual, where is the number of such false accepts.
False Reject Rate (FRR) is the proportion of same-individual pairs incorrectly judged as different individuals, where is the number of such false rejects.
FAR and FRR are core metrics for open-set recognition and usually involve a trade-off: reducing FAR may increase FRR, and vice versa. The recognition threshold τ directly affects this balance; the threshold is selected on the independent validation set.
EER, AUC, and TAR@FAR = 1% are also reported to evaluate threshold-independent discrimination and low-FAR recognition performance. EER denotes the point where FAR equals FRR. AUC measures the overall ranking ability between positive and negative pairs across thresholds. TAR@FAR = 1% measures the true accept rate when the false accept rate is constrained to 1%, which is relevant to deployment scenarios with many negative pairs.
5. Experimental Results and Analysis
5.1. Coat Color Classifier Performance Analysis
The coat color classifier is built on MobileNetV3-Small [13] and trained with transfer learning. The optimization settings are as follows: Adam optimizer (, ), initial learning rate of 0.001 with cosine annealing, batch size of 32, and 30 training epochs. Data augmentation includes random horizontal flipping (probability 0.5), random rotation, and color jittering.
Table 1 records the training performance of the coat color classifier. The model converges rapidly: test accuracy increases from 60.78% to 93.14% between Epochs 1 and 5, reaches 99.51% by Epoch 15, and remains at 100.00% from Epochs 20 to 30. Compared with the traditional HSV threshold method, whose accuracy fluctuates between 80% and 98.58%, the MobileNetV3-Small classifier provides more stable performance under illumination variation and boundary samples.
Table 1.
Performance indicators of color classifier training process.
5.2. Physical Interpretability Verification of RGPConv
To examine whether RGPConv follows the Retinex prior , three complementary analyses are conducted using the trained black-faced and white-faced models: (1) the statistical relationship between pixel brightness and modulation values, (2) the learned kernel weight distribution, and (3) feature-space decomposition visualization including illumination-response analysis.
- (1)
- Modulation Map–Brightness Correlation Analysis
For each test image, the per-pixel brightness (V channel) and the corresponding modulation value M are computed. Figure 8 and Figure 9 show the scatter plots and Pearson correlation coefficients for the black-faced and white-faced models, respectively.
Figure 8.
Scatter plot of modulation map M vs. input brightness for the black-faced sheep model (Pearson r = −0.942).
Figure 9.
Scatter plot of modulation map M vs. input brightness for the white-faced sheep model (Pearson r = −0.943).
As shown in Figure 8 and Figure 9, both models exhibit strong negative correlations (r < −0.94, p < 10−6), indicating that darker regions receive larger modulation values. This is consistent with the intended role of M as an inverse illumination compensation coefficient rather than an arbitrary attention map.
- (2)
- RGPConv Weight Distribution Analysis
Figure 10 shows the weight value distributions of the RGPConv differential convolution kernels after training.
Figure 10.
Weight distribution histograms of RGPConv differential convolution kernels for black-faced (left) and white-faced (right) models. Orange bars in the right panel denote the white-faced model histogram, and the black vertical line denotes the learned modulation weight.
As shown in Figure 10, the distributions are approximately zero-centered, which is consistent with differential gradient extraction because constant-intensity regions are suppressed, while boundary responses are retained. The black-faced model contains a slightly higher proportion of negative weights (51.5%) than the white-faced model (44.9%), suggesting stronger gradient emphasis for low-brightness faces.
- (3)
- Feature-Space Retinex Decomposition and Illumination Response Visualization
Representative test images are visualized with their illumination maps , reflectance maps , and modulation maps M. Figure 11 and Figure 12 show the decomposition results for black-faced and white-faced sheep, respectively. To further verify the illumination-response behavior, Figure 13 presents three images of the same white-faced individual (sheep110) under different brightness conditions.
Figure 11.
Retinex-guided decomposition and modulation visualization for black-faced sheep: (from left) input image, brightness map, , , and M. In the heatmaps, warmer colors indicate larger normalized values and cooler colors indicate smaller normalized values. The display range of M is adjusted per sample; row labels report actual mean values.
Figure 12.
Retinex-guided decomposition and modulation visualization for white-faced sheep: (from left) input image, brightness map, , , and M. In the heatmaps, warmer colors indicate larger normalized values and cooler colors indicate smaller normalized values.
Figure 13.
RGPConv response to different illumination intensities for the same white-faced sheep110 individual. In the heatmaps, warmer colors indicate larger normalized values and cooler colors indicate smaller normalized values. As brightness decreases, the mean modulation value increases.
As shown in Figure 11 and Figure 12, the illumination map captures smooth, low-frequency spatial variation that follows the global brightness distribution, consistent with the Retinex assumption. The reflectance map preserves high-frequency facial texture while suppressing global brightness variation. The modulation map M takes higher values in dark regions and lower values in bright regions, matching the 1/L compensation principle. For black-faced samples, modulation remains relatively strong because of overall low facial brightness; for white-faced samples, modulation varies more around shadows and facial contours. In Figure 13, the same-individual triplet makes the inverse relationship explicit: as mean gray value decreases from 0.488 to 0.310, the mean modulation value increases from 0.247 to 0.302, confirming stronger compensation under lower illumination. These results indicate that RGPConv successfully embeds Retinex physical priors into feature extraction without explicit pixel-space image reconstruction.
5.3. Sheep Face Recognition Model Comparison Experiments
To evaluate the proposed method, the color-adaptive model is compared with several mainstream deep learning backbones on LSFW. All methods follow the same open-set recognition protocol.
Table 2 reports the average values over the four runs. Each run contained 600 test pairs, including 300 same-individual pairs and 300 different-individual pairs. The standard deviation of accuracy across the four runs ranged from 0.18 to 0.41 percentage points across all compared methods. As shown in Table 2, the proposed color-adaptive model achieves the highest overall accuracy, 96.08%, among all compared methods. iResNet-50 reaches 89.58%, ViT-s reaches 90.75%, EffNet-B0 reaches 92.88%, and ConvNeXt-T reaches 93.54%, suggesting that generic modern backbones do not necessarily capture local sheep facial textures effectively under this protocol. MobileFaceNet obtains 94.42%, while Li-SheepFaceNet reaches 94.58%. Among adaptive convolution methods, Li-SFN + ODConv (95.75%) outperforms Li-SFN + CondConv (95.08%), showing the benefit of multi-dimensional attention. However, these data-driven adaptive convolutions do not include explicit physical priors. Li-SFN + RGPConv (95.42%) uses RGPConv as a drop-in replacement without coat color routing or MCAF, so its performance remains below the full framework. Notably, ODConv outperforms RGPConv when each operator is used as a standalone replacement in Li-SFN. Therefore, RGPConv should not be interpreted as the strongest standalone adaptive convolution in this experiment. Its main value lies in introducing Retinex-guided physical priors and working jointly with coat-color routing, color-specific preprocessing, and MCAF in the complete framework. Li-SFN + ArcFace (94.50%) is slightly lower than Li-SheepFaceNet, indicating that the Li-ArcFace margin design remains useful for this task. The full color-adaptive framework achieves an EER of 4.08% and TAR@FAR = 1% of 88.00%, both the best among the complete recognition systems. Its FLOPs are 0.27 G because each image is processed by the classifier and only one dedicated branch, which is lower than MobileFaceNet (0.45 G) and much lower than ViT-s (5.75 G) and iResNet-50 (6.33 G). Inference takes 4.2 ms per image pair (feature extraction and cosine similarity, excluding preprocessing), yielding approximately 238 pairs/s on the Tesla P100 with batch size 1.
Table 2.
Comparison of open-set recognition performance on LSFW dataset.
To account for the non-independence of image pairs sharing the same individual, an individual-level cluster bootstrap is adopted. The statistical unit is the individual sheep, not a single image pair. For each test individual i, the average accuracy difference between the proposed method and Li-SheepFaceNet is computed over all pairs involving that individual. In each of 10,000 bootstrap iterations, n individuals are sampled with replacement, and the mean accuracy difference is recomputed. Table 3 reports the mean difference, bias-corrected 95% confidence interval, bootstrap p-value, and Cohen’s d. Mean Diff. denotes the mean individual-level accuracy difference and is therefore not necessarily identical to the raw pair-level accuracy difference reported in Table 2. The confidence intervals exclude zero, and all p-values are below 0.05, indicating statistically significant improvements under individual-level analysis. The effect sizes (d = 0.48–0.68) indicate medium practical significance.
Table 3.
Statistical significance analysis (individual-level cluster bootstrap, 10,000 iterations).
5.4. Ablation Experiments and Hyperparameter Analysis
Black-Faced Sheep Dedicated Model Ablation Experiments
- (1)
- Preprocessing Module Ablation Experiments
Because black-faced sheep images are generally low in brightness, specialized preprocessing is used to improve feature visibility. Table 4 shows the contribution of each component in the black-faced sheep preprocessing pipeline.
Table 4.
Ablation experiment of black-faced sheep preprocessing modules.
As shown in Table 4, Gamma correction provides the largest single gain (+1.09 percentage points) by increasing overall brightness and making facial details clearer. Contrast enhancement further improves local feature discrimination (+0.75 percentage points). The complete pipeline achieves the best result, with a total gain of +2.50 percentage points.
White-faced sheep images require preprocessing that enhances texture while avoiding overexposure. Table 5 presents the contribution of each component in the white-faced sheep preprocessing pipeline.
Table 5.
Ablation experiment of white-faced sheep preprocessing modules.
CLAHE provides a gain of +0.58 percentage points by adaptively improving contrast while limiting overexposure. Sharpening filtering contributes +1.25 percentage points by enhancing texture features. The complete pipeline improves accuracy by +2.83 percentage points, indicating that white-faced sheep benefit more from preprocessing because their facial textures are weaker and more easily affected by lighting.
- (2)
- RGPConv Hyperparameter Analysis
RGPConv has two key hyperparameters: differential kernel size and modulation map range. This section analyzes both. The differential-kernel screening experiment is reported in Table 6, and the modulation-range screening experiments are reported in Table 7 and Table 8. These validation-set screening experiments use a reduced 50-epoch schedule for efficient search. The final models are then retrained from scratch for 150 epochs using the selected hyperparameters.
Table 6.
Effect of RGPConv differential kernel size on recognition performance.
Table 7.
Impact of RGPConv modulation map parameters on black-faced sheep recognition performance.
Table 8.
Impact of RGPConv modulation map parameters on white-faced sheep recognition performance.
Table 6 shows the effect of differential kernel size. For black-faced sheep, the 3 × 3 kernel performs best because it captures dense local gradients, whereas larger kernels blur useful high-frequency information. For white-faced sheep, the 5 × 5 kernel performs best because it expands the receptive field and smooths noise. The 3 × 3 kernel is more sensitive to noise, while the 7 × 7 kernel over-smooths the limited texture information. These results support the differentiated RGPConv configurations.
Table 7 reports the effect of modulation range for the black-faced sheep model with a fixed 3 × 3 kernel. The range [0.3, 0.8] gives the best performance. A smaller range, such as [0.1, 0.4], provides insufficient compensation for low-illumination regions. A larger range, such as [0.5, 1.0], introduces more noise in brighter regions and reduces TNR. This result is consistent with Retinex gradient compensation: black-faced sheep images require stronger dark-region enhancement while still avoiding excessive amplification.
Table 8 reports the effect of modulation range for the white-faced sheep model with a fixed 5 × 5 kernel. The best range is [0.1, 0.5], which is lower than the black-faced configuration. Because white-faced sheep images have high brightness and sparse gradients, the lower limits noise amplification. When the range increases to [0.3, 0.8], TNR drops from 94.67% to 92.67%, showing that excessive gradient enhancement can increase false judgments in bright images.
- (3)
- Model Architecture Ablation Experiments
To isolate the contribution of each component in the color-adaptive framework, ablation experiments are conducted with progressively added modules. “Routing only” uses coat color routing with the standard Li-SFN model (no dedicated preprocessing, no RGPConv, no MCAF, unified threshold). “+ dedicated threshold” further applies the per-color optimized threshold. “+ preprocessing” adds the coat-color-specific preprocessing pipeline. The remaining rows evaluate the architectural modules RGPConv and MCAF on top of the full preprocessing pipeline. The black-faced and white-faced architecture ablation results are reported in Table 9 and Table 10, respectively.
Table 9.
Ablation experiment of black-faced sheep specialized model architecture.
Table 10.
Ablation experiment of white-faced sheep specialized model architecture.
Table 9 and Table 10 show that routing alone provides limited improvement in recognition performance. In the black-faced sheep subset, the routing-only scheme achieves an accuracy of 94.17%, slightly lower than the Li-SheepFaceNet baseline of 94.58%. Simply partitioning samples by coat color reduces the number of training individuals available to each branch and therefore provides limited benefit by itself. Thus, routing serves only as a prerequisite for subsequent color-specific processing and cannot independently improve accuracy. The final gain comes from coat-color-guided targeted adaptation rather than simple data grouping. Dedicated thresholds provide a marginal improvement (+0.16 and +0.17 percentage points), indicating that threshold tuning is not the main driver of performance. Preprocessing contributes meaningfully (+0.59 and +0.67 percentage points over dedicated threshold), validating the coat-color-specific image normalization. Among the architectural modules, RGPConv and MCAF show complementary strengths: in the black-faced model, RGPConv contributes more (+0.66 percentage points over preprocessing) than MCAF (+0.08), whereas in the white-faced model MCAF contributes more (+0.33) than RGPConv (—0.09 alone, but +0.75 when combined). The full model achieves the highest accuracy for both coat colors (+1.66 and +1.16 over preprocessing alone), confirming that all components contribute and the improvement is not attributable to any single factor.
5.5. Cross-Domain Experiments
To probe cross-domain transferability, the models are trained on LSFW and tested on two external datasets: RealSheepFace for cross-scene recognition and GoatFace for cross-species recognition.
Table 11 and Table 12 present the cross-domain open-set recognition results. In the cross-scene setting, the unified Li-SheepFaceNet model has a relatively high FRR of 25.53%, indicating that it often misclassifies same-individual pairs as different individuals. With the color-adaptive strategy, overall accuracy improves from 84.04% to 88.30%. Accuracy increases from 90.00% to 93.33% for black-faced sheep and from 81.25% to 85.94% for white-faced sheep. In the cross-species experiment, the white-faced sheep dedicated model improves accuracy from 66.50% to 68.50%. These results suggest potential transferability to new scenes and related species, although the limited cross-domain sample size requires cautious interpretation.
Table 11.
Cross-scene open-set recognition experimental results comparisons.
Table 12.
Cross-species open-set recognition experimental results comparison.
Figure 14 shows typical cases in which errors made by the unified model are corrected by the color-adaptive strategy. The examples include two black-faced sheep and two white-faced sheep, covering both false negatives (same individual predicted as different individuals) and false positives (different individuals predicted as the same individual).
Figure 14.
Error correction examples in cross-domain open-set recognition.
6. Discussion
The experimental results suggest that the proposed framework improves recognition mainly by matching the processing pipeline to coat-color-dependent imaging characteristics, rather than simply increasing model complexity. For black-faced sheep, low facial brightness can suppress useful gradient responses in dark regions. Gamma correction, contrast enhancement, and RGPConv-based gradient perception help recover discriminative local textures. For white-faced sheep, high brightness and weak texture contrast make recognition more sensitive to overexposure and local illumination variation. CLAHE, filtering, and illumination-aware modulation therefore help preserve subtle facial details. Parti-colored sheep already contain richer contrast cues, so the standard Li-SheepFaceNet pipeline remains competitive. These observations explain why the dominant modules differ between black-faced and white-faced sheep, and why one unified pipeline is less suitable for all coat-color groups.
For practical deployment, the method is most suitable for routine farm corridor scenarios where coat-color differences, moderate viewpoint changes, and natural illumination variation are the main appearance changes. The routing strategy sends each image to a more appropriate recognition branch, and RGPConv provides illumination-guided adaptive gradient enhancement. However, the method should not be regarded as fully robust to all uncontrolled environments. Heavy mud, occlusion, seasonal wool growth, aging, body-condition changes, and extreme backlighting may alter facial texture or apparent coat color, thereby affecting routing accuracy and downstream feature extraction.
This study also has dataset-level limitations. Sheep-face datasets with reliable individual labels are still scarce, and collecting cross-scenario animal face data requires farm cooperation, stable identity annotation, repeated acquisition, and usable imaging conditions. Therefore, the external-dataset results should be interpreted as suggesting potential transferability rather than exhaustive validation. Future work will extend data collection as more cooperative farms and annotated animal-face resources become available, and will combine texture-based RGPConv features with facial landmarks or geometric structure modeling to improve robustness under occlusion, aging, and cross-breed appearance variation.
7. Conclusions
This paper proposes a color-adaptive sheep face recognition method based on Retinex-guided gradient perception convolution. The method uses coat color to coordinate image routing, preprocessing, feature extraction, and loss design. RGPConv embeds Retinex physical priors into convolution for illumination-aware gradient extraction, and MCAF integrates multi-level features. Experiments on LSFW show that the method improves open-set recognition accuracy and reduces performance disparity among coat-color groups. The cross-domain results further suggest potential cross-domain transferability.
The proposed method still has several limitations. Parti-colored sheep currently use the standard Li-SheepFaceNet pipeline, so the rich edge information at black–white boundaries has not been fully exploited. In addition, texture-based recognition may be insufficient when cross-species differences involve facial geometry. Future work will collect larger multi-scene datasets, introduce domain adaptation, and explore facial landmark or geometric structure encoding to complement RGPConv texture features.
Author Contributions
Conceptualization, Y.F. and Y.Y.; methodology, Y.F.; software, Y.F.; validation, Y.F. and T.L.; formal analysis, Y.F.; investigation, Y.F. and T.L.; resources, Y.Y.; data curation, Y.F. and T.L.; writing—original draft preparation, Y.F. and T.L.; writing—review and editing, Y.Y.; visualization, Y.F.; supervision, Y.Y.; project administration, Y.Y.; funding acquisition, Y.Y. All authors have read and agreed to the published version of the manuscript.
Funding
This research was funded by the National Key Research and Development Program of China (Grant No. 2024YFD2000304).
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
The data and code presented in this study are available on request from the corresponding author.
Conflicts of Interest
The authors declare no conflicts of interest.
Abbreviations
The following abbreviations are used in this manuscript:
| RGPConv | Retinex-Guided Gradient Perception Convolution |
| MCAF | Multi-scale Channel Attention Fusion |
| LSFW | Large-Scale Face in the Wild (sheep dataset) |
| FDR | Fisher Discriminant Ratio |
| CLAHE | Contrast Limited Adaptive Histogram Equalization |
| TPR | True Positive Rate |
| TNR | True Negative Rate |
| FAR | False Accept Rate |
| FRR | False Reject Rate |
References
- Scheirer, W.J.; Anderson, D.R.R.; Sapkota, A.; Boult, T.E. Toward Open Set Recognition. IEEE Trans. Pattern Anal. Mach. Intell. 2013, 35, 1757–1772. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Bendale, A.; Boult, T.E. Towards Open Set Deep Networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016; pp. 1563–1572. [Google Scholar]
- Li, J.; Yang, Y.; Liu, G.; Ning, Y.; Song, P. Open-Set Sheep Face Recognition in Multi-View Based on Li-SheepFaceNet. Agriculture 2024, 14, 1112. [Google Scholar] [CrossRef] [Scilit]
- Corkery, G.P.; Gonzales-Barron, U.A.; Butler, F.; McDonnell, K.; Ward, S. A Preliminary Investigation on Face Recognition as a Biometric Identifier of Sheep. Trans. ASABE 2007, 50, 313–320. [Google Scholar] [CrossRef] [Scilit]
- Tharwat, A.; Gaber, T.; Hassanien, A.E. Cattle Identification Based on Muzzle Images Using Gabor Features and SVM Classifier. In Proceedings of the 2nd International Conference on Advanced Machine Learning Technologies and Applications, Cairo, Egypt, 28–30 November 2014; pp. 236–247. [Google Scholar]
- Ning, J.; Lin, J.; Yang, S.; Wang, Y.; Lan, X. Face Recognition Method of Dairy Goat Based on Improved YOLO v5s. Trans. Chin. Soc. Agric. Mach. 2023, 54, 331–337. [Google Scholar]
- Xue, Y.; Wang, W.; Fang, M.; Guo, Z.; Ning, K.; Wang, K. Research on a High-Efficiency Goat Individual Recognition Method Based on Machine Vision. Animals 2024, 14, 3509. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Huang, L.; Qian, B.; Guan, F.; Hou, Z.; Zhang, Q. Goat Face Recognition Model Based on Wavelet Transform and Convolutional Neural Networks. Trans. Chin. Soc. Agric. Mach. 2023, 54, 278–287. [Google Scholar]
- Zhang, X.; Xuan, C.; Ma, Y.; Liu, H.; Xue, J. Lightweight Model-Based Sheep Face Recognition via Face Image Recording Channel. J. Anim. Sci. 2024, 102, skae066. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Xue, H.; Qin, J.; Quan, C.; Ren, W.; Gao, T.; Zhao, J. Open Set Sheep Face Recognition Based on Euclidean Space Metric. Math. Probl. Eng. 2021, 2021, 3375394. [Google Scholar] [CrossRef] [Scilit]
- Sun, L.; Liu, G.; Yang, H.; Jiang, X.; Liu, J.; Wang, X.; Yang, H.; Yang, S. LAD-RCNN: A Powerful Tool for Livestock Face Detection and Normalization. Animals 2023, 13, 1446. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Fisher, R.A. The Use of Multiple Measurements in Taxonomic Problems. Ann. Eugen. 1936, 7, 179–188. [Google Scholar] [CrossRef] [Scilit]
- Howard, A.; Sandler, M.; Chu, G.; Chen, L.-C.; Chen, B.; Tan, M.; Wang, W.; Zhu, Y.; Pang, R.; Vasudevan, V.; et al. Searching for MobileNetV3. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), Seoul, Republic of Korea, 27 October–2 November 2019; pp. 1314–1324. [Google Scholar]
- Poynton, C.A. Digital Video and HDTV: Algorithms and Interfaces; Morgan Kaufmann: San Francisco, CA, USA, 2003. [Google Scholar]
- Zuiderveld, K. Contrast Limited Adaptive Histogram Equalization. In Graphics Gems IV; Heckbert, P.S., Ed.; Academic Press: San Diego, CA, USA, 1994; pp. 474–485. [Google Scholar]
- Gonzalez, R.C.; Woods, R.E. Digital Image Processing, 3rd ed.; Prentice Hall: Upper Saddle River, NJ, USA, 2009. [Google Scholar]
- Cai, Y.; Bian, H.; Lin, J.; Wang, H.; Timofte, R.; Zhang, Y. Retinexformer: One-Stage Retinex-Based Transformer for Low-Light Image Enhancement. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), Paris, France, 2–6 October 2023; pp. 12504–12513. [Google Scholar]
- Yang, B.; Bender, G.; Le, Q.V.; Ngiam, J. CondConv: Conditionally Parameterized Convolutions for Efficient Inference. In Proceedings of the Advances in Neural Information Processing Systems (NeurIPS), Vancouver, BC, Canada, 8–14 December 2019; pp. 1307–1318. [Google Scholar]
- Li, C.; Zhou, A.; Yao, A. Omni-Dimensional Dynamic Convolution. In Proceedings of the International Conference on Learning Representations (ICLR), Kigali, Rwanda, 1–5 May 2023. [Google Scholar]
- Chen, L.; Gu, L.; Li, L.; Yan, C.; Fu, Y. Frequency Dynamic Convolution for Dense Image Prediction. arXiv 2025, arXiv:2503.18783. [Google Scholar]
- Zhang, F.; Liu, X.; Gao, C.; Sang, N. Color and Luminance Separated Enhancement for Low-Light Images with Brightness Guidance. Sensors 2024, 24, 2711. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Land, E.H. The Retinex Theory of Color Vision. Sci. Am. 1977, 237, 108–128. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Fechner, G.T. Elemente der Psychophysik; Breitkopf und Härtel: Leipzig, Germany, 1860. [Google Scholar]
- Lin, T.Y.; Dollár, P.; Girshick, R.; He, K.; Hariharan, B.; Belongie, S. Feature Pyramid Networks for Object Detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July 2017; pp. 936–944. [Google Scholar]
- Hu, J.; Shen, L.; Sun, G. Squeeze-and-Excitation Networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Salt Lake City, UT, USA, 18–22 June 2018; pp. 7132–7141. [Google Scholar]
- Szegedy, C.; Vanhoucke, V.; Ioffe, S.; Shlens, J.; Wojna, Z. Rethinking the Inception Architecture for Computer Vision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016; pp. 2818–2826. [Google Scholar]
- Billah, M.; Wang, X.; Yu, J.; Jiang, Y. Real-Time Goat Face Recognition Using Convolutional Neural Network. Comput. Electron. Agric. 2022, 194, 106730. [Google Scholar] [CrossRef] [Scilit]
- Huang, G.B.; Mattar, M.; Berg, T.; Learned-Miller, E. Labeled Faces in the Wild: A Database for Studying Face Recognition in Unconstrained Environments. In Proceedings of the Workshop on Faces in ‘Real-Life’ Images, Marseille, France, 17 October 2008. [Google Scholar]
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. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.













