A moth recognition method based on lightweight yolov8 and transfer learning and a corresponding device
By using a lightweight Yolov8 model and transfer learning techniques, combined with deep separable convolution and dynamic data augmentation, the problems of low efficiency and poor environmental adaptability in tobacco pest identification were solved, and real-time accurate identification on the tobacco production line was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HEBEI BAISHA TOBACCO
- Filing Date
- 2025-12-29
- Publication Date
- 2026-05-29
AI Technical Summary
Traditional tobacco pest identification relies on manual inspection, which is inefficient and labor-intensive. Existing deep learning models have poor adaptability to the dynamic environment of tobacco production lines, and their large model parameters and computational load result in low identification accuracy and difficulty in meeting real-time detection requirements.
A lightweight Yolov8 model is adopted, combined with transfer learning and dynamic data augmentation strategies. The model is constructed through deep separable convolution, feature pyramid network and channel attention mechanism, and knowledge transfer and domain adaptive fine-tuning are performed. Kalman filtering is used to adjust the detection threshold to achieve real-time identification of tobacco pests.
It enables real-time and accurate identification of tobacco pests on the tobacco production line, improves the model's lightweight design and dynamic environmental adaptability, and enhances identification efficiency and accuracy.
Smart Images

Figure CN122116078A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of tobacco production technology, specifically to the technical fields of automated detection and computer vision, and particularly to a tobacco insect identification method and corresponding device based on lightweight Yolov8 and transfer learning. Background Technology
[0002] Tobacco pests are a key factor affecting tobacco yield and quality. Traditional tobacco pest identification relies on manual inspection, which has drawbacks such as low efficiency, high labor intensity, and great influence from subjective factors, making it difficult to meet the real-time detection needs of modern tobacco production lines.
[0003] While existing deep learning-based pest identification technologies (such as the YOLO series algorithms) can improve identification accuracy, they have the following significant shortcomings when applied to tobacco production lines: poor adaptability to dynamic environments, large model parameters and computational load, weak generalization ability due to data scarcity, and domain differences affecting detection performance.
[0004] Therefore, there is an urgent need for a tobacco pest identification solution that combines lightweight design, high robustness, and high accuracy to address the core pain points of dynamic environmental interference and model deployment limitations on the production line. Summary of the Invention
[0005] This application provides a tobacco insect identification method and corresponding device based on lightweight Yolov8 and transfer learning to solve the problems of low efficiency, interference from dynamic environment in production line and limitations in model deployment in traditional tobacco insect identification.
[0006] The technical solution is as follows: Firstly, a method for identifying tobacco insects based on lightweight Yolov8 and transfer learning is provided, including: Tobacco images under different working conditions on the production line were captured using industrial cameras. After data preprocessing and annotation, training and testing sets were constructed. We employ depthwise separable convolutions to reconstruct the feature pyramid network and integrate a channel attention mechanism. Channel importance is evaluated based on the batch normalization layer scale factor to construct a lightweight Yolov8 model. The lightweight Yolov8 model is loaded with COCO pre-trained weights, and knowledge transfer and domain adaptive fine-tuning are performed in conjunction with the training set. A dynamic data augmentation strategy is adopted to trigger multi-scale training. The detection threshold is dynamically adjusted through Kalman filtering to repeatedly train and obtain the tobacco insect recognition model. Acquire an image of tobacco to be identified, input it into the tobacco insect identification model, and output the tobacco insect identification result, which includes the tobacco insect category and the tobacco insect location.
[0007] In one possible implementation, depthwise separable convolutions are employed to reconstruct the feature pyramid network and integrate a channel attention mechanism. Channel importance is evaluated based on the batch normalization layer scale factor to construct a lightweight Yolov8 model, specifically including: We replace standard convolutions with depthwise separable convolutions, introduce the GhostBottleneck feature extraction module, reconstruct the feature pyramid network, and integrate a channel attention mechanism to optimize the network structure. Based on the batch normalization layer scale factor to evaluate channel importance, a lightweight Yolov8 model is constructed by regularizing the structured pruning to compress the model.
[0008] In one possible implementation, COCO pre-trained weights are loaded into the lightweight Yolov8 model, and knowledge transfer and domain-adaptive fine-tuning are performed using the training set, specifically including: In the lightweight Yolov8 model, COCO pre-trained weights are loaded, and the shallow network parameters are frozen to enable knowledge transfer. A stepwise unfreezing method is used to release deep parameters, and a dual-branch domain adaptation module and MMD loss are introduced, combined with a cosine annealing learning rate, to perform domain adaptive fine-tuning.
[0009] In one possible implementation, during domain adaptive fine-tuning, the feature distributions of the COCO source domain and the tobacco worm target domain are aligned, the MMD loss metric is used, and the difference between the COCO source domain and the tobacco worm target domain is reduced.
[0010] In one possible implementation, the dynamic data augmentation strategy includes at least some or all of the following: illumination jitter, motion blur, random occlusion, HSV color perturbation, and random erasure.
[0011] In one possible implementation, during data preprocessing, a sliding window is used for cropping with a step size of 512, resulting in a cropped image size of 640×640. The annotation types include complete worm body, partial worm body, and worm egg.
[0012] Secondly, a tobacco insect identification device based on lightweight Yolov8 and transfer learning is provided, comprising: The acquisition module is used to acquire tobacco images under different working conditions on the production line using an industrial camera. After data preprocessing and labeling, training and test sets are constructed. The building blocks are used to reconstruct the feature pyramid network using depthwise separable convolutions and integrate a channel attention mechanism. Channel importance is evaluated based on the batch normalization layer scale factor to build a lightweight Yolov8 model. The transfer module is used to load COCO pre-trained weights into the lightweight Yolov8 model and perform knowledge transfer and domain adaptive fine-tuning in combination with the training set. The training module is used to trigger multi-scale training by employing dynamic data augmentation strategies and dynamically adjusting the detection threshold through Kalman filtering to repeatedly train and obtain the tobacco insect recognition model. The identification module is used to acquire an image of tobacco to be identified, input the tobacco insect identification model, and output the tobacco insect identification result, which includes the tobacco insect category and the tobacco insect location.
[0013] Thirdly, an electronic device is provided, comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the methods described above and any possible implementations.
[0014] Fourthly, a computer-readable storage medium is provided, wherein at least one instruction is stored therein, the at least one instruction being loaded and executed by a processor to implement the aspects described above and any possible implementation thereof.
[0015] Fifthly, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the aspects and any possible implementations described above.
[0016] The beneficial effects of the technical solution provided in this application include at least the following: As can be seen from the above technical solution, the embodiments of this application construct a training set and a test set, employ depthwise separable convolution, reconstruct a feature pyramid network and integrate a channel attention mechanism, and evaluate channel importance based on batch normalization layer scale factors to construct a lightweight Yolov8 model; load COCO pre-trained weights into the lightweight Yolov8 model, and perform knowledge transfer and domain adaptive fine-tuning in conjunction with the training set; adopt a dynamic data augmentation strategy to trigger multi-scale training, and dynamically adjust the detection threshold through Kalman filtering to repeatedly train and obtain the tobacco insect recognition model; acquire the tobacco image to be identified, input it into the tobacco insect recognition model, and output the tobacco insect recognition result. This application achieves real-time and accurate identification of tobacco insects in tobacco production lines through lightweight model design, transfer learning, and dynamic environmental adaptation techniques.
[0017] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a schematic diagram illustrating the steps of a tobacco insect identification method based on lightweight Yolov8 and transfer learning provided in an embodiment of this application.
[0020] Figure 2 This is a schematic diagram illustrating the method steps for constructing a lightweight Yolov8 model according to another embodiment of this application.
[0021] Figure 3 This is a schematic diagram of the steps of a knowledge transfer and domain adaptive fine-tuning method provided in one embodiment of this application.
[0022] Figure 4 This is a structural block diagram of a tobacco insect identification device based on lightweight Yolov8 and transfer learning provided in one embodiment of this application.
[0023] Figure 5 This is a block diagram of the electronic device provided in the embodiments of this application. Detailed Implementation
[0024] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of this application, including various details to aid understanding. These embodiments should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0025] Obviously, the described embodiments are only some, not all, of the embodiments in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.
[0026] It should be noted that the terminal devices involved in the embodiments of this application may include, but are not limited to, smart devices such as mobile phones, personal digital assistants (PDAs), wireless handheld devices, and tablet computers; the display devices may include, but are not limited to, personal computers, televisions, and other devices with display functions.
[0027] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0028] To address the issues of low efficiency, interference from the dynamic environment of the production line, and limitations in model deployment inherent in traditional tobacco insect identification methods, this application proposes a tobacco insect identification scheme based on lightweight Yolov8 and transfer learning. The main inventive concept involves: constructing training and testing sets; reconstructing a feature pyramid network using depthwise separable convolutions and integrating a channel attention mechanism; evaluating channel importance based on batch normalization layer scale factors to construct a lightweight Yolov8 model; loading COCO pre-trained weights into the lightweight Yolov8 model; combining the training set for knowledge transfer and domain-adaptive fine-tuning; employing dynamic data augmentation strategies to trigger multi-scale training; dynamically adjusting the detection threshold using Kalman filtering to repeatedly train and obtain the tobacco insect identification model; acquiring tobacco images to be identified; inputting the tobacco insect identification model; and outputting the tobacco insect identification result. This application achieves real-time and accurate identification of tobacco insects in tobacco production lines through lightweight model design, transfer learning, and dynamic environment adaptation techniques.
[0029] Reference Figure 1 The diagram illustrates the steps of a tobacco beetle identification method based on lightweight Yolov8 and transfer learning, as provided in an embodiment of this application. The tobacco beetle identification method may include the following steps: Step 102: Collect tobacco images under different working conditions on the production line using an industrial camera. After data preprocessing and labeling, construct training and testing sets.
[0030] Optionally, during data preprocessing, the step size of the sliding window cropping is 512, the cropped image size is 640×640, and the annotation types include complete worm body, partial worm body, and worm egg.
[0031] Step 104: Use depthwise separable convolution to reconstruct the feature pyramid network and integrate the channel attention mechanism. Evaluate the channel importance based on the batch normalization layer scale factor to construct a lightweight Yolov8 model.
[0032] Optionally, refer to Figure 2 As shown, step 104, when constructing a lightweight Yolov8 model by employing depthwise separable convolutions, reconstructing the feature pyramid network, integrating a channel attention mechanism, and evaluating channel importance based on the batch normalization layer scale factor, may specifically include: Step 202: Replace the standard convolution with depthwise separable convolution, introduce the GhostBottleneck feature extraction module, reconstruct the feature pyramid network and integrate the channel attention mechanism to optimize the network structure.
[0033] Specifically, depthwise separable convolution is used to replace standard convolution, which reduces parameter redundancy while maintaining feature extraction capabilities; the GhostBottleneck lightweight feature extraction module is designed to generate redundant feature maps through simple linear transformation, reducing backbone network parameters by 42%; the feature pyramid network is reconstructed and a channel attention mechanism is introduced to enhance the fusion and screening of multi-scale pest features.
[0034] Step 204: Evaluate channel importance based on batch normalization layer scale factor, and compress the model through regularization constraint structured pruning to construct a lightweight Yolov8 model.
[0035] Specifically, channel importance can be evaluated based on the BN layer scale factor, and 35% of redundant channels can be iteratively removed using L1 regularization constraints while retaining key feature extraction capabilities. Hybrid precision quantization: The feature extraction layer uses INT8 quantization to reduce storage and computational overhead, while the classification and regression layer retains FP16 precision to ensure recognition accuracy. After deployment with TensorRT, the inference speed is improved by 2.3 times.
[0036] Step 106: Load COCO pre-trained weights into the lightweight Yolov8 model and perform knowledge transfer and domain adaptive fine-tuning in conjunction with the training set.
[0037] Optionally, refer to Figure 3 As shown, step 106, when loading COCO pre-trained weights into the lightweight Yolov8 model and performing knowledge transfer and domain adaptive fine-tuning in conjunction with the training set, may specifically include: Step 302: Load COCO pre-trained weights into the lightweight Yolov8 model and freeze the shallow network parameters to perform knowledge transfer.
[0038] Specifically, pre-trained weights from the COCO dataset can be loaded into the lightweight Yolov8 model to freeze the parameters of shallow networks, thus preserving the model's ability to detect general targets and avoiding overfitting caused by training from scratch.
[0039] Step 304: Use the stepwise unfreezing method to release deep parameters, introduce a dual-branch domain adaptation module and MMD loss, and combine it with the cosine annealing learning rate to perform domain adaptive fine-tuning.
[0040] Specifically, parameters are gradually released starting from the deep network to enable the model to adapt to the characteristics of tobacco pests; a dual-branch domain adaptation module is introduced: feature branches from the source domain (COCO) and the target domain (tobacco pests) are introduced, and the difference in distribution between the two domains is measured and minimized through MMD loss; an SGD optimizer (momentum 0.937, weight decay 0.0005) and a cosine annealing learning rate (initial 0.001) are used, combined with an early stopping mechanism to prevent overfitting and improve the model's generalization ability.
[0041] In this application, when performing domain adaptive fine-tuning, the feature distributions of the COCO source domain and the tobacco worm target domain are aligned, and the MMD loss metric is used to reduce the difference between the COCO source domain and the tobacco worm target domain.
[0042] Step 108: Employ a dynamic data augmentation strategy to trigger multi-scale training. Use Kalman filtering to dynamically adjust the detection threshold and repeatedly train to obtain the tobacco insect recognition model.
[0043] In this application, the dynamic data augmentation strategy includes at least some or all of the following: illumination jitter, motion blur, random occlusion, HSV color perturbation, and random erasure.
[0044] Specifically, an enhancement strategy library is constructed to simulate scenarios such as illumination jitter (brightness ±30%), motion blur (maximum kernel size 15×15), and random occlusion (maximum occlusion rate 40%), thereby improving the diversity of training samples. Multi-scale training: Input sizes are randomly switched between 640×640 and 1280×1280 to enhance the model's ability to identify pests of different sizes. Online adaptive adjustment: A lightweight online adaptive module is deployed to dynamically adjust the detection threshold through Kalman filtering, adapting to environmental changes in real time and ensuring detection stability.
[0045] Step 110: Obtain the tobacco image to be identified, input the tobacco insect identification model, and output the tobacco insect identification result, which includes: tobacco insect category and tobacco insect location.
[0046] The following example uses three tobacco production lines to illustrate tobacco insect identification.
[0047] First, data collection was conducted: 12,850 raw images were collected from three tobacco production lines, covering normal operating conditions (7,710 images), strong light interference (2,570 images), dust obstruction (1,928 images), and vibration blur (642 images).
[0048] Preprocessing: Sliding window cropping: step size 512, cropped to 640×640 sub-images, resulting in 41,820 images. Labeling: LabelImg tool was used to label three types of targets (5,824 complete worms, 3,157 partial worms, and 1,092 worm eggs). Splitting: Images were split into a training set (39,729 images) and a test set (2,091 images) at a 95:5 ratio. The actual effective samples were 37,200 images in the training set and 3,100 images in the test set. Data augmentation: Random mosaic (probability 0.5), HSV color perturbation (±15%), motion blur (kernel size 7×7), and random erasure (maximum area 30%) were applied to the training set.
[0049] Lightweight model parameters: Backbone network: GhostBottleneck×6, depthwise separable convolutional kernels 3×3. Feature fusion: PANet structure + channel attention mechanism. Pruning rate 35%, quantization accuracy INT8 (feature extraction) / FP16 (classification and regression).
[0050] Training parameters: Input size 640×640, batch size 32, training epochs 300. Optimizer: SGD (momentum 0.937, weight decay 0.0005). Learning rate: Initial 0.001, decaying to 0.001 with cosine annealing. Loss function: Classification loss (Focal Loss) + Regression loss (CIoU Loss) + MMD domain difference loss.
[0051] Transfer learning process: Phase 1 (rounds 1-50): Freeze the first 8 layers of the network and train only the classification and regression heads. Phase 2 (rounds 51-200): Unfreeze the last 4 layers of the network and train them jointly. Phase 3 (rounds 201-300): Unfreeze the entire network and fine-tune all parameters.
[0052] Tobacco bug identification process: Input the image to be identified into the trained identification model, and the model will output the tobacco bug type and location.
[0053] This application constructs a training and testing set, employs depthwise separable convolution, reconstructs a feature pyramid network, and integrates a channel attention mechanism. Channel importance is evaluated based on batch normalization layer scale factors to build a lightweight Yolov8 model. COCO pre-trained weights are loaded into the lightweight Yolov8 model, and knowledge transfer and domain-adaptive fine-tuning are performed using the training set. A dynamic data augmentation strategy is employed to trigger multi-scale training, and the detection threshold is dynamically adjusted using Kalman filtering to repeatedly train and obtain the tobacco insect recognition model. An image of the tobacco to be identified is acquired, input into the tobacco insect recognition model, and the tobacco insect recognition result is output. This application achieves real-time and accurate identification of tobacco insects in tobacco production lines through lightweight model design, transfer learning, and dynamic environmental adaptation techniques.
[0054] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0055] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0056] Figure 4 This paper illustrates a structural block diagram of a tobacco insect identification device based on lightweight Yolov8 and transfer learning, according to an embodiment of this application. Figure 4As shown. The tobacco insect identification device 400 based on lightweight Yolov8 and transfer learning in this embodiment may include a data acquisition module 401, a construction module 402, a transfer learning module 403, a training module 404, and an identification module 405. The system comprises the following modules: Acquisition module 401, which acquires tobacco images under different working conditions on the production line using an industrial camera, and constructs training and testing sets after data preprocessing and annotation; Construction module 402, which uses depthwise separable convolution to reconstruct a feature pyramid network and integrates a channel attention mechanism, and evaluates channel importance based on batch normalization layer scale factors to construct a lightweight Yolov8 model; Transfer module 403, which loads COCO pre-trained weights into the lightweight Yolov8 model and performs knowledge transfer and domain adaptive fine-tuning in conjunction with the training set; Training module 404, which uses a dynamic data augmentation strategy to trigger multi-scale training, dynamically adjusts the detection threshold through Kalman filtering, and repeatedly trains to obtain a tobacco insect recognition model; and Recognition module 405, which acquires tobacco images to be recognized, inputs them into the tobacco insect recognition model, and outputs tobacco insect recognition results, including tobacco insect category and tobacco insect location.
[0057] Optionally, in one possible implementation of this embodiment, when the construction module 402 constructs a lightweight Yolov8 model by employing depthwise separable convolution, reconstructing the feature pyramid network and integrating a channel attention mechanism, and evaluating channel importance based on batch normalized layer scale factors, it specifically replaces standard convolution with depthwise separable convolution, introduces the GhostBottleneck feature extraction module, reconstructs the feature pyramid network and integrates a channel attention mechanism to optimize the network structure; evaluates channel importance based on batch normalized layer scale factors, and compresses the model through regularized constraint structured pruning to construct a lightweight Yolov8 model.
[0058] Optionally, in one possible implementation of this embodiment, when the transfer module 403 loads COCO pre-trained weights into the lightweight Yolov8 model and performs knowledge transfer and domain adaptive fine-tuning in conjunction with the training set, it is specifically used to load COCO pre-trained weights into the lightweight Yolov8 model, freeze shallow network parameters for knowledge transfer, release deep parameters using a stepwise unfreezing method, introduce a dual-branch domain adaptation module and MMD loss, and combine it with a cosine annealing learning rate for domain adaptive fine-tuning.
[0059] Optionally, in one possible implementation of this embodiment, when performing domain adaptive fine-tuning, the migration module 403 aligns the feature distributions of the COCO source domain and the tobacco worm target domain, uses MMD loss metric, and reduces the difference between the COCO source domain and the tobacco worm target domain.
[0060] Optionally, in one possible implementation of this embodiment, the dynamic data augmentation strategy includes at least some or all of the following: illumination jitter, motion blur, random occlusion, HSV color perturbation, and random erasure.
[0061] Optionally, in one possible implementation of this embodiment, when the acquisition module 401 performs data preprocessing, the step size of the sliding window cropping is 512, the size of the cropped image is 640×640, and the annotation types include complete worm body, partial worm body, and worm egg.
[0062] In this embodiment, a lightweight Yolov8 model can be constructed by building training and testing sets, employing depthwise separable convolution, reconstructing the feature pyramid network, and integrating a channel attention mechanism. Channel importance is evaluated based on batch normalization layer scale factors. COCO pre-trained weights are loaded into the lightweight Yolov8 model, and knowledge transfer and domain-adaptive fine-tuning are performed using the training set. A dynamic data augmentation strategy is employed to trigger multi-scale training, and the detection threshold is dynamically adjusted using Kalman filtering to repeatedly train and obtain the tobacco insect recognition model. An image of the tobacco to be identified is acquired, input into the tobacco insect recognition model, and the tobacco insect recognition result is output. This application achieves real-time and accurate identification of tobacco insects in tobacco production lines through lightweight model design, transfer learning, and dynamic environmental adaptation techniques.
[0063] One embodiment of this application provides a computer-readable storage medium storing at least one instruction, which is loaded and executed by a processor to implement the tobacco insect identification method based on lightweight Yolov8 and transfer learning as described above.
[0064] One embodiment of this application provides an electronic device, which includes a processor and a memory. The memory stores at least one instruction, which is loaded and executed by the processor to implement the tobacco insect identification method based on lightweight Yolov8 and transfer learning as described above.
[0065] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0066] Figure 5A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of this application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.
[0067] like Figure 5 As shown, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. The RAM 503 may also store various programs and data required for the operation of the electronic device 500. The computing unit 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0068] Multiple components in electronic device 500 are connected to I / O interface 505, including: input unit 506, such as keyboard, mouse, etc.; output unit 507, such as various types of monitors, speakers, etc.; storage unit 508, such as disk, optical disk, etc.; and communication unit 509, such as network card, modem, wireless transceiver, etc. Communication unit 509 allows electronic device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0069] The computing unit 501 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as the tobacco beetle identification method based on lightweight YOLOv8 and transfer learning. For example, in some embodiments, the tobacco beetle identification method based on lightweight YOLOv8 and transfer learning can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the tobacco beetle identification method based on lightweight YOLOv8 and transfer learning described above can be performed. Alternatively, in other embodiments, computing unit 501 may be configured by any other suitable means (e.g., by means of firmware) to perform a tobacco insect identification method based on lightweight Yolov8 and transfer learning.
[0070] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transferring data and instructions to the storage system, at least one input device, and at least one output device.
[0071] The program code used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0072] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0073] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0074] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0075] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0076] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.
[0077] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A tobacco insect identification method based on lightweight Yolov8 and transfer learning, characterized in that, include: Tobacco images under different working conditions on the production line were captured using industrial cameras. After data preprocessing and annotation, training and testing sets were constructed. We employ depthwise separable convolutions to reconstruct the feature pyramid network and integrate a channel attention mechanism. Channel importance is evaluated based on the batch normalization layer scale factor to construct a lightweight Yolov8 model. The lightweight Yolov8 model is loaded with COCO pre-trained weights, and knowledge transfer and domain adaptive fine-tuning are performed in conjunction with the training set. A dynamic data augmentation strategy is adopted to trigger multi-scale training. The detection threshold is dynamically adjusted through Kalman filtering to repeatedly train and obtain the tobacco insect recognition model. Acquire an image of tobacco to be identified, input it into the tobacco insect identification model, and output the tobacco insect identification result, which includes the tobacco insect category and the tobacco insect location.
2. The method as described in claim 1, characterized in that, A lightweight Yolov8 model is constructed by reconstructing the feature pyramid network using depthwise separable convolutions and integrating a channel attention mechanism. Channel importance is evaluated based on the batch normalization layer scale factor. Specifically, the model includes: We replace standard convolutions with depthwise separable convolutions, introduce the GhostBottleneck feature extraction module, reconstruct the feature pyramid network, and integrate a channel attention mechanism to optimize the network structure. Based on the batch normalization layer scale factor to evaluate channel importance, a lightweight Yolov8 model is constructed by regularizing the structured pruning to compress the model.
3. The method as described in claim 1, characterized in that, Loading COCO pre-trained weights into the lightweight Yolov8 model, and performing knowledge transfer and domain-adaptive fine-tuning using the training set, specifically includes: In the lightweight Yolov8 model, COCO pre-trained weights are loaded, and the shallow network parameters are frozen to enable knowledge transfer. A stepwise unfreezing method is used to release deep parameters, and a dual-branch domain adaptation module and MMD loss are introduced, combined with a cosine annealing learning rate, to perform domain adaptive fine-tuning.
4. The method as described in claim 3, characterized in that, When performing domain-adaptive fine-tuning, the feature distributions of the COCO source domain and the tobacco worm target domain are aligned, and the MMD loss metric is used to reduce the difference between the COCO source domain and the tobacco worm target domain.
5. The method according to any one of claims 1-4, characterized in that, The dynamic data augmentation strategy includes at least some or all of the following: illumination jitter, motion blur, random occlusion, HSV color perturbation, and random erasure.
6. The method according to any one of claims 1-4, characterized in that, When performing data preprocessing, the step size of the sliding window cropping was 512, and the size of the cropped image was 640×640. The annotation types included complete worm body, partial worm body, and worm egg.
7. A tobacco insect identification device based on lightweight Yolov8 and transfer learning, characterized in that, include: The acquisition module is used to acquire tobacco images under different working conditions on the production line using an industrial camera. After data preprocessing and labeling, training and test sets are constructed. The building blocks are used to reconstruct the feature pyramid network using depthwise separable convolutions and integrate a channel attention mechanism. Channel importance is evaluated based on the batch normalization layer scale factor to build a lightweight Yolov8 model. The transfer module is used to load COCO pre-trained weights into the lightweight Yolov8 model and perform knowledge transfer and domain adaptive fine-tuning in combination with the training set. The training module is used to trigger multi-scale training by employing dynamic data augmentation strategies and dynamically adjusting the detection threshold through Kalman filtering to repeatedly train and obtain the tobacco insect recognition model. The identification module is used to acquire an image of tobacco to be identified, input the tobacco insect identification model, and output the tobacco insect identification result, which includes the tobacco insect category and the tobacco insect location.
8. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1-6.
9. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-6.
10. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-6.