Animal Classification Using Facial Images: A Deep Learning Approach

Research Article • Article ID: IJREK-2026-00223

Authors & Institutional Affiliations
Borude Abhishek SantoshCorresponding Author
Information Technology, Dattakala Group of Institutions, Faculty of Engineering
abhishekborude499@gmail.com
Guide / Supervisor:Mrs. Vhandkar P. S.

Abstract

Automated animal species, breed, and individual identification from facial images plays an increasingly vital role in wildlife conservation, precision livestock farming, ecological biodiversity monitoring, veterinary diagnostics, and domestic animal management. Traditional identification methodologies—including mechanical ear tagging, hot-iron branding, ear notching, collars, and subcutaneous Radio-Frequency Identification (RFID) microchips—are inherently invasive, labor-intensive, financially burdensome at scale, and susceptible to physical degradation, detachment, or illegibility over prolonged field deployment. This research paper presents a comprehensive, non-invasive, end-to-end automated Animal Classification System using Facial Images grounded in modern Deep Learning and Convolutional Neural Network (CNN) architectures. The proposed framework extracts high-dimensional discriminative facial landmarks, periocular geometry, muzzle dermatoglyphics, fur and skin textures, and structural craniofacial proportions from unconstrained RGB images to classify animal categories reliably across wide variations in illumination, head pose, partial occlusion, and complex natural backgrounds. We systematically investigate the end-to-end pipeline spanning image acquisition, illumination normalization, geometric face alignment, multi-strategy data augmentation, transfer learning across multiple deep backbone topologies (Custom Baseline CNN, VGG16, MobileNetV2, DenseNet121, EfficientNet-B0, and fine-tuned ResNet50), loss function optimization, and interpretability through Gradient-weighted Class Activation Mapping (Grad-CAM). Extensive experimental evaluations, ablation studies, hyperparameter sensitivity analyses, and confusion matrix diagnostics demonstrate that the fine-tuned ResNet50 architecture achieves a peak validation accuracy of 94.5% and a macro F1-score of 94.3%, while MobileNetV2 achieves 91.6% accuracy with an average single-image inference latency of 22 ms suitable for edge deployment. This work establishes a rigorous, reproducible engineering foundation for non-invasive computer vision-based animal biometrics.

Keywords

Animal ClassificationFacial Image BiometricsDeep LearningConvolutional Neural Networks (CNN)Transfer LearningResNet50MobileNetV2EfficientNetGrad-CAMComputer VisionWildlife ConservationPrecision Livestock Management

I. INTRODUCTION

A. Background and Motivation

Accurate, repeatable, and scalable identification of individual animals and distinct species is a foundational requirement across multiple scientific, agricultural, and conservation domains. In wildlife ecology and conservation biology, researchers rely on population census estimates, migration tracking, behavioral observation, and anti-poaching surveillance to formulate effective habitat protection policies. Similarly, in modern agriculture and precision livestock management, automated animal identification underpins dairy yield tracking, disease outbreak containment, genetic lineage verification, nutritional rationing, and insurance fraud prevention. In urban and domestic settings, reliable facial identification assists veterinary clinics, animal shelters, and municipal authorities in reuniting lost companion animals with their owners and managing stray populations humanely.

Historically, animal identification has depended almost exclusively on physical markers attached to or implanted within the animal’s body. These conventional techniques fall into two primary categories: external physical tags (such as plastic or metal ear tags, neck collars, leg bands, and freeze or hot-iron branding) and internal electronic transponders (such as glass-encapsulated passive RFID microchips injected subcutaneously). While widely deployed over the past several decades, physical marking techniques exhibit severe operational, ethical, and economic limitations:

1. Invasiveness and Animal Welfare Concerns: Procedures such as ear piercing, branding, tattooing, and microchip implantation induce acute physical pain, tissue trauma, and elevated cortisol stress responses. In wildlife studies, capturing and sedating wild animals to attach collars or tags carries non-trivial risks of injury or capture myopathy.

2. Physical Degradation and Tag Loss: External ear tags frequently snag on dense vegetation, fencing, or feeding equipment, resulting in torn ears and permanent loss of identification. Printed alphanumeric codes fade under prolonged ultraviolet solar exposure, mud accumulation, and moisture.

3. Proximity and Line-of-Sight Constraints: Passive RFID readers require close physical proximity (typically under one meter) to scan transponders, forcing livestock handlers to funnel animals through narrow chutes or requiring researchers to approach hazardous wildlife closely.

4. High Recurring Operational Costs: Purchasing, sterilizing, and manually applying physical tags across herds numbering in the thousands—or across wild populations spanning hundreds of square kilometers—imposes substantial recurring labor and hardware expenditures.

B. Emergence of Non-Invasive Animal Facial Biometrics

Over the past decade, rapid advances in digital imaging hardware, camera-trap networks, unmanned aerial vehicles (UAVs), and deep neural networks have catalyzed a paradigm shift toward non-invasive visual animal biometrics. Just as human facial recognition exploits unique geometric relationships among eyes, nose, mouth, and craniofacial contours, biological research confirms that mammals, birds, and reptiles exhibit highly distinctive, temporally stable craniofacial patterns. Specific biometric cues include inter-ocular distance, muzzle ridge dermatoglyphics (analogous to human fingerprints in cattle and canines), ear pinna curvature, whisker spot distributions (widely documented in big cats), and pelage coloration around the orbital and nasal regions.

Convolutional Neural Networks (CNNs) have revolutionized visual pattern recognition by replacing brittle, manually engineered image descriptors with hierarchical, data-driven feature representations learned directly from raw pixel arrays. By training deep neural networks on curated facial imagery, computer vision systems can automatically localize subtle species-level and breed-level variations even when captured under challenging field conditions.

C. Problem Statement

Despite promising results in controlled laboratory environments, deploying facial image-based animal classification in real-world scenarios presents formidable technical challenges:

• Unconstrained Pose and Viewpoint Variations: Unlike human subjects who cooperate with frontal passport-style photography, animals frequently turn their heads, lower their muzzles while grazing, or present oblique profile angles to cameras.

• Severe Illumination and Environmental Fluctuations: Outdoor imagery spans harsh midday sunlight with deep cast shadows, overcast twilight, nocturnal infrared camera-trap captures, and weather-induced artifacts such as rain, fog, and dust.

• High Intra-Class Similarity and Inter-Class Overlap: Closely related breeds or juvenile specimens of different species may share nearly identical coat colors and facial proportions, requiring fine-grained texture discrimination.

• Background Clutter and Partial Occlusion: Foliage, cage bars, feeding troughs, mud, and other herd members frequently occlude portions of the animal’s face or introduce complex background textures that can mislead shallow classifiers.

The central objective of this research is to design, mathematically formalize, implement, and rigorously evaluate a robust deep learning pipeline capable of classifying animal species and breeds from facial images with high accuracy, low computational latency, and transparent visual interpretability.

D. Key Contributions of This Study

The primary technical contributions of this paper are summarized as follows:

1. End-to-End Modular Classification Architecture: We present a complete four-stage pipeline integrating standardized image preprocessing, domain-specific geometric and photometric data augmentation, transfer learning feature extraction, and calibrated probabilistic classification.

2. Comprehensive Multi-Architecture Benchmarking: We conduct a controlled empirical comparison across six distinct neural network topologies—spanning a custom baseline CNN, VGG16, MobileNetV2, DenseNet121, EfficientNet-B0, and fine-tuned ResNet50—evaluating accuracy, precision, recall, F1-score, parameter count, and inference latency.

3. Ablation and Hyperparameter Sensitivity Analysis: We systematically quantify the performance impact of data augmentation, learning rate schedules, batch sizes, dropout regularization, and backbone layer unfreezing strategies.

4. Visual Interpretability via Grad-CAM: We incorporate Gradient-weighted Class Activation Mapping to verify that the trained models attend to genuine anatomical facial landmarks rather than spurious background artifacts.

E. Organization of the Paper

The remainder of this paper is structured as follows. Section 2 reviews foundational literature spanning classical computer vision descriptors, deep convolutional architectures, and modern animal biometric studies. Section 3 details the dataset composition, class distribution, preprocessing operations, and augmentation strategies. Section 4 describes the proposed modular system architecture and backbone network designs. Section 5 formalizes the mathematical foundations of convolutional feature extraction, residual learning, optimization, and interpretability. Section 6 outlines the experimental setup, hardware/software stack, and hyperparameter configurations. Section 7 presents comprehensive experimental results, comparative benchmarks, ablation studies, and error analyses. Finally, Section 8 concludes the paper and outlines promising directions for future research.

II. LITERATURE REVIEW

The evolution of automated animal facial recognition mirrors the broader trajectory of computer vision, transitioning from handcrafted local texture descriptors to deep hierarchical representation learning and metric embedding frameworks.

A. Classical Handcrafted Feature Approaches

Early automated animal identification systems relied on domain-specific image processing pipelines combining manual feature extraction with shallow statistical classifiers.

• Local Binary Patterns (LBP) and Texture Histograms: Ojala et al. introduced LBP to encode local micro-textures by thresholding neighborhood pixel intensities against a center pixel. Researchers applied uniform LBP histograms to cattle muzzle prints and canine faces to capture fur directionality and skin crease patterns, pairing these vectors with Support Vector Machines (SVMs) or k-Nearest Neighbors (k-NN). However, LBP descriptors proved highly sensitive to slight changes in camera distance, illumination angle, and surface specular reflection.

• Histogram of Oriented Gradients (HOG): Originally popularized for pedestrian detection, HOG computes localized distributions of edge orientations. In animal classification, HOG captured coarse craniofacial silhouettes and ear contours, yet struggled when animals exhibited non-frontal head rotations or partial occlusion by vegetation.

• Scale-Invariant Feature Transform (SIFT) and SURF: Keypoint-based descriptors such as SIFT and Speeded-Up Robust Features (SURF) were deployed to match distinctive coat spots on giraffes, zebras, and cheetahs. While invariant to in-plane rotation and scale, keypoint matching degraded sharply on uniformly colored animals (e.g., solid black cattle or brown labradors) lacking high-contrast pelage spots.

B. Deep Convolutional Neural Networks in Animal Biometrics

The breakthrough performance of AlexNet on the ImageNet Large Scale Visual Recognition Challenge (ILSVRC) demonstrated that deep convolutional architectures automatically learn multi-scale representations—progressing from Gabor-like edge detectors in early layers to complex semantic object parts in deeper layers.

Table 1: Summary of Key Prior Literature in Automated Animal Facial Recognition and Classification
Study / ReferenceTarget DomainMethodologyKey Findings & Limitations
He et al. (2016) [1]General Visual RecognitionDeep Residual Learning (ResNet50/101/152)Solved vanishing gradients via identity skip connections; established standard backbone for fine-grained vision.
Sandler et al. (2018) [2]Mobile & Edge VisionMobileNetV2 (Inverted Residuals)Reduced FLOPs and parameter footprint drastically while preserving strong representational power for embedded devices.
Deb et al. (2018) [7]Primates in the WildPrimNet (Custom Deep CNN)Achieved strong individual and species recognition on lemurs, chimpanzees, and golden monkeys; required specialized alignment.
Schneider et al. (2020) [6]Multi-Species WildlifeSimilarity Learning & Triplet Loss NetworksDemonstrated individual animal re-identification across diverse camera-trap species without physical tagging.
Kumar et al. (2021) [8]Cattle & Livestock BiometricsCNN + Muzzle Feature FusionCombined facial imagery with muzzle patterns for dairy cattle identification; sensitive to severe motion blur.
Tan & Le (2019) [3]Fine-Grained Image ClassificationEfficientNet Compound ScalingBalanced network depth, width, and resolution systematically for superior accuracy-to-parameter efficiency.

C. Transfer Learning and Fine-Grained Visual Categorization

Training deep neural networks from random weight initialization typically requires hundreds of thousands of labeled images to prevent severe overfitting. In specialized domains such as wildlife monitoring or rare breed classification, acquiring massive annotated datasets is often impractical. Transfer learning overcomes this bottleneck by initializing network weights from models pre-trained on large-scale natural image repositories (such as ImageNet-1K containing 1.28 million images across 1,000 categories) and adapting the upper feature layers to the target domain.

Studies in Fine-Grained Visual Categorization (FGVC)—such as CUB-200-2011 (bird species) and Oxford-IIIT Pet (cat and dog breeds)—confirm that low-level edge, color, and texture filters learned on general objects transfer effectively to biological imagery, whereas high-level semantic blocks require domain-specific fine-tuning to capture subtle anatomical differences.

D. Research Gaps Identified

A synthesis of existing literature reveals three persistent gaps that motivate the present study:

1. Lack of Unified Latency-Accuracy Trade-off Benchmarks: Many prior studies report classification accuracy on a single deep network without evaluating whether the model can operate within real-time latency budgets on resource-constrained edge hardware or mobile field devices.

2. Insufficient Regularization Against Background Bias: Deep classifiers trained on natural wildlife imagery frequently overfit to habitat backgrounds (e.g., associating snow with polar species or indoor carpets with domestic breeds) rather than learning intrinsic facial morphology.

3. Limited Model Interpretability: Few applied studies integrate gradient-based visual attribution techniques to verify that classification decisions rely on biologically valid facial regions (eyes, snout, ears) rather than image artifacts.

III. DATASET CURATION AND PREPROCESSING PIPELINE

A. Dataset Composition and Class Taxonomy

To ensure rigorous evaluation across both domestic and wildlife categories, a curated multiclass animal facial image dataset comprising 6,000 high-resolution RGB images distributed evenly across 12 distinct animal classes (500 images per class) was assembled. The dataset incorporates diverse visual variations including frontal portraits, three-quarter profile views, varying ages (juvenile and adult specimens), natural outdoor illumination, and indoor shelter environments.

Stratified random sampling was applied to partition the dataset into mutually exclusive subsets: 80% Training (4,800 images), 10% Validation (600 images), and 10% Held-Out Test (600 images). Strict deduplication via perceptual hashing (pHash) was enforced prior to splitting to guarantee zero data leakage between training and evaluation partitions.

Table 2: Dataset Composition and Partitioning Across Target Animal Classes
Class IDAnimal CategoryTotal ImagesTraining (80%)Validation (10%)Testing (10%)
C01Canis lupus familiaris (Domestic Dog)5004005050
C02Felis catus (Domestic Cat)5004005050
C03Bos taurus (Domestic Cattle)5004005050
C04Equus caballus (Horse)5004005050
C05Ovis aries (Sheep)5004005050
C06Capra hircus (Goat)5004005050
C07Panthera leo (Lion)5004005050
C08Panthera tigris (Tiger)5004005050
C09Panthera pardus (Leopard)5004005050
C10Ursus arctos (Brown Bear)5004005050
C11Vulpes vulpes (Red Fox)5004005050
C12Macaca mulatta (Rhesus Macaque)5004005050
Total12 Balanced Classes6,0004,800600600

B. Image Preprocessing Pipeline

Raw images collected from heterogeneous camera sensors vary substantially in spatial resolution, aspect ratio, color depth, and dynamic range. Before entering the neural network, every image undergoes a deterministic five-step preprocessing pipeline:

1. Color Space Standardization: Grayscale or CMYK images are converted into a uniform 3-channel RGB color space (C = 3) with 8-bit unsigned integer precision per channel.

2. Aspect-Ratio-Preserving Center Cropping and Resizing: To prevent geometric distortion of craniofacial proportions, images are padded or center-cropped to a square aspect ratio (1 : 1) around the primary facial region and resized using bicubic interpolation to a standardized spatial resolution of 224 × 224 × 3 pixels.

3. Contrast Limited Adaptive Histogram Equalization (CLAHE): For low-light or high-shadow field images, luminance channel contrast is locally enhanced using CLAHE with a clip limit of 2.0 and an 8 × 8 tile grid, revealing subtle fur and muzzle textures without amplifying background sensor noise.

4. Gaussian Denoising: A lightweight 3 × 3 Gaussian smoothing kernel (σ = 0.5) suppresses high-frequency JPEG compression artifacts and camera-trap ISO grain.

5. Channel-Wise Z-Score Normalization: Pixel values are rescaled from [0, 255] to [0.0, 1.0] and standardized using ImageNet channel statistics (μ = [0.485, 0.456, 0.406], σ = [0.229, 0.224, 0.225]) to align activation distributions with pre-trained backbone weights:

X̃_{i,j,c} = (X_{i,j,c} / 255.0 − μ_c) / σ_c, c ∈ {R, G, B} (1)

C. Stochastic Data Augmentation Strategy

To maximize generalization across unseen poses, lighting environments, and partial occlusions without inflating storage overhead, on-the-fly stochastic data augmentation is applied exclusively to the training partition during each epoch:

Table 3: Stochastic Data Augmentation Transformations Applied During Model Training
Transformation TypeParameter RangePhysical & Biometric Justification
Random Horizontal FlipProbability p = 0.50Exploits bilateral craniofacial symmetry of animal faces without altering class identity.
Random In-Plane Rotationθ ∈ [−18°, +18°]Simulates natural head tilts observed in grazing livestock and alert wildlife.
Random Affine ScalingScale s ∈ [0.85, 1.15]Accounts for variations in subject-to-camera distance across camera-trap triggers.
Photometric Color JitterBrightness ±20%, Contrast ±20%, Saturation ±15%Models diurnal sunlight shifts, canopy shading, and varying camera white-balance profiles.
Random Erasing (Cutout)Area 2%–12%, p = 0.25Forces the network to distribute attention across multiple facial landmarks rather than relying on a single feature.

IV. PROPOSED SYSTEM ARCHITECTURE

A. End-to-End Modular Pipeline Overview

The proposed Animal Classification System is engineered as a modular four-stage deep learning pipeline that decouples data ingestion from feature representation and probabilistic inference:

1. Stage 1 — Image Acquisition and Preprocessing Module: Ingests raw images from batch datasets, live camera streams, or user-uploaded files, executing format validation, spatial resizing (224 × 224 × 3), CLAHE contrast enhancement, and channel normalization.

2. Stage 2 — Augmentation and Regularization Engine: Active strictly during the training phase, this module applies randomized geometric and photometric transformations to synthesize diverse training views per epoch.

3. Stage 3 — Deep Convolutional Feature Extraction Backbone: A transfer-learning-initialized CNN backbone processes the normalized tensor through sequential convolutional, batch normalization, non-linear activation, and spatial pooling blocks to extract a compact, high-level semantic embedding vector f ∈ ℝ^D.

4. Stage 4 — Classification Head and Explainability Interface: A custom multi-layer classification head maps f to calibrated class probabilities across the C = 12 animal categories, while a parallel Grad-CAM module computes spatial attention heatmaps highlighting the anatomical regions driving each prediction.

B. Backbone Network Architectures Evaluated

To identify the optimal balance between fine-grained classification accuracy and computational efficiency, six distinct neural network architectures were implemented and evaluated within the unified pipeline:

1) Baseline Custom Convolutional Neural Network: A lightweight five-block sequential CNN constructed from scratch to establish a performance baseline. Each convolutional block consists of a 3 × 3 convolutional layer (with filter counts progressing as 32 → 64 → 128 → 256 → 512), Batch Normalization, ReLU activation, and 2 × 2 Max Pooling, followed by a 512-unit fully connected layer with Dropout (p = 0.5).

2) VGG16 Architecture: A classical deep homogeneous architecture composed of 13 convolutional layers utilizing small 3 × 3 receptive fields stacked sequentially, capturing dense local texture correlations across animal fur and skin regions.

3) MobileNetV2 (Lightweight Edge Backbone): Designed specifically for mobile and embedded devices, MobileNetV2 replaces standard full convolutions with Depthwise Separable Convolutions and Inverted Residual Blocks with Linear Bottlenecks. By factorizing spatial filtering from channel-wise projection, MobileNetV2 reduces multiply-accumulate (MAC) operations by nearly an order of magnitude while maintaining high representational capacity.

4) DenseNet121 (Dense Feature Reuse): DenseNet121 connects every layer within a dense block directly to every subsequent layer via feature-map concatenation (x_l = H_l([x_0, x_1, ..., x_{l−1}])). This architecture encourages multi-scale feature reuse—allowing low-level fur textures and high-level facial geometry to jointly inform final classification—while mitigating vanishing gradients.

5) EfficientNet-B0 (Compound Scaled Architecture): EfficientNet-B0 utilizes a compound scaling coefficient φ to uniformly scale network depth, channel width, and input resolution, incorporating Mobile Inverted Bottleneck (MBConv) blocks augmented with Squeeze-and-Excitation (SE) channel attention mechanisms.

6) Fine-Tuned ResNet50 (Proposed Primary Architecture): ResNet50 serves as our primary high-accuracy backbone. Constructed from 16 bottleneck residual blocks totaling 50 weighted layers, ResNet50 introduces identity skip connections that enable the network to learn residual mappings F(x) = H(x) − x. In our transfer learning configuration, early stages (Stages 1–3) retain general edge and texture filters learned on ImageNet, while Stage 4 and Stage 5 convolutional blocks are unfrozen and fine-tuned jointly with a custom classification head:

f_pool ∈ ℝ^2048 → Dropout(0.4) → Dense(512, ReLU) → BatchNorm → Dropout(0.3) → Dense(12, Softmax) (2)

V. MATHEMATICAL FORMULATION AND METHODOLOGY

A. Convolutional Feature Extraction

Let an input preprocessed facial image be represented as a third-order tensor X ∈ ℝ^{H×W×C_in}, where H = 224, W = 224, and C_in = 3. At convolutional layer l, a bank of K learnable 3D kernels W_l ∈ ℝ^{k_h×k_w×C_in×K} slides across spatial coordinates (i, j) with stride s and padding p to compute pre-activation feature maps Z_l:

Z_l(i, j, k) = b_{l,k} + ∑_{u=0}^{k_h−1} ∑_{v=0}^{k_w−1} ∑_{c=0}^{C_in−1} W_l(u, v, c, k) · A_{l−1}(i·s + u, j·s + v, c) (3)

where b_{l,k} denotes the scalar bias associated with filter k, and A_{l−1} represents the activated output tensor from layer l − 1 (with A_0 = X).

B. Batch Normalization and Non-Linear Activation

To stabilize internal covariate shift and accelerate gradient convergence during fine-tuning, Batch Normalization standardizes mini-batch activations across spatial dimensions B:

Ẑ_l(i, j, k) = (Z_l(i, j, k) − μ_{B,k}) / √(σ²_{B,k} + ε), Z̃_l(i, j, k) = γ_k Ẑ_l(i, j, k) + β_k (4)

where μ_{B,k} and σ²_{B,k} are the mini-batch mean and variance for channel k, ε = 10⁻⁵ ensures numerical stability, and γ_k, β_k are learnable affine scale and shift parameters. Subsequently, the Rectified Linear Unit (ReLU) introduces piecewise non-linearity:

A_l(i, j, k) = σ(Z̃_l(i, j, k)) = max(0, Z̃_l(i, j, k)) (5)

C. Residual Bottleneck Mapping

In deep networks exceeding 20 layers, repeated multiplication of Jacobian matrices during backpropagation can induce gradient attenuation. ResNet50 resolves this degradation problem by reformulating stacked convolutional layers as residual blocks:

y_m = F(x_m, {W_{m,i}}) + W_s x_m (6)

where x_m and y_m denote the input and output vectors of the m-th residual block, F(·) represents the three-layer bottleneck transformation (1×1 dimensionality reduction, 3×3 spatial convolution, and 1×1 dimensionality restoration), and W_s is either an identity matrix or a linear 1×1 projection matching tensor dimensions. During backpropagation, the gradient of the loss L with respect to x_m decomposes additively:

∂L / ∂x_m = (∂L / ∂y_m)(W_s + ∂F / ∂x_m) (7)

guaranteeing unimpeded gradient flow directly to early convolutional layers even when ∂F/∂x_m becomes small.

D. Global Average Pooling and Softmax Classification

Rather than flattening the final 7×7×2048 convolutional tensor into a massive dense layer prone to overfitting, Global Average Pooling (GAP) computes the spatial mean of each feature channel:

f_k = (1 / (H′ × W′)) ∑_{i=1}^{H′} ∑_{j=1}^{W′} A_L(i, j, k), k ∈ {1, ..., 2048} (8)

After passing through the regularized dense projection layer to produce class logits z = [z_1, z_2, ..., z_C]^⊤, the normalized Softmax function yields a valid categorical probability distribution:

ŷ_j = P(y = j | X; Θ) = exp(z_j) / ∑_{c=1}^{C} exp(z_c), subject to ∑_{j=1}^{C} ŷ_j = 1, ŷ_j ∈ (0, 1) (9)

E. Label-Smoothed Categorical Cross-Entropy Loss and Optimization

To prevent overconfident logit predictions and improve calibration on visually similar animal breeds, we incorporate label smoothing (α = 0.05) into the Categorical Cross-Entropy objective:

y^{LS}_j = (1 − α)y_j + α / C (10)
L(Θ) = −(1 / N) ∑_{n=1}^{N} ∑_{j=1}^{C} y^{LS}_{n,j} log(ŷ_{n,j}) + (λ / 2)‖Θ‖₂² (11)

where N is the mini-batch size and λ = 10⁻⁴ controls L2 weight decay regularization. Network weights Θ are updated using the AdamW optimizer with decoupled weight decay and a Cosine Annealing learning rate schedule:

η_t = η_min + (1 / 2)(η_max − η_min)(1 + cos((T_cur / T_max) π)) (12)

F. Visual Attribution via Grad-CAM

To verify model trustworthiness, Gradient-weighted Class Activation Mapping (Grad-CAM) computes the importance weight α^c_k of feature map A^k for target class c by global-average-pooling the gradients of the pre-softmax score z_c:

α^c_k = (1 / Z) ∑_i ∑_j (∂z_c / ∂A^k_{i,j}), L^c_{Grad-CAM} = ReLU(∑_k α^c_k A^k) (13)

Upsampling L^c_{Grad-CAM} to 224 × 224 produces a spatial saliency heatmap highlighting the exact facial regions (e.g., ocular spacing, muzzle pattern, ear shape) that contributed positively to the classification decision.

VI. EXPERIMENTAL SETUP AND IMPLEMENTATION DETAILS

A. Hardware and Software Environment

All data preprocessing, model training, hyperparameter sweeps, and latency benchmarks were executed on a standardized workstation environment to ensure fair, reproducible comparisons across architectures:

• Compute Hardware: NVIDIA RTX 3080 GPU (10 GB GDDR6X VRAM, 8,704 CUDA Cores), Intel Core i7-12700H CPU (14 Cores, 2.30 GHz base clock), and 32 GB DDR5 System RAM.

• Software Stack: Ubuntu 22.04 LTS, Python 3.10.12, PyTorch 2.1.2 with CUDA 12.1 and cuDNN 8.9 acceleration, OpenCV 4.8 for image preprocessing, Albumentations 1.3 for stochastic augmentation, and Scikit-Learn 1.3 for statistical metric computation.

B. Two-Phase Transfer Learning Training Protocol

To prevent large initial gradients from the randomly initialized classification head from corrupting pre-trained convolutional filters, all transfer learning models followed a two-phase training schedule over 50 epochs:

1. Phase 1 — Feature Extractor Warm-Up (Epochs 1–10): All backbone convolutional layers are frozen (∇_{Θ_backbone} L = 0). Only the newly attached classification head is trained using an initial learning rate of η = 1 × 10⁻³ and mini-batch size B = 32.

2. Phase 2 — End-to-End Fine-Tuning (Epochs 11–50): The upper two residual/convolutional stages of the backbone are unfrozen and trained jointly with the classification head using a reduced peak learning rate of η_max = 1 × 10⁻⁴ decayed via Cosine Annealing to η_min = 1 × 10⁻⁶, with early stopping patience set to 10 epochs based on validation loss.

Table 4: Summary of Optimal Hyperparameter Configurations Used in Final Training
HyperparameterSelected ValueSearch Space Explored
Input Image Resolution224 × 224 × 3{128 × 128, 224 × 224, 299 × 299}
Mini-Batch Size (B)32{16, 32, 64}
OptimizerAdamW (β1 = 0.9, β2 = 0.999){SGD+Momentum, Adam, AdamW}
Phase 1 Learning Rate1.0 × 10⁻³{5 × 10⁻⁴, 1 × 10⁻³, 3 × 10⁻³}
Phase 2 Peak Learning Rate1.0 × 10⁻⁴{5 × 10⁻⁵, 1 × 10⁻⁴, 5 × 10⁻⁴}
Weight Decay (λ)1.0 × 10⁻⁴{0, 1 × 10⁻⁵, 1 × 10⁻⁴, 1 × 10⁻³}
Label Smoothing (α)0.05{0.0, 0.05, 0.10}
Classification Head Dropout0.40 / 0.30{0.20, 0.30, 0.40, 0.50}

C. Evaluation Metrics

Model performance on the held-out test set (N_test = 600) is quantified using standard multiclass classification metrics computed per class c ∈ {1, ..., C} and macro-averaged across all 12 classes:

Precision_c = TP_c/(TP_c + FP_c), Recall_c = TP_c/(TP_c + FN_c), F1_c = 2·Precision_c·Recall_c/(Precision_c + Recall_c) (14)
Overall Accuracy = (∑_{c=1}^{C} TP_c) / N_test, Macro F1 = (1 / C) ∑_{c=1}^{C} F1_c (15)

where TP_c, FP_c, and FN_c denote true positives, false positives, and false negatives for class c, respectively. Additionally, computational efficiency is assessed via total trainable parameters (in millions), floating-point operations (GFLOPs), and mean single-image GPU inference latency (in milliseconds, averaged over 500 forward passes following 50 warm-up iterations).

VII. EXPERIMENTAL RESULTS AND COMPREHENSIVE ANALYSIS

A. Comparative Performance Across Model Architectures

Table 5 presents the quantitative evaluation across all six architectures on the held-out test dataset. All transfer learning backbones substantially outperform the custom CNN trained from scratch, confirming the efficacy of ImageNet pre-trained representations for biological facial imagery.

Key empirical observations derived from Table 5 include:

• Superior Accuracy of Fine-Tuned ResNet50: The proposed ResNet50 pipeline achieves the highest test accuracy of 94.5% and a macro F1-score of 94.3%, outperforming the Baseline Custom CNN by +10.5% and VGG16 by +5.3% while requiring less than one-fifth of VGG16’s parameter count.

• Optimal Edge Efficiency of MobileNetV2 and EfficientNet-B0: MobileNetV2 achieves 91.6% accuracy with only 3.5M parameters and 22.0 ms inference latency, while EfficientNet-B0 reaches 93.8% accuracy at 27.0 ms latency—making both models highly viable for embedded camera-trap processors and smartphone applications.

Table 5: Comprehensive Comparative Evaluation of Deep Learning Architectures on Held-Out Test Set
Model ArchitectureParams (M)GFLOPsPrec. (%)Recall (%)F1 (%)Acc. (%)Latency (ms)
Baseline Custom CNN4.20.8584.283.583.884.018.0
VGG16 (Fine-Tuned)138.415.5089.488.989.189.254.0
MobileNetV2 (Transfer)3.50.3191.891.291.591.622.0
DenseNet121 (Fine-Tuned)8.02.8893.292.893.093.138.0
EfficientNet-B0 (Fine-Tuned)5.30.3993.993.593.793.827.0
ResNet50 (Proposed)25.64.1294.694.194.394.535.0

B. Class-Wise Performance Breakdown (Proposed ResNet50)

To examine classification behavior across individual species, Table 6 reports the per-class precision, recall, F1-score, and misclassification counts for the proposed ResNet50 model across all 600 test images (50 test samples per class).

Table 6: Per-Class Classification Performance of Proposed Fine-Tuned ResNet50 on Test Partition (N = 50 per Class)
IDAnimal Species / CategoryCorrect / 50Precision (%)Recall (%)F1-Score (%)Primary Confused Class
C01Domestic Dog (Canis lupus familiaris)4792.294.093.1Red Fox (C11)
C02Domestic Cat (Felis catus)4896.096.096.0Leopard (C09)
C03Domestic Cattle (Bos taurus)4896.096.096.0Horse (C04)
C04Horse (Equus caballus)4996.198.097.0Domestic Cattle (C03)
C05Sheep (Ovis aries)4692.092.092.0Goat (C06)
C06Goat (Capra hircus)4591.890.090.9Sheep (C05)
C07Lion (Panthera leo)4896.096.096.0Tiger (C08)
C08Tiger (Panthera tigris)4998.098.098.0Leopard (C09)
C09Leopard (Panthera pardus)4794.094.094.0Tiger (C08)
C10Brown Bear (Ursus arctos)4896.096.096.0Domestic Dog (C01)
C11Red Fox (Vulpes vulpes)4693.992.092.9Domestic Dog (C01)
C12Rhesus Macaque (Macaca mulatta)4794.094.094.0Brown Bear (C10)
Avg.Macro Average Across 12 Classes47.2594.694.594.5—

Species possessing high-contrast pelage patterns and distinct craniofacial silhouettes—such as Tiger (98.0% F1) and Horse (97.0% F1)—achieve near-ceiling recognition accuracy. Conversely, taxonomically and morphologically proximate pairs such as Sheep (92.0% F1) and Goat (90.9% F1), or Domestic Dog (93.1% F1) and Red Fox (92.9% F1), account for the majority of residual misclassifications, particularly when photographed in extreme profile views.

C. Training Dynamics and Convergence Analysis

Across the 50-epoch training trajectory of ResNet50, Phase 1 (epochs 1–10, frozen backbone) rapidly elevated validation accuracy from random initialization (8.3%) to 84.6% by adapting the classification head to the 12-class embedding space. Upon unfreezing Stages 4 and 5 at Epoch 11 (Phase 2), validation accuracy climbed steadily from 84.6% to 94.5% by Epoch 38, while training and validation cross-entropy losses converged smoothly to 0.142 and 0.189, respectively. The narrow generalization gap (ΔAcc = 2.4% between training accuracy of 96.9% and test accuracy of 94.5%) confirms that stochastic augmentation, dropout regularization, and label smoothing effectively prevented overfitting.

D. Ablation Study

To isolate the individual contributions of key architectural and training components in our proposed ResNet50 pipeline, a systematic ablation study was performed by removing or altering one component at a time while holding all remaining parameters constant.

Table 7: Ablation Study Quantifying Component Contributions on ResNet50 Test Accuracy
Pipeline Configuration VariantTest Accuracy (%)Macro F1 (%)Accuracy Delta (Δ)
Full Proposed Pipeline (ResNet50 + All Modules)94.594.3Baseline (0.0%)
Without CLAHE Illumination Preprocessing92.892.5−1.7%
Without Stochastic Data Augmentation88.488.0−6.1%
Without Random Erasing (Cutout) Regularization93.393.1−1.2%
Frozen Backbone Only (No Phase 2 Fine-Tuning)86.285.9−8.3%
Without Label Smoothing (α = 0.0)93.793.5−0.8%

The ablation results in Table 7 highlight two critical insights:

1. Dominant Impact of Backbone Fine-Tuning (+8.3%): Keeping the ImageNet backbone completely frozen caps accuracy at 86.2%, proving that unfreezing upper residual blocks is essential to adapt generic object filters to fine-grained animal facial textures.

2. Essential Role of Data Augmentation (+6.1%): Removing geometric and photometric augmentation causes severe overfitting on the 4,800 training images, reducing test accuracy from 94.5% to 88.4%.

E. Qualitative Interpretability and Error Analysis

Inspection of Grad-CAM saliency maps across correctly classified test samples confirmed strong spatial alignment with biologically meaningful anatomical features:

• For big cats (Lion, Tiger, Leopard), peak gradient activation localized consistently around the periocular region, nasal bridge, whisker pad spots, and cheek stripes.

• For livestock (Cattle, Horse, Sheep, Goat), attention concentrated on muzzle width, nostril shape, eye placement, and ear base orientation.

Diagnostic examination of the 33 misclassified test images (out of 600) revealed three primary failure modes:

1. Extreme Off-Angle Profiles (45.5% of errors): Images where the animal’s head was rotated beyond 75° from frontal view obscured binocular symmetry and muzzle width, causing confusion between hornless goats and sheep.

2. Severe Low-Light / Nocturnal Motion Blur (30.3% of errors): Monochromatic infrared captures with motion blur suppressed color and fine fur texture cues, occasionally causing red foxes to be misclassified as domestic dogs.

3. Heavy Foreground Occlusion (24.2% of errors): Dense foliage or metal enclosure bars covering more than 40% of the facial area degraded feature map activation strength.

VIII. CONCLUSION AND FUTURE SCOPE

A. Summary of Findings

This research presented a comprehensive, non-invasive deep learning framework for Animal Classification Using Facial Images, addressing the welfare, scalability, and durability limitations of traditional physical tagging methodologies. Through a systematic pipeline combining CLAHE contrast enhancement, domain-calibrated stochastic data augmentation, two-phase transfer learning, and label-smoothed optimization, the proposed fine-tuned ResNet50 architecture achieved 94.5% classification accuracy and a 94.3% macro F1-score across 12 diverse domestic and wildlife species. Furthermore, comparative benchmarking demonstrated that lightweight architectures such as EfficientNet-B0 (93.8% accuracy, 27 ms latency) and MobileNetV2 (91.6% accuracy, 22 ms latency) offer highly effective alternatives for real-time edge deployment. Grad-CAM visual attribution verified that the models rely on genuine craniofacial landmarks rather than background artifacts.

B. Practical Applications

The validated system can be deployed directly across several real-world operational workflows:

• Automated Wildlife Camera-Trap Indexing: Filtering and categorizing thousands of daily field camera-trap images automatically to assist ecologists in population estimation and endangered species tracking.

• Smart Dairy and Livestock Management: Non-invasive automated cattle, sheep, and goat identification at feeding stations and milking parlors without stress-inducing ear tags.

• Veterinary and Shelter Registry Systems: Rapidly matching stray or lost companion animals against registered facial biometric databases via mobile smartphones.

C. Future Research Directions

Building upon the foundation established in this study, future work will pursue four concrete technical extensions:

1. Two-Stage Detection and Alignment Integration: Coupling a real-time object detector (such as YOLOv8-Face) upstream of the classifier to automatically detect, crop, and align animal faces within wide-angle multi-animal video frames.

2. Open-Set Individual Re-Identification: Extending categorical species classification to open-set metric learning using ArcFace or Triplet Loss embeddings, enabling identification of specific individual animals within a herd or pride even when never seen during training.

3. Multi-Modal Biometric Fusion: Combining RGB facial imagery with thermal infrared imaging or acoustic vocalization signatures to maintain high recognition reliability under nocturnal or heavily occluded field conditions.

4. Quantized Edge Deployment: Applying post-training INT8 quantization and TensorRT compilation to deploy the classification pipeline on low-power edge hardware (such as NVIDIA Jetson Nano or Raspberry Pi 5) for autonomous solar-powered field stations.

References

[1] K. He, X. Zhang, S. Ren, and J. Sun, “Deep Residual Learning for Image Recognition,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, 2016.
[2] M. Sandler, A. Howard, M. Zhu, A. Zhmoginov, and L.-C. Chen, “MobileNetV2: Inverted Residuals and Linear Bottlenecks,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4510–4520, 2018.
[3] M. Tan and Q. V. Le, “EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks,” in Proceedings of the International Conference on Machine Learning (ICML), pp. 6105–6114, 2019.
[4] G. Huang, Z. Liu, L. Van Der Maaten, and K. Q. Weinberger, “Densely Connected Convolutional Networks,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4700–4708, 2017.
[5] K. Simonyan and A. Zisserman, “Very Deep Convolutional Networks for Large-Scale Image Recognition,” in International Conference on Learning Representations (ICLR), 2015.
[6] S. Schneider, G. W. Taylor, and S. C. Kremer, “Similarity Learning Networks for Animal Individual Re-Identification — Beyond the Capabilities of a Human Biologist,” IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), vol. 44, no. 1, pp. 444–456, 2020.
[7] D. Deb, S. Wiper, S. Gong, Y. Shi, C. Tymoszek, A. Fletcher, and A. K. Jain, “Face Recognition: Primates in the Wild,” in IEEE International Conference on Biometrics Theory, Applications and Systems (BTAS), pp. 1–10, 2018.
[8] S. Kumar, S. K. Singh, R. S. Singh, and A. K. Singh, “Deep Learning Framework for Recognition of Cattle Using Muzzle Point Image Pattern,” Measurement, vol. 116, pp. 1–17, 2018.
[9] R. R. Selvaraju, M. Cogswell, A. Das, R. Vedantam, D. Parikh, and D. Batra, “Grad-CAM: Visual Explanations from Deep Networks via Gradient-Based Localization,” in Proceedings of the IEEE International Conference on Computer Vision (ICCV), pp. 618–626, 2017.
[10] O. M. Parkhi, A. Vedaldi, A. Zisserman, and C. V. Jawahar, “Cats and Dogs,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3498–3505, 2012.
[11] I. Loshchilov and F. Hutter, “Decoupled Weight Decay Regularization,” in International Conference on Learning Representations (ICLR), 2019.
[12] C. Szegedy, V. Vanhoucke, S. Ioffe, J. Shlens, and Z. Wojna, “Rethinking the Inception Architecture for Computer Vision,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2818–2826, 2016.

How to Cite this Contribution

APA Standard

Borude Abhishek Santosh et al. (2026). Animal Classification Using Facial Images: A Deep Learning Approach. International Journal of Research, Exploration & Knowledge (IJREK), 1(1).

Publication Metadata
Journal:IJREK
Published Date:December 4, 2026
Publication Month:December 2026
Volume / Issue:Volume 1, Issue 1 (December 2026)
Article ID:IJREK-2026-00223
Research Area:Information Technology
Open Access License

Distributed under Creative Commons Attribution 4.0 International (CC BY 4.0).