Next Article in Journal
Analysis of Transverse Vibration in a Concentrated Mass Rayleigh Pipe
Previous Article in Journal
Fuzzy Reasoning Symmetric Quintuple-Implication Method for Mixed Information and Its Application
Previous Article in Special Issue
On Superization of Nonlinear Integrable Dynamical Systems
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Weed Detection in Lily Fields Using YOLOv7 Optimized by Chaotic Harris Hawks Algorithm for Underground Resource Competition

1
Anhui Provincial Institute of Modern Coal Processing Technology, Anhui University of Science and Technology, Huainan 232001, China
2
School of Electronic Information Engineering, Southwest University, Chongqing 400715, China
3
Hubei Key Laboratory of Transportation Internet of Things, Wuhan University of Technology, Wuhan 430070, China
4
Qingdao Key Laboratory of Groundwater Resources Protection and Rehabilitation, Qingdao Geo-Engineering Surveying Institute, Qingdao 266101, China
5
Key Laboratory of Geological Safety of Coastal Urban Underground Space, Ministry of Natural Resources, Qingdao 266101, China
*
Author to whom correspondence should be addressed.
Symmetry 2025, 17(3), 370; https://doi.org/10.3390/sym17030370
Submission received: 17 January 2025 / Revised: 20 February 2025 / Accepted: 26 February 2025 / Published: 28 February 2025
(This article belongs to the Special Issue Symmetry in Nonlinear Dynamics and Chaos II)

Abstract

:
Lilies, a key cash crop in Lanzhou, China, widely planted in coal-based fields, cultivated fields, and gardens, face significant yield and quality reduction due to weed infestation, which competes for essential nutrients, water, and light. To address this challenge, we propose an advanced weed detection method that combines symmetry-based convolutional neural networks with metaheuristic optimization. A dedicated weed detection dataset is constructed through extensive field investigation, data collection, and annotation. To enhance detection efficiency, we introduce an optimized YOLOv7-Tiny model, integrating dynamic pruning and knowledge distillation, which reduces computational complexity while maintaining high accuracy. Additionally, a novel Chaotic Harris Hawks Optimization (CHHO) algorithm, incorporating chaotic mapping initialization and differential evolution, is developed to fine-tune YOLOv7-Tiny parameters and activation functions. Experimental results demonstrate that the optimized YOLOv7-Tiny achieves a detection accuracy of 92.53% outperforming traditional models while maintaining efficiency. This study provides a high-performance, lightweight, and scalable solution for real-time precision weed management in lily fields, offering valuable insights for agricultural automation and smart farming applications.

1. Introduction

As a perennial herb of the Lilium genus, Lilium davidii var. unicolor, commonly known as Lanzhou lily [1], stands out in the botanical world due to its distinctive growth patterns and rich nutritional value. In addition to its high ornamental appeal, it holds significant economic importance, serving as a valuable agricultural product. However, one of the major challenges in lily cultivation is weed infestation, which competes with lilies for essential nutrients, water, and sunlight, ultimately affecting growth, reducing yield, and diminishing overall quality. Currently, weed control in lily fields primarily relies on manual labor, which is not only time-consuming and labor-intensive but also leads to increased production costs. The inefficiency of manual weed removal underscores the urgent need for automated and intelligent solutions to improve precision and efficiency in weed management.
With the rapid advancement of artificial intelligence (AI) and deep learning technologies [2], intelligent identification and automated removal of weeds in agricultural fields have become viable solutions. By leveraging state-of-the-art object detection models, it is possible to enhance the efficiency and accuracy of weed recognition, reducing reliance on manual labor and promoting the sustainable and healthy development of the lily industry. However, the complexity of natural environments, including varying lighting conditions, occlusions, and diverse weed species, poses significant challenges for accurate and real-time weed detection. To address these issues, this study proposes a novel object detection algorithm optimized for weed identification in lily fields.
The proposed method addresses several key gaps in the field of weed detection. Unlike traditional CNN-based approaches, the lightweight YOLOv7-tiny model ensures real-time weed detection with reduced computational requirements. The integration of the Chaotic Harris Hawks Optimization (CHHO) algorithm enhances the hyperparameter tuning process, improving model performance. Furthermore, the incorporation of Tent Chaotic Initialization and Differential Evolution techniques boosts the accuracy and robustness of the model, enabling effective weed detection under diverse environmental conditions. Additionally, this study introduces a custom weed detection dataset for lily fields, distinguishing it from previous studies focused on crops like maize, soybean, or cotton, and ensuring better model performance in this specific context.
The choice of the Harris Hawks Optimization (HHO) [3] algorithm for optimizing YOLOv7-tiny in lily field weed detection is primarily based on its strong exploration–exploitation balance, convergence speed, and adaptability to complex search spaces. Unlike traditional optimization methods such as Genetic Algorithms (GAs) [4], Particle Swarm Optimization (PSO) [5], or Grey Wolf Optimizer (GWO) [6], HHO mimics the cooperative hunting strategy of Harris hawks, allowing it to dynamically switch between exploration and exploitation phases. This adaptive mechanism enhances its ability to fine-tune YOLOv7-tiny’s hyperparameters, leading to improved detection accuracy and robustness in real agricultural environments. Furthermore, integrating chaotic mapping and differential evolution within HHO further improves its global search capability, preventing premature convergence and ensuring a more diverse set of optimal solutions. These enhancements are particularly beneficial in agricultural applications, where variations in lighting, occlusion, and complex backgrounds challenge detection performance. Given these advantages, HHO was selected as the optimization framework for this study to enhance YOLOv7-tiny’s ability to detect weeds in lily fields more efficiently and accurately than existing approaches.
The main contributions of this work are summarized as follows:
  • A specialized weed detection model for lily field images is proposed, significantly improving detection accuracy in complex field conditions, thereby advancing research in computer vision and precision agriculture.
  • A lightweight YOLOv7-tiny model is developed, incorporating dynamic pruning and knowledge distillation to achieve efficient weed detection without compromising accuracy.
  • An enhanced Harris Hawks Optimization (HHO) algorithm is introduced, integrating Tent Chaos and Differential Evolution mechanisms to fine-tune the parameters of the YOLOv7-tiny model, further boosting its performance.
  • A dedicated dataset for lily field weed detection is constructed for the first time, providing a valuable benchmark for future research. Experimental results demonstrate the superior performance of the YOLOv7-tiny model on this dataset.
The remainder of this paper is structured as follows:
Section 2 provides an overview of related work, describing previous research on weed detection and deep learning-based approaches in agriculture. It also covers the materials and methods used in this study, including the construction of the lily field dataset, the fundamentals of the Harris Hawks Optimization algorithm, and the YOLOv7 framework. Section 3 describes the materials and methods, including the construction of the lily field dataset, the fundamentals of the Harris Hawks Optimization algorithm, and the YOLOv7 framework. Section 4 introduces the proposed approach, detailing the Chaotic Harris Hawks Optimization algorithm and the modifications made to the YOLOv7 model. Section 5 presents the experimental setup, evaluation metrics, and comparative analysis of different models. Finally, Section 6 discusses the main findings of this study, and Section 7 concludes the study with future research directions.

2. Related Works

In recent years, researchers have made stage-by-stage progress in adopting the use of deep learning to identify weeds for classification. For example, R. Punithavathi [7] proposed a weed classification model based on the combination of multi-scale Faster-RCNN-based and optimal limit learning machine (ELM)-based target detection, which resulted in a weed identification accuracy of 98.33%. Jiang et al. [8] designed a CNN-based graph neural network, which achieved 97.8%, 99.37%, and 98.93% accuracies on corn weed dataset, lettuce weed dataset, and radish weed dataset, respectively, which were higher than the values from a traditional CNN model, introducing a new breakthrough in the weed recognition field. Peng Mingxia [9] used a residual convolutional network to extract features and introduced the feature pyramid into the neural network to identify weeds in the cotton field; recognition rate reached 95.5%. Andrea et al. [10] studied the classification of maize and weeds by optimizing the CNN network, and the highest accuracy rate reached 97.26%, which provided strong technical support for the management of weeds in the maize field. Hu et al. [11] used the graph convolutional network structure based on convolutional features with Euclidean distance to construct the graph convolutional network and used semi-supervised learning to train the model and predict the target. On the other hand, they used a Graph Neural Network (GNN) to carry out a recognition study of eight weeds such as horse primrose tansy, silver gum daisy, and thorny acacia, with an accuracy of 98.1%, which shows the potential of GNNs in the field of weed recognition. Ahmad et al. [12] used VGG16 to carry out a recognition study of four weeds in maize and soybean fields with an accuracy of 98.90%, which further verified the applicability of VGG16 in weed recognition.
Moreover, significant progress has been made in optimizing deep learning models using metaheuristic methods. In natural orchard scenarios, complex environmental factors such as lighting and shadows increase the difficulty of accurately recognizing and locating apple fruits. To address this challenge, researchers proposed a heterogeneous image fusion model based on the Pulse Coupled Neural Network (PCNN) [13]. Notably, the PCNN model parameters were optimized using the Human Mental Search (HMS) [14] algorithm. Ahmet Karaman et al. [15] introduced a novel deep learning approach that differs from traditional systems. This method is fundamentally built on the YOLOv5 object detection algorithm integrated with the Artificial Bee Colony (ABC) optimization algorithm. The YOLOv5 model was employed for polyp detection, while the ABC algorithm was utilized to enhance the model’s performance by identifying the optimal activation functions and hyperparameters—a concept that inspired this study. Similarly, Ishak Pacal et al. [16] replaced the entire structure with a Cross-Stage Partial Network (CSPNet), substituted the Leaky ReLU activation function with the Mish activation function, and replaced the Distance-IoU (DIoU) loss with the Complete-IoU (CIoU) loss. Furthermore, their work simultaneously optimized multiple hyperparameters to improve the model’s overall performance. To provide a clear and visual presentation of the gaps observed in the related works, we detail these differences in Table 1, where we list the contributions of previous studies alongside the identified gaps and how our method addresses them.

3. Materials and Methods

3.1. Materials

The dataset used in this study was collected from the Yuzhong Experimental Base of the Institute of Plant Protection, Gansu Academy of Agricultural Sciences. Based on observations and statistics from the experimental base, the most detrimental field weeds to lilies during the early, middle, and late growth stages predominantly belong to the Amaranthaceae, Asteraceae, and Convolvulaceae families. Specifically, the Amaranthaceae family includes weeds such as Amaranthus retroflexus, Salsola collina, Amaranthus blitum, and Chenopodium hybridum; the Asteraceae family is represented by Lactuca indica; and the Convolvulaceae family includes Convolvulus arvensis. Images of the collected weeds are shown in Figure 1.
The dataset used in this study comprises images of lily plants and six types of weed plants. Specifically, the dataset includes 2233 images of lily plants, 427 images of Amaranthus retroflexus, 403 images of Salsola collina, 433 images of Amaranthus blitum, 660 images of Chenopodium hybridum, 1070 images of Lactuca indica, and 440 images of Convolvulus arvensis, resulting in a total of 5666 images. The dataset was divided into training, validation, and testing sets in a ratio of 8:1:1. Detailed information on the species is provided in Table 1.
Based on the performance metrics in Table 2 and considering the number of images for each class in the dataset, it was observed that classes with larger quantities of images, such as lilies and Lactuca indica, demonstrated better recognition performance. In contrast, classes with fewer images exhibited poorer or more fluctuating evaluation metrics. To address the issue of insufficient images, a commonly used data augmentation strategy in the field of deep learning was employed. This strategy involved increasing the number of training images by applying data augmentation techniques, including horizontal flipping, rotation, and color jittering. Specifically, images were flipped horizontally, rotated by 20°, and adjusted in brightness and contrast. The brightness factor was randomly sampled from the range of [1.0, 2.0], while contrast adjustments varied within [1.0, 3.0], ensuring diverse lighting conditions in the augmented dataset. The updated quantities of images for each class in the lily-weed dataset after data augmentation are shown in Table 3.

3.2. Harris Hawks Optimizer

The Harris Hawks Optimizer (HHO) [3] is a novel nature-inspired optimization algorithm proposed by Heidari et al. in 2019. This algorithm is inspired by the cooperative hunting strategies of Harris hawks (Parabuteo unicinctus), modeling their dynamic behaviors in the wild to hunt prey collaboratively. Harris hawks are renowned for their highly cooperative and adaptive hunting strategies, making them an excellent source of inspiration for addressing optimization problems.
As a metaheuristic algorithm, HHO has gained widespread application due to its simplicity, minimal parameter requirements, and ease of implementation. It has been successfully utilized in various fields, including function optimization, engineering design, image processing, and solving other complex problems. HHO is particularly noted for its efficiency and robustness, demonstrating exceptional performance in tackling multidimensional complex optimization problems.
HHO achieves global optimization by modeling the dynamic interactions between prey (the target in the solution space) and predators (candidate solutions). The algorithm integrates exploration and exploitation phases, which dynamically switch based on the fitness of current individuals and stochastic factors. This dynamic adjustment ensures a balance between global search (exploration) and local search (exploitation).

3.2.1. Exploration Phase

In HHO, a random value q within the range of ( 0 , 1 ) determines the behavior of individuals. When q < 0.5 , individuals move based on the positions of other hawks; when q 0.5 , individuals randomly perch within the active range of the population.
During the exploration phase, Harris hawks simulate searching for prey across the environment. The mathematical model of this behavior is given by Equation (1).
X ( t + 1 ) = ( X rabbit ( t ) X m ( t ) ) r 3 · ( L B + r 4 · ( U B L B ) ) , if q < 0.5 X rand ( t ) r 1 · | X rand ( t ) 2 r 2 · X ( t ) | , if q 0.5
X m ( t ) = 1 N i = 1 N X i ( t )
where X ( t + 1 ) represents the position of the individual after the t + 1 th iteration; X ( t ) represents the position of the individual after the tth iteration; X rabbit ( t ) is the position of the rabbit, which is the optimal position in the population; X rand ( t ) is an individual randomly selected from the current population; X m ( t ) is the average value of population position; r 1 , r 2 , r 3 , r 4 are random numbers in the range of ( 0 , 1 ) ; LB and UB are the lower and upper bounds of the population range, respectively; N represents the size of the population.

3.2.2. Transition from Exploration to Exploitation

In the Harris Hawks Optimizer (HHO), Escape energy (E)—see Equation (3)—is a dynamic parameter that simulates prey escape ability and guides the algorithm’s search behavior at different stages. When the escape energy gradually changes through a mechanism greater than or equal to 1, the exploration phase is executed; otherwise, the development phase is executed. Dynamic switch an be performed between global search and local development to enhance the optimization performance of the algorithm.
E = 2 E 0 1 t T
where E 0 represents a random number in the range of [ 1 , 1 ] and T is the maximum number of iterations.

3.2.3. Exploitation Phase

During the development phase, the process of Harris hawks surrounding prey and hunting together is simulated. The development phase simulates the behavior of Harris hawks in capturing prey, utilizing the gradually depleted energy of the prey and adopting different strategies to approach the target individual. The process is based on the escape energy E value of the target individual, which determines whether to conduct contraction encirclement or capture prey. The escape energy E of the target individual is a dynamically changing parameter used to characterize their escape ability. Based on the energy level of the target individual, HHO mainly adopts two strategies during the development phase.
Soft besiege
When r 0.5 and | E | 0.5 , the target individual still has a certain escape ability, and the population gradually shrinks and surrounds the prey to reduce its escape space. We update the formulas to Equations (4) and (5).
X ( t + 1 ) = Δ X ( t ) E J X rabbit ( t ) X ( t )
Δ X ( t ) = X rabbit ( t ) X ( t )
Here, Δ X ( t ) represents the distance between target individuals during the iteration process; J is the jump step size of the target individual, which is a random value with a range of ( 0 , 2 ) .
Hard besiege
When r 0.5 and | E | < 0.5 , the escape ability of the target individual is weak, and the population quickly approaches the position of the target individual. We update the formula to Equation (6).
X ( t + 1 ) = X rabbit ( t ) E Δ X ( t )
Soft besiege with progressive rapid dives
During the development phase, HHO ensures the balance of search capabilities by combining the dynamic changes in the energy of target individuals, the updating of population positions, and random perturbations. In the later stage of the search (when the energy of the target individual is low), we focus on local fine search; in the early stage of search (when the energy of the target individual is high), we enhance global exploration ability to avoid falling into local optima.
When r < 0.5 and | E | 0.5 , the target individual has strong escape ability, and the population approaches the target individual’s position using a soft surround mechanism. We update the formulas to Equations (7) and (8).
Y = X rabbit ( t ) E J X rabbit ( t ) X ( t )
Z = Y + S * LF ( D )
LF ( x ) = 0.01 × u × σ | v | 1 / β , σ = Γ ( 1 + β ) sin π β 2 Γ 1 + β 2 β 2 β 1 2 1 / β
X ( t + 1 ) = Y if F ( Y ) < F ( X ( t ) ) Z if F ( Z ) < F ( X ( t ) )
Among them, D represents the dimension of the problem, S is a D-dimensional random vector, and L F ( x ) in Equation (9) is the Levy flight formula. u, v are random numbers in the range of ( 0 , 1 ) , and β is often set to 1.5.
Hard besiege with progressive rapid dives
When r < 0.5 and | E | < 0.5 , the target individual has a lower ability to escape and there is a probability of escape. Therefore, a progressive soft surround strategy is adopted to shorten the gap with the target.
X ( t + 1 ) = Y if F ( Y ) < F ( X ( t ) ) Z if F ( Z ) < F ( X ( t ) )
We update the formulas to Equations (12) and (13), X m ( t ) is the average value of population position as shown in Equation (2).
Y = X rabbit ( t ) E · | J · X rabbit ( t ) X m ( t ) |
Z = Y + S * · L F ( D )
In summary, the HHO pseudocode is shown in Algorithm 1.
Algorithm 1: Pseudo-code of HHO algorithm [3]
Symmetry 17 00370 i001

3.3. YOLOv7

The YOLOv7 network [17] is an evolution of YOLOv5 [18], inheriting many hyperparameters from its predecessor. To enhance network performance, this study introduces improvements to the YOLOv7 algorithm in three aspects: loss function, Backbone feature extraction network, and attention mechanism. The architecture of the improved YOLOv7 algorithm is illustrated in Figure 2. The model consists of four layers, with input dimensions of 640 × 640 × 3, representing an image with a resolution of 640 pixels and three channels. The Backbone module serves as the core of the network, where each CBS block comprises a standard convolutional layer, a batch normalization (BN) layer, and an activation function layer using the SiLU function.
YOLOv7 is the foundational model in the YOLO series and demonstrates superior speed and accuracy compared to most known object detectors within the range of 5–160 frames per second. Among real-time object detectors achieving over 30 frames per second on the V100 GPU, YOLOv7 achieves the highest accuracy. The YOLOv7 series includes three primary models: YOLOv7-tiny [19], YOLOv7, and YOLOv7-W6 [20]. Compared to other networks in the YOLO series, YOLOv7 adopts a detection strategy similar to YOLOv4 [21] and YOLOv5, with its network architecture depicted in Figure 2.
The YOLOv7 network model primarily consists of four components: Input, Backbone, Neck, and Head. First, the input images undergo preprocessing steps such as data augmentation in the Input module before being passed to the Backbone. The Backbone is responsible for extracting features from the preprocessed images. Subsequently, the extracted features are processed by the Neck module, which performs feature fusion to generate feature maps of three scales: large, medium, and small. Finally, the fused features are passed to the Head module, where detection results are produced.
The Backbone of the YOLOv7 model is composed of convolutional layers, the E-ELAN (Extended-ELAN) module, the MPConv module, and the SPPCSPC module. The E-ELAN module builds upon the original ELAN by modifying the computational blocks while retaining its transition layer structure. It enhances the network’s learning capability through expand, shuffle, and merge cardinality operations without disrupting the original gradient pathways. The SPPCSPC module introduces parallel MaxPooling operations within a series of convolutions, addressing issues such as image distortion caused by processing operations and the challenge of extracting redundant features in convolutional neural networks.
In the MPConv module, the MaxPooling operation expands the receptive field of the current feature layer and fuses this information with the features processed by standard convolution, improving the network’s generalization ability.
In summary, the YOLOv7 network model optimizes the structure and functionality of its components, achieving improved object detection performance while maintaining real-time processing capabilities. This makes YOLOv7 a robust performer across various practical application scenarios.
To address the challenges of complex field environments and low weed recognition rates, a weed detection method based on YOLOv7 is proposed for the identification of weeds in Lanzhou lily fields. This approach first applies dynamic pruning and knowledge distillation techniques to detect lily and weed images in complex environments. Experimental results demonstrate that compared to the YOLOv7 model, the proposed method significantly improves the classification accuracy of lilies and weeds.

4. Proposed Method

4.1. Chaotic-Based Harris Hawks Algorithm

4.1.1. Tent Chaotic System

In modern optimization algorithms, population initialization is one of the key steps influencing algorithm performance. A well-designed population initialization can enhance the diversity of solutions, improve the global search capability of the algorithm, and consequently elevate the quality of optimization results. To this end, chaos theory has gradually been incorporated into optimization algorithms to generate initial populations with favorable distribution characteristics. Chaotic systems [22], due to their randomness and ergodicity under deterministic conditions, have become an important tool in the design of optimization algorithms. Among them, the Tent map is a classical and simple chaotic map that demonstrates superior performance during population initialization.
The Tent map generates chaotic sequences through a simple recursive formula, and its mathematical expression is shown in (13):
x n + 1 = μ x n , if x n < 0.5 , μ ( 1 x n ) , if x n 0.5 .
Here, x n ( 0 , 1 ) is the state variable, and μ is the control parameter, usually taken as 2. In the case of μ = 2 , Tent mapping can generate a chaotic sequence that traverses the entire interval ( 0 , 1 ) , providing a uniformly distributed initial solution for optimization algorithms.
Compared to traditional random initialization methods, the initialization approach based on Tent chaotic mapping can more effectively avoid the issue of concentrated distribution in the solution space, thereby improving the global search capability of the algorithm. This is particularly beneficial for complex optimization problems such as multi-modal function optimization and nonlinear constrained optimization, where the incorporation of Tent mapping significantly enhances the algorithm’s performance.
This study explores the application principles of Tent chaotic mapping in population initialization and analyze its performance and advantages across various optimization algorithms.
In the Tent chaotic mapping process, the population is generated within a D-dimensional space as a chaotic sequence s i = { s i , d d = 1 , 2 , , D } , where i = 1 , 2 , , N . This enables comprehensive coverage of the search space and enhances global search capabilities.
The initial values of the generated chaotic sequence are then mapped to the search space, resulting in a population matrix X = { X i i = 1 , 2 , , N } , where everyone is represented as X i = { X i , d d = 1 , 2 , , D } . The mapping relationship is mathematically expressed as follows:
x i , d = l b d + s i , d · ( u b d l b d )
Here, l b d and u b d denote the lower and upper bounds of the search space in the dth dimension, respectively, and s i , d represents the value of the chaotic sequence in the dth dimension.
This mapping transforms the nonlinear properties of the chaotic sequence into the spatial distribution of population individuals within the search space. As a result, the initial solutions gain diversity, significantly enhancing the algorithm’s global search capabilities and laying a solid foundation for subsequent optimization processes.

4.1.2. Differential Evolution

Differential Evolution (DE) [23] is a population-based global optimization algorithm proposed by Storn and Price in 1995. As a classical evolutionary algorithm, DE has been widely applied in optimization fields due to its simplicity, robustness, and efficiency. By simulating the “mutation, crossover, and selection” mechanisms found in biological evolution, DE progressively converges towards the optimal solution, making it particularly suitable for solving complex nonlinear, high-dimensional, and non-convex optimization problems.
The core concept of DE is to guide the search direction using the differential information between individuals in the population. The algorithm consists of four stages: initialization, mutation, crossover, and selection. In the mutation phase, DE introduces random differences between population individuals to generate new candidate solutions, enhancing diversity and the ability to explore the solution space. In the crossover phase, DE combines the mutated solutions with the current solutions to improve the algorithm’s local exploitation ability. Finally, in the selection phase, individuals with higher fitness are retained to accelerate the convergence process. This unique mechanism enables DE to strike a balance between maintaining population diversity and accelerating convergence speed.
Compared to other optimization algorithms, DE has several notable advantages: its simple structure, ease of implementation, few parameters, and low dependency on parameter settings. Moreover, DE has demonstrated strong adaptability and competitiveness in high-dimensional problems, constrained optimization, and multi-objective optimization problems. As a result, it is widely applied in engineering optimization, machine learning, image processing, neural network training, and other scientific and engineering problems.
v = x r 1 + F · ( x r 2 x r 3 )
v = x * + F · ( x r 2 x r 3 )
v = x i + F · ( x * x i ) + F · ( x r 1 x r 2 )
v = x * + F · ( x r 1 x r 2 ) + F · ( x r 3 x r 4 )
v = x rand 1 + F · ( x r 2 x r 3 ) + F · ( x r 4 x r 5 )
In the formula, v i is the position vector of the individual after mutation, F is the scaling factor, and x r 1 , x r 2 , and x r 3 are the position vectors of random individuals r 1 , r 2 , and r 3 , respectively.
The core of differential evolution is to use the difference vectors between different individuals in the population to generate new solutions, thereby improving the diversity of search. In the improved HHO algorithm, the mutation operation is defined by the following Equation (21) to generate a new candidate solution:
v ( t + 1 ) = ( X rabbit ( t ) X m ( t ) ) r 3 · ( L B + r 4 · ( U B L B ) ) , if q < 0.5 X rand ( t ) r 1 · | X k ( t ) 2 r 2 · X ( t ) | , if q 0.5
where X k is the individual in the k-neighborhood, and the k-neighborhood consists of the 3/N individuals closest to the current individual x i . This operation provides HHO with a stronger global exploration capability, helping it to jump out of local optima.
To increase the diversity of solutions and improve the robustness of the algorithm, the crossover operation in differential evolution is used to combine the variant individual v i ( t ) with the current individual X i ( t ) to generate the candidate solution:
X new ( t + 1 ) = v i ( t ) , if rand j C R or j = j rand X i ( t ) , otherwise
where v i ( t ) is the mutated individual, rand j is a random number between 0 and 1, C R is the crossover rate, and j rand is the randomly selected index for the crossover operation.
The generated candidate solution is compared with the current individual, and the solution with the better fitness value is selected as the next generation individual. This is mathematically expressed as
X i ( t + 1 ) = X new ( t + 1 ) , if F ( X new ( t + 1 ) ) F ( X i ( t ) ) X i ( t ) , otherwise
where X new ( t + 1 ) is the candidate solution generated through mutation and crossover and F ( · ) represents the fitness function.
The selection mechanism maintains the diversity of CHHO populations while ensuring the gradual optimization of fitness values.
In summary, the CHHO pseudocode is shown in Algorithm 2.
Algorithm 2: Pseudo-code of CHHO algorithm
Symmetry 17 00370 i002

4.2. YOLOv7-Tiny

When using the YOLO model for object detection, especially in large-scale or complex scenes, the original YOLO model may face challenges due to high memory consumption and long processing times. To improve the efficiency of object detection algorithms, there has been continuous exploration of lightweight approaches aimed at reducing the model’s parameter count and computational load while maintaining high recognition accuracy.
In the YOLOv7 algorithm, attempts have already been made to optimize the model by replacing some convolution modules with lightweight components. This approach reduces resource consumption while striving to maintain the model’s performance. However, simply replacing convolution modules may not be sufficient to meet the stringent requirements for both efficiency and accuracy in demanding scenarios.
This study proposes a model optimization method that combines dynamic pruning and knowledge distillation. Dynamic pruning is a technique that dynamically removes unimportant connections or neurons during model training, effectively reducing the model’s parameter count and computational complexity. Knowledge distillation, on the other hand, is a method that transfers knowledge from a large model (teacher model) to a smaller model (student model), enabling the smaller model to achieve performance close to that of the large model while maintaining a compact size.
By combining these two techniques, the proposed method enables efficient detection and recognition of weeds in lily fields without sacrificing accuracy. Specifically, dynamic pruning removes redundant connections and parameters in the model, reducing its complexity and memory usage, while knowledge distillation helps recover or enhance the performance that may be lost due to pruning by transferring knowledge from the large model. This approach holds promise for providing efficient and accurate object detection solutions in resource-constrained real-world applications.

4.2.1. Pruning

Pruning [24] is a commonly used model compression technique in deep learning neural networks aimed at improving the model’s efficiency and inference speed by reducing redundant parameters and connections while also decreasing the risk of overfitting. The pruning rate, which is typically chosen through manual selection of hyperparameters, not only affects the degree of pruning but can also have adverse consequences if improperly selected, leading to serious issues in subsequent retraining.
To address this problem, this paper proposes the integration of dynamic pruning into the model training process. Unlike traditional pruning methods that rely on a fixed standard to evaluate the relationship between input images and convolution kernels or randomly discard connections, dynamic pruning adopts a more adaptive approach. The method involves pruning certain redundant channels in the neural network model, thereby reducing its complexity. Dynamic pruning operates through sparse training, where the parameters from the Batch Normalization (BN) layers are used to identify channels with smaller weights. These channels are then removed to achieve the desired pruning effect.
The dynamic pruning approach introduces a scarification parameter, which controls the sparsity of the model. The higher the scarification parameter, the sparser the model becomes, allowing for a higher pruning ratio. This parameter must be carefully tuned to ensure that the model’s performance does not degrade significantly while also maintaining an adequate pruning rate. After pruning, the model performance typically drops, and further fine-tuning is required to restore its performance to a level comparable to the pre-pruned model.

4.2.2. Knowledge Distillation

Knowledge distillation [25] was first introduced by Bucila et al. [26]. It utilizes transfer learning to guide the training of a smaller and more compact student network using the outputs from a larger and more complex teacher network with superior performance. The compressed student network aims to retain the high performance of the teacher network by relying not only on the network’s output but also on the intermediate feature information. Vasileios et al. introduced the concept of Generative Adversarial Networks (GANs) [27] using a discriminator to distinguish whether the output feature map comes from the teacher or the student network. This helps align the feature information from both networks as closely as possible. Similarly, GANs are used to learn the objective function from the teacher network and guide the training of the student network.
Knowledge distillation is applied to both the feature extraction layer and the feature fusion layer, allowing the student network to benefit from both the feature extraction knowledge and the feature fusion knowledge of the teacher network. In the YOLOv3 detection model, applying knowledge distillation resulted in a 9.3% improvement in mAP [28]. Typically, knowledge distillation-based compression methods transfer the feature information from the teacher network to the student network, with the compressed network outperforming the original. However, challenges arise in terms of feature space transformation, and this approach tends to deliver superior performance mainly in tasks involving the Softmax classification function. Its generalization ability in other tasks is often less effective. A flowchart of the knowledge distillation process is shown in Figure 3.
As shown in Figure 3, logits refer to the part where the student directly mimics the final prediction of the teacher. Distillation loss refers to the component that learns the soft targets. The teacher model contains n layers, while the student model consists of m layers.

4.2.3. Parameter Optimization

In the CHHO framework, we optimized nearly super parameters (such as learning rate, momentum, data enhancement parameters, etc.) and a variety of activation functions (including Silu, Selu, swish, etc.) of YOLOv7-tiny. Through optimization, not only the accuracy of weed detection is improved, but also the robustness of the model to different weed species is enhanced.
The datasets of the weed detection task in the lily field usually have problems of distribution difference and occlusion diversity. CHHO provides flexible configuration of fitness function (such as map, F1, precision, or recall rate) and supports dynamic adjustment of population size and search range according to the size of dataset. For small datasets, smaller population size and evaluation quantity can be selected to reduce optimization time. For large datasets, the larger search space ensures the comprehensiveness and robustness of optimization.
The optimized YOLOv7-tiny model has lightweight characteristics and is suitable for real-time weed detection in resource-constrained environments, such as embedded devices and mobile terminals. Through the optimization process of CHHO, the model training time can be effectively shortened and the deployment efficiency can be improved.
Figure 4 shows how this integration occurs. As shown in Figure 4, the proposed method has a very simple structure. Like all object detection algorithms, there are three basic operations, such as a dataset unit, a model unit, and an optimization unit. First, with the help of agricultural experts, the weeds in the lily field are marked, and then the dataset is obtained after using the image preprocessing method to clean these images. The last operation in the dataset unit is to appropriately divide the dataset into training data, validation data, and test data. Therefore, we can measure the generalization ability of the model on the validation set and its ability on invisible test data.
First, the dataset is preprocessed and divided into training, validation, and testing sets. This ensures that the YOLOv7-tiny model can effectively generalize and perform well on unseen data. The fitness function design uses the Mean Average Precision (mAP) as the fitness function to evaluate the performance of the YOLOv7-tiny model during the optimization process. The mAP score reflects the model’s ability to accurately detect targets and minimize false positives and false negatives.
Initial training on the YOLOv7-tiny model is performed using default hyperparameters such as learning rate, momentum, activation function, etc. By using pre-trained weights through transfer learning, the model can achieve reasonable performance without the need for extensive initial training. If the mAP score does not improve after several epochs, an early stopping strategy is adopted.
The CHHO algorithm is introduced to optimize the hyperparameters and activation function of YOLOv7-tiny. The optimization scope includes hyperparameters such as learning rate, momentum, and batch size. For example, the initial learning rate is selected within the range of [10-5, 10-1]. CHHO improves global search capability by introducing chaotic maps (such as Tent) to avoid becoming stuck in local optima. When initializing the CHHO algorithm, the population size is set to 50 and the number of iterations is 30 epochs to balance computational efficiency and optimization quality. In each iteration, CHHO dynamically adjusts hyperparameters and activation functions and updates them to improve the fitness (mAP) of YOLOv7-tiny. Meanwhile, the new activation functions are evaluated against the existing SiLU activation function. Integer values are assigned to each activation function. The CHHO algorithm is enabled to select the optimal activation function. At the end of optimization, the optimal combination of hyperparameters and activation functions is selected based on the highest mAP score achieved by the model. This optimized configuration is used to further fine tune YOLOv7-tiny. The optimized YOLOv7-tiny model exhibits higher detection accuracy and faster convergence speed. The entire process ensures that the model is more adaptable to specific datasets and task requirements.
By combining the global search capability of the CHHO algorithm with the excellent detection performance of YOLOv7-tiny, this method effectively balances model accuracy and computational cost, providing an efficient and reliable solution for object detection tasks.

5. Experimental Results

The model training experiments in this study were conducted on a Linux system, using an NVIDIA GeForce GTX 3080 GPU, a 12 vCPU Intel(R) Xeon(R) Platinum 8255C CPU @ 2.50 GHz, 40 GB of RAM, and 80 GB of memory, which meet the requirements of this experiment.
For the model training hyperparameters, the initial learning rate was set to 0.001, and a dynamic learning rate strategy was employed, where the learning rate is reduced by a factor of ten every 30 epochs. This strategy helps the model converge faster and avoids being misled by local optima. The most used cross-entropy loss function was utilized to calculate the model’s loss value, and the SGD optimizer was used to iteratively train the parameters. Detailed parameter information can be found in Table 4.
Through the lightweight optimization of YOLOv7, the efficiency of weed identification has been further improved, reducing the impact of precision on the model’s classification performance. When the network model is large, convolutional neural networks become difficult to train. Therefore, we propose a method for identifying weeds in lily fields using a combination of pruning and distillation. Knowledge distillation allows the large model to transfer the knowledge it has learned to guide the training of the smaller model, significantly reducing the number of parameters and further achieving model compression and acceleration. Meanwhile, model pruning removes components that have minimal impact on the results, reduces the number of heads, and shares parameters, among other techniques. Together, knowledge distillation improves the model’s accuracy, reduces its latency, and compresses its network parameters. Dynamic pruning further reduces the model’s parameters, ultimately achieving a lightweight YOLOv7 network model.
The weed images in the lily fields were manually annotated using the Label Image rectangular annotation tool to ensure accurate labeling of the weed and lily contours. To enhance the distinction between lilies and weeds under complex environmental interference, only the lily leaves were labeled, enabling the model to be highly sensitive to the overall structure of the lily. As shown in Figure 5, the annotated image environment was displayed. After annotation, the images were converted to the YOLO standard dataset format for subsequent training, validation, and testing. In cases of overlapping objects, the bounding boxes were carefully adjusted, further increasing the difficulty of extracting features from the lilies and weeds.

5.1. Comparative Results and Discussion of CHHO

The chaotic system [29] is a classical optimization strategy known for its diverse types and dynamic characteristics, which enable robust global search capabilities. Different chaotic systems exhibit varying performance in global exploration, local search, and space traversal. In this study, we selected 21 representative chaotic systems for comparative experiments to evaluate their optimization performance.
The experimental results indicate that the Tent chaotic system significantly outperforms other systems, particularly in terms of diverse search capabilities and approximating the global optimum. Consequently, we selected Tent as the core mechanism for chaotic initialization and search.
To further validate the superiority of Tent, we selected three types of classical test functions [30,31]: unimodal functions, multimodal functions, and fixed-dimensional functions. From these, six classical functions (see Table 5) with distinct characteristics were chosen for comparative experiments, covering simple convex optimization problems and complex nonlinear high-dimensional optimization challenges.
In Table 5, the comparison metric is the final objective (fitness) value achieved on each test function, with results expressed in scientific notation. The test functions are denoted as F1, F3, F10, F12, F15, and F21, which represent standard benchmark functions commonly used in the optimization literature to evaluate algorithm performance (e.g., unimodal, multimodal, and non-convex functions; see references [30,31]). For instance, F1 might correspond to a simple unimodal function like the Sphere function, while the other functions are designed to assess different aspects such as landscape ruggedness and scalability. Lower (or in some cases higher) final objective values indicate better optimization performance depending on the formulation of each test function. Table 6 also compares various chaotic mapping algorithms employed to generate initial populations or chaotic sequences, including methods such as Random, Chebyshev, Circle, Gauss, Iterative, Logistic, Piecewise, Sine, Singer, Sinusoidal, Kent, Fuch, SPM, ICMIC, Tent–Logistic–Cosine, Sine–Tent–Cosine, Logistic–Sine–Cosine, Henon, Cubic, Logistic–Tent, Bernoulli, and Tent. These algorithms are referenced in the literature (see references [29,32,33]) and serve as alternative approaches to facilitate global exploration in optimization problems.
Experimental results in Table 6 demonstrate that the Tent system performs [34,35,36] exceptionally well across the selected test functions. Among 23 classical test functions, Tent exhibits outstanding performance in both unimodal and multimodal functions. It not only converges rapidly to the global optimal solution but also shows higher convergence stability and stronger resistance to interference.
To present the experimental results more intuitively, the following figures were plotted: Figure 6 illustrates the chaotic curve of the Tent system [32,33], representing its traversal performance across the search space. The curve indicates that Tent effectively covers the search space, avoiding local optima.
Figure 7 shows the performance histogram, displaying the fitness value distributions of different chaotic systems on the test functions. The histogram highlights Tent-stable performance across various functions.
Figure 8 is a chaotic scatter plot, representing Tent exploration and exploitation distribution in the high-dimensional search space. The plot showcases Tent-efficient exploration and robust global search characteristics.
Figure 9 shows the comparison diagram of iteration curves, which are compared among 21 kinds of chaotic systems to select the optimal system.
To ensure the fairness and objectivity of the experiments, identical experimental parameters were applied across all algorithms, specifically the following: Population size N = 50, ensuring each chaotic system performs searches with the same number of individuals; Dimensionality D = 30 (excluding fixed-dimensional functions), standardizing the search space scale for optimization problems; Maximum number of iterations set to 50, balancing algorithm runtime and ensuring comparable results.
Overall, the experimental findings confirm that the Tent chaotic system consistently outperforms others across various optimization problems, particularly in global search capability and convergence accuracy. This discovery provides strong support for the practical application of chaotic optimization strategies.
For the lily field dataset, using the improved Chaotic Harris Hawks Optimization (CHHO) algorithm to optimize the YOLOv7-tiny algorithm significantly enhanced its performance in detecting lily field weeds. As shown in subsequent sections, the YOLOv7-tiny parameters optimized by CHHO exhibit stronger competitiveness in detection tasks.
Through iterative optimization with the CHHO algorithm, the optimal activation functions and hyperparameter combinations for the lily field dataset were identified. During the optimization process, weights trained using 11 activation functions for the YOLOv7-tiny model were accumulated into a weight pool, from which one weight was randomly selected as the starting point for optimization. The optimization was performed in the form of fine-tuning, requiring at least 20 epochs to ensure effectiveness. In this process, besides optimizing the activation functions, hyperparameters can also be adjusted, or both activation functions and hyperparameters can be optimized simultaneously.
This study employed a simultaneous optimization approach, leveraging ample computational resources and time. Table 7 compares the default hyperparameters and activation functions of the YOLOv7-tiny algorithm with the optimized values obtained through different optimization algorithms, including CHHO, HHO, SCA [37], WOA [38], and PSO [39]. The table highlights CHHO’s superior tuning capabilities, demonstrating its effectiveness in refining key parameters such as activation functions, momentum, weight decay, and learning rate. This CHHO-based optimization method not only enhances model performance but also provides a comparative analysis of various metaheuristic approaches, offering practical insights for improving YOLO parameter tuning.
The computational complexity of the CHHO algorithm can be analyzed based on its four main components: population initialization, exploration phase, exploitation phase, and ranking mechanism. The initialization process, including the Tent Chaotic Mapping strategy, has a complexity of O ( n × d ) , where n is the population size and d is the dimensionality of the search space. The exploration phase, responsible for global searches, follows the Harris Hawks Optimization (HHO) framework and has a complexity of O ( L × n × d ) , where L represents the maximum number of iterations. The exploitation phase integrates the Differential Evolution mechanism to refine the solution, contributing an additional complexity of O ( L × n × d ) . Finally, the ranking mechanism employs a fast sorting method, leading to a worst case complexity of O ( L × n log n ) . Combining these components, the overall complexity of CHHO can be expressed as O ( n × d ) + O ( L × ( 2 n × d + n log n ) ) , which simplifies to O ( L × n log n ) , demonstrating that CHHO maintains a reasonable computational burden while significantly improving convergence efficiency through the combination of chaotic mapping and differential evolution mechanisms.

5.2. Comparative Results and Discussion of YOLOv7-Tiny

YOLOv7-tiny Model Detection Results Analysis:
(1) Impact of Different Network Models on Weed Detection in Lanzhou Lily Fields.
In this study, we compared different network models [40,41,42,43,44,45] through experiments to identify the model with the highest accuracy for weed detection in Lanzhou lily fields. To address the issue of long inference time with the larger YOLOv7 model, we employed a dynamic pruning strategy to reduce the model’s complexity and subsequently retrained the model. The results showed a notable improvement in accuracy across all models. The accuracy of the Lanzhou lily-weed detection model based on different network models is summarized in Table 8.
As shown in Table 8, selecting the appropriate model is crucial for object detection tasks. Due to differences in structure, parameters, and optimization methods, various models exhibit distinct performance during training. While the accuracy improvement varies significantly across different models, the YOLOv7 model consistently demonstrates superior overall metrics, with a substantial increase in accuracy. The average precision is 0.85 and the F1 score is 0.88. Therefore, in this study, YOLOv7 was selected for subsequent experiments.
(2) Impact of Different Parameter Counts on Weed Detection in Lanzhou Lily Fields.
To enhance the model’s recognition capabilities without compromising accuracy, knowledge distillation was introduced to improve the model’s learning speed. The experiment results indicate that knowledge distillation has effectively lightened the model to some extent while maintaining accuracy. Knowledge distillation allows knowledge to be transferred from a larger, more complex model (referred to as the “teacher model”) to a smaller, simpler model (referred to as the “student model”).
By transferring the knowledge from the teacher model to the student model, the results show that this method contributes to model lightweighting without significantly compromising accuracy. Although accuracy may decline during the distillation process, careful selection of the teacher and student models, as well as optimization of the distillation process, allows this accuracy loss to be controlled within an acceptable range.
Comparing the parameter counts of different versions of the YOLOv7-based model in this study, the results are shown in Table 9. Among the YOLOv7 series models, YOLOv7-tiny’ performed the best with an accuracy of 92.53%, an improvement of 6.7% over the previous model.
As shown in Table 9, when analyzing the YOLOv7 network models based on accuracy, the YOLOv7-tiny model achieved the highest accuracy of 92.53% with the fewest parameters. Despite the minimal decrease in accuracy compared to larger models, the YOLOv7-tiny model also demonstrated significant computational efficiency, with the lowest GFLOPs and the highest ms–FPS, making it well suited for real-time applications. Therefore, this study uses the YOLOv7-tiny model for the experiments, as it strikes an optimal balance between performance and efficiency.
(3) Detection Performance of Weeds in the Lily Field under Different Occlusion Conditions.
To investigate the impact of occlusion on the model’s performance, three types of occlusion conditions were tested: no occlusion, light occlusion, and severe occlusion. As shown in Figure 10, when the images of Lanzhou lily and weeds are either unobstructed or lightly occluded, the model maintains a high recognition accuracy. In cases where the features are clear, the model does not miss any detections or make false positives. However, when severe occlusion occurs, the irregular growth of weeds and lilies creates multiple gaps that expose limited features, providing insufficient information for the model to make accurate judgments. As a result, more missed detections are observed, though false detections are rare. Additionally, weak lighting caused by occlusion can further contribute to misclassification.
(4) The Impact of Different Dataset Sizes on Weed Detection in Lanzhou Lily Fields. Using YOLOv7-tiny as the base model, this study trains the Lanzhou lily-weed detection model, which incorporates pruning and distillation techniques, on datasets of various sizes. The aim is to explore how the proposed method performs under different dataset sizes. The comparison of the recognition accuracy of the lightweight YOLOv7-tiny model across datasets of varying sizes is shown in Figure 11.
In the comparison of different network models, as shown in Figure 11, YOLOv7-tiny exhibits the highest recognition accuracy, and the dataset size has the least impact on the model’s performance. When the sample size is 500 images, YOLOv7-tiny achieves the highest recognition accuracy. However, when the number of samples per class increases to 1500 images, the recognition accuracy of each model is at its peak. As the sample size decreases, the recognition accuracy of all models gradually decreases. Yet, YOLOv7-tiny shows minimal accuracy loss, indicating that the proposed method maintains high classification accuracy even with fewer samples. This demonstrates that the method can handle situations with limited Lanzhou lily-weed samples.
However, when the dataset is extremely small, convolutional neural networks (CNNs) struggle to classify the data accurately. The experiment highlights the reduced dependence on large datasets by the proposed method.
The YOLOv7-tiny model, implemented for Lanzhou lily-weed detection, addresses issues related to low accuracy in CNN-based models for identifying common weeds in lily fields, as well as the high data requirements. By analyzing the impact of different network models, parameter sizes, dataset sizes, and occlusion conditions on model performance, the experiment validates the effectiveness of the proposed approach.
Figure 12 shows the detection results for the YOLOv7-tiny network model with dynamic pruning and knowledge distillation on the lily-weed dataset. Comparing image (b) with image (a), it is evident that the enhanced model accurately detects weeds and lilies with improved precision. This indicates that even after model compression, the network is capable of learning the similarities within the same category and distinguishing between different categories in a short time, leading to accurate identification of weeds and lilies.
As shown in Figure 13, the model’s accuracy (P), recall rate (R), and P-R curve were recorded during the training process. From the plot in Figure 13a, it is evident that the accuracy increases rapidly during the initial training stages. Ultimately, the model achieves an accuracy of 89.2%, a recall rate of 81.5%, and a mAP (mean Average Precision) of 88.4% at an overlap threshold of 0.5. The variations in P, R, mAP, and loss values over iterations align with the experimental expectations. The series of network models proposed in this study, considering both parameter count and accuracy, offer significant advantages for practical applications.
To address the issue of insufficient data, which can negatively impact the performance of the network model and even prevent it from learning effective feature representations, experiments were conducted using the YOLOv7-tiny model. The results demonstrated its outstanding overall performance. YOLOv7-tiny achieved the highest recognition accuracy and showed stability in performance across different datasets, reaching 93.53%. This result highlights the model’s robustness and generalization capability when handling limited data. Additionally, the lightweight nature of YOLOv7-tiny enhances its flexibility and efficiency in practical applications. It can be deployed in resource-constrained environments, such as mobile devices or embedded systems, enabling real-time object detection and recognition. This makes it particularly valuable for precision weeding applications.

6. Discussion

Existing studies have applied deep learning to weed detection in agriculture. For example, Punithavathi et al. employed Faster-RCNN combined with an Extreme Learning Machine (ELM) to achieve high-accuracy classification; however, this method involves high computational complexity, making it unsuitable for real-time detection. Similarly, Jiang et al. used CNN-based feature extraction to distinguish crops from weeds but did not incorporate optimization techniques, leading to potential overfitting issues. Other studies, such as Peng Mingxia et al. [9], introduced residual networks and feature pyramids for weed detection in cotton fields, improving accuracy but with limited generalization across different crop environments. Additionally, Karaman et al. [15] optimized YOLOv5 using the Artificial Bee Colony (ABC) algorithm, enhancing detection performance. However, their optimization strategy suffered from premature convergence, and the network’s complexity made it less suitable for lightweight applications.
In contrast, this study proposes a Chaotic-Based Harris Hawks Optimization (CHHO)-optimized YOLOv7-tiny model, addressing the limitations of previous research in multiple aspects. First, the knowledge distillation and dynamic pruning techniques applied to the YOLOv7-tiny model enable efficient and lightweight real-time detection, overcoming the high computational cost of Faster-RCNN-based methods. Second, by integrating Tent chaotic mapping and differential evolution strategies, the improved HHO algorithm enhances parameter optimization stability, avoiding the local optima issues observed in ABC-based methods. Furthermore, this study constructs a dedicated dataset for weed detection in Lanzhou lily fields, addressing the gap in existing research, which primarily focuses on maize, soybean, and cotton fields. This dataset ensures that the proposed model is more robust and generalizable for practical applications in lily cultivation environments.
A key finding of the study is the correlation between dataset size and model performance. As expected, larger datasets generally lead to better accuracy, owing to the richer diversity of training samples. However, the marginal benefits diminish after reaching a certain threshold, highlighting the trade-off between data volume and computational cost. This suggests that while larger datasets are beneficial, an optimal size exists beyond which further data augmentation yields limited returns.
The analysis of different network architectures reveals a clear trade-off between accuracy and computational efficiency. Complex models with higher parameter counts, such as YOLOv7-D6 and YOLOv7-E6, achieve superior accuracy but require significantly more computational resources. On the other hand, simpler architectures, such as YOLOv7-tiny, demonstrate reasonable accuracy with much lower computational demands, making them suitable for resource-constrained environments.
Occlusion emerges as a critical factor affecting model performance. In real-world applications, weeds often overlap or are partially obscured by lily plants, which can lead to false positives or missed detections. This finding underscores the importance of robustness in model design, particularly for agricultural applications where such challenges are prevalent. Future work could explore techniques such as data augmentation with occlusion or advanced feature extraction methods to mitigate this issue.
The large-scale deployment of the CHHO-optimized YOLOv7-tiny model in agricultural applications presents both opportunities and challenges. In terms of cost, the model’s lightweight architecture and optimized parameters reduce the need for expensive high-performance GPUs, making it a cost-effective solution for precision agriculture. Additionally, the use of knowledge distillation and pruning techniques significantly lowers computational resource requirements, enabling deployment on edge devices with limited hardware capabilities.
Regarding processing time and feasibility on mobile or embedded devices, the model’s efficient structure allows for real-time weed detection with minimal latency. The CHHO optimization strategy accelerates convergence, ensuring rapid decision-making in dynamic field conditions. Moreover, its compatibility with low-power AI chips, such as NVIDIA Jetson and Raspberry Pi, makes it suitable for autonomous agricultural robots and drone-based monitoring systems, improving scalability in smart farming applications.
To address the balance between accuracy and efficiency, the YOLOv7 model is optimized to create YOLOv7-tiny. This lightweight variant reduces the number of parameters and computational complexity while maintaining a high level of accuracy. The model’s performance is validated through visual analysis of training results, showing that YOLOv7-tiny effectively meets the demands of real-time weed detection in lily fields in Lanzhou.
The study demonstrates the potential of using lightweight, optimized models for precision agriculture. By integrating chaotic systems and optimization algorithms into neural network training, it is possible to enhance performance while addressing resource constraints. YOLOv7-tiny’s balance of efficiency and accuracy makes it a strong candidate for deployment in agricultural monitoring systems, where real-time performance is crucial.
Despite its strong performance, the CHHO-optimized YOLOv7-tiny model has several limitations. One key constraint is its reliance on a specific dataset—Lanzhou lily fields—meaning its generalization to other crops or different weed species may be limited. Variations in soil conditions, lighting, and plant morphology across regions may require fine-tuning or retraining to maintain accuracy. Additionally, while knowledge distillation and pruning improve efficiency, further hardware-specific optimizations may be necessary for seamless deployment on ultra-low-power devices.
To enhance adaptability, future research could explore federated learning techniques, enabling collaborative model training across multiple agricultural regions while preserving data privacy. Expanding the dataset to include more diverse crop types and weed varieties would further improve generalization. Additionally, integrating self-supervised learning or adaptive fine-tuning mechanisms could help the model dynamically adjust to new environments, making it more robust for large-scale precision agriculture. In the future, we will increase lighting experiments to detect the effects of lighting changes on weed detection.

7. Conclusions

This study mainly introduced the Harris hawk algorithm using chaotic systems to optimize the lightweight YOLOv7 network model for detecting common weeds in lily fields. A series of experiments and comparative analyses were conducted. Seven different convolutional neural network models, including both classic and more recent architectures, were selected for training on the lily-weed dataset. The aim was to identify the best-performing model. During training, identical data preprocessing and training strategies were applied to ensure the comparability of the results. To assess the model’s performance more comprehensively, datasets of varying sizes were used to analyze how dataset size affects model performance. The experimental results revealed that as the dataset size increased, the model’s accuracy generally improved, but the gain gradually diminished after reaching a certain threshold.
In addition to dataset size, the effects of different network models, model parameters, and occlusion conditions on model performance were analyzed. The results indicated that more complex models generally achieved higher accuracy, but at the cost of increased computational load and memory usage. In contrast, simpler models, though slightly less accurate, were faster and more suitable for resource-constrained environments. The impact of occlusion on model performance is also significant, especially in real-world applications where weed occlusion can lead to false positives or missed detections.
To balance accuracy and efficiency, YOLOv7 was selected as the base model and further optimized to create the YOLOv7-tiny network. This model achieved a high level of accuracy while significantly reducing the number of parameters and computational complexity, making it more suitable for real-time weed detection in lily fields in Lanzhou. Finally, we compared the performance of different models using training result visuals. The results clearly showed that YOLOv7-tiny strikes a good balance between accuracy and efficiency. This validates the effectiveness of the experiment and demonstrates the potential of this approach for practical applications.
These findings offer valuable insights for practitioners aiming to implement efficient precision weeding solutions and provide researchers with a novel approach to optimizing deep learning models for agricultural applications.

Author Contributions

Methodology, J.T. and H.W.; Validation, M.Z. and P.S.; Resources, Y.H.; Writing—original draft, J.T.; Writing—review and editing, Z.Z.; Project administration, Z.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Open Foundation of the Qingdao Key Laboratory of Groundwater Resources Protection and Rehabilitation (No. DXSKF2022Y02), the Open Foundation of Key Laboratory of Geological Disaster Risk Prevention and Control of Shandong Provincial Emergency Management Department (No. 801KF2024-DZ07), and the Open Foundation of the Key Laboratory of Coupling Process and Effect of Natural Resources Elements (No. 2024KFKT017). Open Research Fund Program of Anhui Provincial Institute of Modern Coal Processing Technology, Anhui University of Science and Technology (Grant No. MTY202307), and Hubei Key Laboratory of Transportation Internet of Things (Wuhan University of Technology).

Data Availability Statement

Data are contained within the article.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Zhang, X.; Xue, L.; Wu, Z.; Zhang, W.; Zhang, H.; Zhao, C.; Liu, D. Insight into the Effects of Drying Methods on Lanzhou Lily Rehydration. Foods 2023, 12, 1817. [Google Scholar] [CrossRef] [PubMed]
  2. Pouyanfar, S.; Sadiq, S.; Yan, Y.; Tian, H.; Tao, Y.; Reyes, M.P.; Shyu, M.-L.; Chen, S.H.; Iyengar, S.S. A Survey on Deep Learning: Algorithms, Techniques, and Applications. ACM Comput. Surv. 2018, 51, 92. [Google Scholar] [CrossRef]
  3. Heidari, A.A.; Mirjalili, S.; Faris, H.; Aljarah, I.; Mafarja, M.; Chen, H. Harris hawks optimization: Algorithm and applications. Future Gener. Comput. Syst. 2019, 97, 849–872. [Google Scholar] [CrossRef]
  4. Mirjalili, S.; Mirjalili, S. Genetic algorithm. In Evolutionary Algorithms and Neural Networks: Theory and Applications; Springer: Berlin/Heidelberg, Germany, 2019; pp. 43–55. [Google Scholar]
  5. Marini, F.; Walczak, B. Particle swarm optimization (PSO). A tutorial. Chemom. Intell. Lab. Syst. 2015, 149, 153–165. [Google Scholar] [CrossRef]
  6. Mirjalili, S.; Mirjalili, S.M.; Lewis, A. Grey wolf optimizer. Adv. Eng. Softw. 2014, 69, 46–61. [Google Scholar] [CrossRef]
  7. Punithavathi, R.; Rani, A.D.C.; Sughashini, K.R.; Kurangi, C.; Nirmala, M.; Farhana, H.; Ahmed, T.; Balamurugan, S.P. Computer Vision and Deep Learning-enabled Weed Detection Model for Precision Agriculture. Comput. Syst. Sci. Eng. 2023, 44, 2759–2774. [Google Scholar] [CrossRef]
  8. Jiang, H.; Zhang, C.; Qiao, Y.; Zhang, Z.; Zhang, W.; Song, C. CNN feature based graph convolutional network for weed and crop recognition in smart farming. Comput. Electron. Agric. 2020, 174, 105450. [Google Scholar] [CrossRef]
  9. Mingxia, P.; Junfang, X.; Hui, P. Efficient recognition of cotton and weed in field based on Faster R-CNN by integrating FPN. Trans. Chin. Soc. Agric. Eng. Trans. CSAE 2019, 35, 202–209. [Google Scholar] [CrossRef]
  10. Andrea, C.C.; Daniel, B.B.M.; Misael, J.B.J. Precise weed and maize classification through convolutional neuronal networks. In Proceedings of the 2017 IEEE Second Ecuador Technical Chapters Meeting (ETCM), Salinas, Ecuador, 16–20 October 2017; pp. 1–6. [Google Scholar]
  11. Hu, K.; Coleman, G.; Zeng, S.; Wang, Z.; Walsh, M. Graph weeds net: A graph-based deep learning method for weed recognition. Comput. Electron. Agric. 2020, 174, 105520. [Google Scholar] [CrossRef]
  12. Ahmad, A.; Saraswat, D.; Aggarwal, V.; Etienne, A.; Hancock, B. Performance of deep learning models for classifying and detecting common weeds in corn and soybean production systems. Comput. Electron. Agric. 2021, 184, 106081. [Google Scholar] [CrossRef]
  13. Xu, W.; Liu, L. PCNN orchard heterologous image fusion with semantic segmentation of significance regions. Comput. Electron. Agric. 2024, 216, 108454. [Google Scholar] [CrossRef]
  14. Mousavirad, S.J.; Ebrahimpour-Komleh, H. Human mental search: A new population-based metaheuristic optimization algorithm. Appl. Intell. 2017, 47, 850–887. [Google Scholar] [CrossRef]
  15. Karaman, A.; Pacal, I.; Basturk, A.; Akay, B.; Nalbantoglu, U.; Coskun, S.; Sahin, O.; Karaboga, D. Robust real-time polyp detection system design based on YOLO algorithms by optimizing activation functions and hyper-parameters with artificial bee colony (ABC). Expert Syst. Appl. 2023, 221, 119741. [Google Scholar] [CrossRef]
  16. Pacal, I.; Karaboga, D. A robust real-time deep learning based automatic polyp detection system. Comput. Biol. Med. 2021, 134, 104519. [Google Scholar] [CrossRef]
  17. Zhou, S.; Cai, K.; Feng, Y.; Tang, X.; Pang, H.; He, J.; Shi, X. An accurate detection model of Takifugu rubripes using an improved YOLO-V7 network. J. Mar. Sci. Eng. 2023, 11, 1051. [Google Scholar] [CrossRef]
  18. Wu, T.H.; Wang, T.W.; Liu, Y.Q. Real-time vehicle and distance detection based on improved YOLO v5 network. In Proceedings of the 2021 3rd World Symposium on Artificial Intelligence (WSAI), Guangzhou, China, 18–20 June 2021; pp. 24–28. [Google Scholar]
  19. Ma, L.; Zhao, L.; Wang, Z.; Zhang, J.; Chen, G. Detection and counting of small target apples under complicated environments by using improved YOLOv7-tiny. Agronomy 2023, 13, 1419. [Google Scholar] [CrossRef]
  20. Tîrziu, E.; Vasilevschi, A.-M.; Alexandru, A.; Tudora, E. Enhanced Fall Detection Using YOLOv7-W6-Pose for Real-Time Elderly Monitoring. Future Internet 2024, 16, 472. [Google Scholar] [CrossRef]
  21. Bochkovskiy, A.; Wang, C.Y.; Liao, H.Y.M. YOLOv4: Optimal speed and accuracy of object detection. arXiv 2020, arXiv:2004.10934. [Google Scholar]
  22. Sarıkaya, M.S.; Hamida El Naser, Y.; Kaçar, S.; Yazıcı, İ.; Derdiyok, A. Chaotic-Based Improved Henry Gas Solubility Optimization Algorithm: Application to Electric Motor Control. Symmetry 2024, 16, 1435. [Google Scholar] [CrossRef]
  23. Pant, M.; Zaheer, H.; Garcia-Hernandez, L.; Abraham, A. Differential Evolution: A review of more than two decades of research. Eng. Appl. Artif. Intell. 2020, 90, 103479. [Google Scholar]
  24. Liu, Z.; Sun, M.; Zhou, T.; Huang, G. Rethinking the value of network pruning. arXiv 2018, arXiv:1810.05270. [Google Scholar]
  25. Gou, J.; Yu, B.; Maybank, S.J.; Tao, D. Knowledge distillation: A survey. Int. J. Comput. Vis. 2021, 129, 1789–1819. [Google Scholar] [CrossRef]
  26. Buciluǎ, C.; Caruana, R.; Niculescu-Mizil, A. Model compression. In Proceedings of the 12th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, Philadelphia, PA, USA, 20–23 August 2006; pp. 535–541. [Google Scholar]
  27. Saxena, D.; Cao, J. Generative adversarial networks (GANs) challenges, solutions, and future directions. ACM Comput. Surv. (CSUR) 2021, 54, 1–42. [Google Scholar] [CrossRef]
  28. Wang, Y.; Bai, H.; Sun, L.; Tang, Y.; Huo, Y.; Min, R. The Rapid and Accurate Detection of Kidney Bean Seeds Based on a Compressed Yolov3 Model. Agriculture 2022, 12, 1202. [Google Scholar] [CrossRef]
  29. Hasler, M.; Maistrenko, Y.L. An introduction to the synchronization of chaotic systems: Coupled skew tent maps. IEEE Trans. Circuits Syst. Fundam. Theory Appl. 1997, 44, 856–866. [Google Scholar] [CrossRef]
  30. Tang, J.; Wang, L. A whale optimization algorithm based on atom-like structure differential evolution for solving engineering design problems. Sci. Rep. 2024, 14, 795. [Google Scholar] [CrossRef] [PubMed]
  31. Tang, J.; Wang, L. Sine Cosine Algorithm for Elite Individual Collaborative Search and Its Application in Mechanical Optimization Designs. Biomimetics 2023, 8, 576. [Google Scholar] [CrossRef] [PubMed]
  32. Rafikov, M.; Balthazar, J.M. On an optimal control design for Rössler system. Phys. Lett. A 2004, 333, 241–245. [Google Scholar] [CrossRef]
  33. Wang, J.; Zhou, B.; Zhou, S. An improved cuckoo search optimization algorithm for the problem of chaotic systems parameter estimation. Comput. Intell. Neurosci. 2016, 2016, 2959370. [Google Scholar] [CrossRef] [PubMed]
  34. Awrejcewicz, J.; Mrozowski, J. Bifurcations and chaos of a particular van der Pol-duffing oscillator. J. Sound Vib. 1989, 132, 89–100. [Google Scholar] [CrossRef]
  35. Lazzús, J.A.; Rivera, M.; López-Caraballo, C.H. Parameter estimation of Lorenz chaotic system using a hybrid swarm intelligence algorithm. Phys. Lett. A 2016, 380, 1164–1171. [Google Scholar] [CrossRef]
  36. Kocamaz, U.E.; Uyaroğlu, Y. Controlling Rucklidge chaotic system with a single controller using linear feedback and passive control methods. Nonlinear Dyn. 2014, 75, 63–72. [Google Scholar] [CrossRef]
  37. Mirjalili, S. SCA: A Sine Cosine Algorithm for solving optimization problems. Knowl.-Based Syst. 2016, 96, 120–133. [Google Scholar] [CrossRef]
  38. Mirjalili, S.; Lewis, A. The Whale Optimization Algorithm. Adv. Eng. Softw. 2016, 95, 51–67. [Google Scholar] [CrossRef]
  39. Kennedy, J.; Eberhart, R. Particle swarm optimization. In Proceedings of the ICNN’95—International Conference on Neural Networks, Perth, WA, Australia, 27 November–1 December 1995; Volume 4, pp. 1942–1948. [Google Scholar] [CrossRef]
  40. Tammina, S. Transfer learning using vgg-16 with deep convolutional neural network for classifying images. Int. J. Sci. Res. Publ. (IJSRP) 2019, 9, 143–150. [Google Scholar] [CrossRef]
  41. Koonce, B. ResNet 50. In Convolutional Neural Networks with Swift for Tensorflow: Image Recognition and Dataset Categorization; Springer: Cham, Switzerland, 2021; pp. 63–72. [Google Scholar]
  42. Nandhini, S.; Ashokkumar, K. An automatic plant leaf disease identification using DenseNet-121 architecture with a mutation-based henry gas solubility optimization algorithm. Neural Comput. Appl. 2022, 34, 5513–5534. [Google Scholar] [CrossRef]
  43. Dai, Q.; Guo, Y.; Li, Z.; Song, S.; Lyu, S.; Sun, D.; Wang, Y.; Chen, Z. Citrus disease image generation and classification based on improved FastGAN and EfficientNet-B5. Agronomy 2023, 13, 988. [Google Scholar] [CrossRef]
  44. Kavyashree, P.S.P.; El-Sharkawy, M. Compressed mobilenet v3: A light weight variant for resource-constrained platforms. In Proceedings of the 2021 IEEE 11th Annual Computing and Communication Workshop and Conference (CCWC), Online, 27–30 January 2021. [Google Scholar]
  45. Gu, Y.; Wang, Y.; Li, Z.; Zhang, T.; Li, Y.; Wang, G.; Cao, H. A fault diagnosis method of four-mass vibration MEMS gyroscope based on ResNeXt-50 with attention mechanism and improved EWT algorithm. Micromachines 2023, 14, 1287. [Google Scholar] [CrossRef] [PubMed]
Figure 1. Sample of lily-weed Image. (a) Lily. (b) Aotou amaranth. (c) Teloxys aristata. (d) Amaranthus revolexus. (e) Dysphania schraderiana. (f) Lactuca indica. (g) Convolvulus arvensis.
Figure 1. Sample of lily-weed Image. (a) Lily. (b) Aotou amaranth. (c) Teloxys aristata. (d) Amaranthus revolexus. (e) Dysphania schraderiana. (f) Lactuca indica. (g) Convolvulus arvensis.
Symmetry 17 00370 g001
Figure 2. YOLOv7 Network model structure diagram: (a) YOLOv7 Network Architecture Backbone Network. (b) The specific structure of each network module in YOLOv7.
Figure 2. YOLOv7 Network model structure diagram: (a) YOLOv7 Network Architecture Backbone Network. (b) The specific structure of each network module in YOLOv7.
Symmetry 17 00370 g002
Figure 3. Knowledge distillation diagram.
Figure 3. Knowledge distillation diagram.
Symmetry 17 00370 g003
Figure 4. Parameter optimization of YOLO v7-tiny model for CHHO.
Figure 4. Parameter optimization of YOLO v7-tiny model for CHHO.
Symmetry 17 00370 g004
Figure 5. Weed marking diagram.
Figure 5. Weed marking diagram.
Symmetry 17 00370 g005
Figure 6. Chaotic curve of the Tent system.
Figure 6. Chaotic curve of the Tent system.
Symmetry 17 00370 g006
Figure 7. Performance histogram.
Figure 7. Performance histogram.
Symmetry 17 00370 g007
Figure 8. Chaotic scatter plot.
Figure 8. Chaotic scatter plot.
Symmetry 17 00370 g008
Figure 9. Convergence curves of some unimodal, multimodal, and fixed dimensional functions. (a) Convergence curve of function F15. (b) Convergence curve of function F1. (c) Convergence curve of function F3. (d) Convergence curve of function F10. (e) Convergence curve of function F12. (f) Convergence curve of function F21.
Figure 9. Convergence curves of some unimodal, multimodal, and fixed dimensional functions. (a) Convergence curve of function F15. (b) Convergence curve of function F1. (c) Convergence curve of function F3. (d) Convergence curve of function F10. (e) Convergence curve of function F12. (f) Convergence curve of function F21.
Symmetry 17 00370 g009
Figure 10. Results of weed detection in lily fields under different shielding conditions. (a) Cover of lily by weeds. (b) Slight occlusion. (c) Complete occlusion.
Figure 10. Results of weed detection in lily fields under different shielding conditions. (a) Cover of lily by weeds. (b) Slight occlusion. (c) Complete occlusion.
Symmetry 17 00370 g010
Figure 11. Comparison of recognition accuracy of lightweight YOLOv7-tiny network model under different dataset sizes.
Figure 11. Comparison of recognition accuracy of lightweight YOLOv7-tiny network model under different dataset sizes.
Symmetry 17 00370 g011
Figure 12. Comparison diagram between improved model and original model. (a) YOLOv7-tiny. (b) Our model.
Figure 12. Comparison diagram between improved model and original model. (a) YOLOv7-tiny. (b) Our model.
Symmetry 17 00370 g012
Figure 13. (a) P and P-R change curves of the training process of the model are improved. (b) P and P-R change curves of the training process of the model are improved.
Figure 13. (a) P and P-R change curves of the training process of the model are improved. (b) P and P-R change curves of the training process of the model are improved.
Symmetry 17 00370 g013
Table 1. Comparison of Methods and Observed Gaps in Weed Detection.
Table 1. Comparison of Methods and Observed Gaps in Weed Detection.
ReferenceMethod UsedDatasetPerformance MetricsGaps Observed
R. Punithavathi [7]High computational complexity, not suitable for real-time detectionWeed datasetAccuracy: 98.33%High computational complexity, not suitable for real-time detection
Jiang et al. [8]CNN-based Graph Neural NetworkCorn, lettuce, radish weed datasetsAccuracy: 97.8%–99.37%Model size and computational overhead not optimized
Peng Mingxia [9]Residual CNN + Feature PyramidCotton field datasetAccuracy: 95.5%Limited generalization across different weed species
Andrea et al. [10]Optimized CNN for maize and weed classificationMaize datasetAccuracy: 97.26%No metaheuristic optimization applied
Hu et al. [11]Graph Convolutional Network (GNN)Weed dataset (8 species)Accuracy: 98.1%High computational cost, limited to specific weed types
Ahmad et al. [12]VGG16-based classificationMaize/soybean datasetAccuracy: 98.90%No real-time capability, high inference time
Ahmet Karaman et al. [13]YOLOv5 + Artificial Bee Colony (ABC) optimizationMedical polyp detection datasetImproved performance with ABC tuningNo lightweight adaptation, high parameter count
Ishak Pacal et al. [14]CSPNet-based YOLO optimizationGeneral object detection datasetImproved feature extraction with CSPNetLacks dataset-specific fine-tuning
Table 2. Details of Lily-Weed Dataset.
Table 2. Details of Lily-Weed Dataset.
TypeOriginal QuantityTraining SetValidation SetTesting Set
Lily22331786223224
Aotou Amaranth4273424342
Teloxys aristata4033224140
Amaranthus retroflexus4333464344
Dysphania schraderiana6605286666
Lactuca indica1070856107107
Convolvulus arvensis4403524444
Total56664532567567
Table 3. Updated Dataset Distribution.
Table 3. Updated Dataset Distribution.
TypeCurrent QuantityTraining SetValidation SetTesting Set
Lily22331786223224
Aotou Amaranth12811025128128
Teloxys aristata1209967121121
Amaranthus retroflexus12991039130130
Dysphania schraderiana13201056132132
Lactuca indica1070856107107
Convolvulus arvensis13201056132132
Total97327785973974
Table 4. Experimental parameters and configuration.
Table 4. Experimental parameters and configuration.
NameParameter
Operating SystemUbuntu 20.04
CPU12 vCPU Intel(R) Xeon(R) Platinum 8255C CPU @ 2.50 GHz
GPUNVIDIA GeForce GTX 3080
Video Memory80 GB
Deep Learning FrameworkPyTorch 1.11.0
Learning RateCHHO optimized
Batch SizeCHHO optimized
Epoch100
Loss FunctionCross Entropy Loss
Optimization AlgorithmSGD
Table 5. Benchmark functions used in the experiment.
Table 5. Benchmark functions used in the experiment.
TypeFunctionNameDimensionalitySearch SpaceTheoretical Optimal Value
UnimodalF1Sphere30[−100, 100]0
F3Schwefel 1.230[−100, 100]0
MultimodalF10Ackley30[−32, 32]0
F12Penalized130[−50, 50]0
Fixed-DimensionalF15Kowalk4[−5, 5]0.0003075
F21Sheke_54[0, 10]−10.1532
Table 6. Comparison of algorithms on different test functions.
Table 6. Comparison of algorithms on different test functions.
AlgorithmF1F3F10F12F15F21
Random 2.17 × 10 19 4.09 × 10 11 6.38 × 10 09 4.10 × 10 04 4.56 × 10 04 4.96 × 10 0
Chebyshev 1.47 × 10 18 1.27 × 10 10 8.15 × 10 09 5.50 × 10 04 3.36 × 10 04 4.96 × 10 0
Circle 2.46 × 10 16 3.32 × 10 07 2.36 × 10 10 1.18 × 10 04 4.02 × 10 04 2.56 × 10 0
Gauss 5.72 × 10 17 4.87 × 10 11 2.99 × 10 09 7.00 × 10 04 4.09 × 10 04 4.92 × 10 0
Iterative 3.16 × 10 17 3.12 × 10 09 2.54 × 10 09 1.68 × 10 03 5.59 × 10 04 4.91 × 10 0
Logistic 1.20 × 10 14 5.93 × 10 07 9.90 × 10 10 4.75 × 10 05 4.57 × 10 04 5.05 × 10 0
Piecewise 5.96 × 10 16 8.37 × 10 09 6.24 × 10 09 2.00 × 10 04 3.38 × 10 04 4.76 × 10 0
Sine 1.01 × 10 19 1.34 × 10 09 5.06 × 10 10 1.16 × 10 05 4.48 × 10 04 4.99 × 10 0
Singer 8.25 × 10 15 3.16 × 10 13 1.83 × 10 08 6.28 × 10 08 4.38 × 10 04 5.00 × 10 0
Sinusoidal 5.09 × 10 12 3.18 × 10 13 3.30 × 10 09 1.28 × 10 04 5.67 × 10 04 4.96 × 10 0
Kent 4.02 × 10 14 1.02 × 10 12 1.70 × 10 09 1.69 × 10 04 3.33 × 10 04 9.64 × 10 0
Fuch 2.38 × 10 14 3.22 × 10 09 1.77 × 10 09 2.89 × 10 04 1.41 × 10 03 5.01 × 10 0
SPM 4.33 × 10 15 7.43 × 10 08 1.10 × 10 07 3.62 × 10 05 4.32 × 10 04 5.04 × 10 0
ICMIC 2.48 × 10 16 1.90 × 10 10 1.09 × 10 09 3.00 × 10 04 5.63 × 10 04 5.04 × 10 0
Tent–Logistic–Cosine 3.07 × 10 17 6.64 × 10 14 4.18 × 10 09 3.67 × 10 04 3.59 × 10 04 4.85 × 10 0
Sine–Tent–Cosine 8.32 × 10 18 2.73 × 10 10 4.42 × 10 10 2.85 × 10 05 1.98 × 10 03 4.89 × 10 0
Logistic–Sine–Cosine 1.78 × 10 17 8.32 × 10 09 3.07 × 10 09 2.01 × 10 03 1.72 × 10 03 4.84 × 10 0
Henon 1.90 × 10 03 2.04 × 10 05 2.01 × 10 01 2.40 × 10 00 3.16 × 10 04 3.00 × 10 01
Cubic 1.42 × 10 18 4.30 × 10 08 5.98 × 10 10 1.53 × 10 04 4.68 × 10 04 4.94 × 10 0
Logistic–Tent 1.47 × 10 14 2.41 × 10 13 5.13 × 10 08 7.49 × 10 04 8.00 × 10 04 4.89 × 10 0
Bernoulli 1.03 × 10 15 2.84 × 10 12 1.30 × 10 09 4.58 × 10 04 3.17 × 10 04 5.02 × 10 0
Tent 1.14 × 10 21 3.55 × 10 17 1.12 × 10 10 5.52 × 10 06 3.17 × 10 04 5.03 × 10 0
Table 7. Comparison of optimized YOLO parameters using different optimization algorithms.
Table 7. Comparison of optimized YOLO parameters using different optimization algorithms.
ParameterCHHO (Proposed)HHOSCA [37]WOA [38]PSO [39]
Activation FunctionSwishLeakyReLUReLULeakyReLUReLU
Momentum0.9370.900.920.910.89
Weight Decay0.00010.00040.00320.00020.0004
Batch Size6432241632
Learning Rate0.0120.010.0080.0090.01
Scale1.00250.99980.99950.99920.9997
Flip Probability0.550.500.480.490.50
Table 8. Performance evaluation of different models for weed and lily classification.
Table 8. Performance evaluation of different models for weed and lily classification.
Evaluation MetricModelWeedLilyAverage Value
PrecisionVGG-160.70080.68220.6915
ResNet-500.71430.81950.7669
DenseNet-1210.77060.87380.8222
EfficientNet-B50.83190.84720.83955
MobileNet-V30.71300.85970.78635
ResNeXt-500.80310.78380.79345
YOLOv70.87120.82570.84845
TPRVGG-160.69530.80360.74945
ResNet-500.71880.82140.7701
DenseNet-1210.75000.83480.7924
EfficientNet-B50.73440.81700.7757
MobileNet-V30.78130.84820.81475
ResNeXt-500.79690.85710.827
YOLOv70.87690.86360.87025
F1_scoreVGG-160.69800.72660.7123
ResNet-500.72390.79070.7573
DenseNet-1210.70750.77780.74265
EfficientNet-B50.84620.79650.82135
MobileNet-V30.81310.84730.8302
ResNeXt-500.80000.75530.77765
YOLOv70.86150.89490.8782
Table 9. Model performance comparison based on parameter quantity and accuracy.
Table 9. Model performance comparison based on parameter quantity and accuracy.
ModelParameter QuantityAccuracyGFLOPsms–FPS
YOLOv736.9 M72.16%105.78.9 ms (112 FPS)
YOLOv7-X71.3 M80.97%189.915.8 ms (63 FPS)
YOLOv7-tiny16.2 M85.83%4.52.1 ms (476 FPS)
YOLOv7-E697.2 M83.00%303.321.9 ms (46 FPS)
YOLOv7-D6154.7 M82.58%453.231.2 ms (32 FPS)
YOLOv7-E6E151.7 M83.37%375.628.7 ms (35 FPS)
YOLOv7-tiny’10.7 M92.53%3.21.8 ms (555 FPS)
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.

Share and Cite

MDPI and ACS Style

Tang, J.; Wang, H.; Zhao, M.; Sun, P.; Hao, Y.; Zhu, Z. Weed Detection in Lily Fields Using YOLOv7 Optimized by Chaotic Harris Hawks Algorithm for Underground Resource Competition. Symmetry 2025, 17, 370. https://doi.org/10.3390/sym17030370

AMA Style

Tang J, Wang H, Zhao M, Sun P, Hao Y, Zhu Z. Weed Detection in Lily Fields Using YOLOv7 Optimized by Chaotic Harris Hawks Algorithm for Underground Resource Competition. Symmetry. 2025; 17(3):370. https://doi.org/10.3390/sym17030370

Chicago/Turabian Style

Tang, Junjie, Huafei Wang, Mingyue Zhao, Ping Sun, Yutao Hao, and Zhiyuan Zhu. 2025. "Weed Detection in Lily Fields Using YOLOv7 Optimized by Chaotic Harris Hawks Algorithm for Underground Resource Competition" Symmetry 17, no. 3: 370. https://doi.org/10.3390/sym17030370

APA Style

Tang, J., Wang, H., Zhao, M., Sun, P., Hao, Y., & Zhu, Z. (2025). Weed Detection in Lily Fields Using YOLOv7 Optimized by Chaotic Harris Hawks Algorithm for Underground Resource Competition. Symmetry, 17(3), 370. https://doi.org/10.3390/sym17030370

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop