Fish recognition method, system, computer device and storage medium
By constructing a TbGhostNet network and optimizing feature extraction using residual structure and attention mechanism, the problem of blind feature selection in existing fish identification systems is solved, the recognition accuracy and efficiency are improved, and higher recognition precision is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SOUTH CHINA AGRICULTURAL UNIVERSITY
- Filing Date
- 2023-01-17
- Publication Date
- 2026-05-19
AI Technical Summary
Existing fish identification systems rely on manually set features, which leads to a high degree of blindness in feature selection and a lack of transferability, affecting the accuracy and efficiency of identification.
A TbGhostNet network is constructed by adding residual networks, including residual structures block1 and block2, to the block layers of the GhostNet network. The attention mechanism is used to extract fish image features, and normalization processing is added before the downsampling layer. Combined with the label smoothing loss function and learning rate adjustment, feature extraction and model training are optimized.
It improved the accuracy of fish identification from 83.9% in GhostNet to 86.0%, enhanced the stability and generalization ability of the model, and improved the representativeness of feature extraction and recognition efficiency.
Smart Images

Figure CN116092005B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, and in particular to a method, system, computer device, and storage medium for fish identification. Background Technology
[0002] The ocean possesses abundant chemical, mineral, biological, and energy resources, among which biological resources are also known as aquatic resources. According to biologists, over 20,000 species of fish are known globally. Undeniably, fish play a vital role in modern human life. Besides their edible value, some brightly colored or uniquely shaped fish have high ornamental value. Furthermore, fish possess certain medicinal and therapeutic properties. However, even the ocean, with its abundant resources, will eventually run dry if it is not adequately protected and respected. In recent years, marine fishery resources have been declining year by year, and the ecological balance is being disrupted, hindering the sustainable development of the marine economy. In response, many coastal nations are increasingly emphasizing the management and protection of their marine fish resources.
[0003] Fisheries departments collect and analyze information such as fishing time, catch volume, number of fishing vessels, and location to provide reliable data analysis and basis for formulating reasonable management systems. This requires staff to carefully review large amounts of video surveillance data and meticulously identify the types of fish. However, this process is susceptible to factors such as visual fatigue, carelessness, and lack of experience, which can lead to decreased data accuracy. Therefore, designing an efficient system for classifying fish image data is urgently needed. Traditional fish identification systems require manually setting features and then training a classifier based on those features. However, this method has shortcomings: firstly, feature selection is highly arbitrary and may even miss important features; secondly, the features set are often only applicable to specific scenarios and lack transferability. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a fish identification method, system, computer device, and storage medium. This method constructs a TbGhostNet network based on the GhostNet network. The block layers in the TbGhostNet network are built upon the block layers of the GhostNet network with the addition of residual networks. The residual network includes two residual structures, block1 and block2. Residual structure block1 is used to extract shallow features from fish images and extracts key features from the fish images through an attention mechanism. Residual structure block2 is used to extract higher-level features from the key features. By constructing the TbGhostNet network, this invention extracts representative features from fish images, thereby improving classification accuracy.
[0005] The first objective of this invention is to provide a method for identifying fish.
[0006] The second objective of this invention is to provide a fish identification system.
[0007] A third objective of this invention is to provide a computer device.
[0008] A fourth objective of this invention is to provide a storage medium.
[0009] The first objective of this invention can be achieved by adopting the following technical solution:
[0010] A method for identifying fish, the method comprising:
[0011] Obtain a fish classification dataset; the classification dataset includes images of various fish species;
[0012] The TbGhostNet network is constructed based on the GhostNet network. The block layer in the TbGhostNet network is based on the original block layer structure of the GhostNet network with the addition of a residual network. The residual network includes residual structures block1 and block2. Residual structure block1 is used to extract shallow features of fish images and extract key features in fish images through an attention mechanism. Residual structure block2 is used to extract higher-level features from the features extracted by residual structure block1.
[0013] The TbGhostNet network is trained using the aforementioned classification dataset;
[0014] Obtain the fish images to be classified, preprocess the fish images, and then input them into the trained TbGhostNet network to output the types of fish.
[0015] Furthermore, the residual structure block1 includes GhostModel, BatchNorm, depthwise hierarchical convolution, SE attention mechanism, and Droppath, wherein;
[0016] The deep hierarchical convolution is used to achieve better network model performance while reducing the number of parameters;
[0017] The SE attention mechanism is used to assign different weights to each feature map, thereby obtaining channel features with high network attention and suppressing channel features with low information content. The implementation steps include: first, compressing the two-dimensional feature information of all channels into a single real number through global average pooling to obtain the global feature information of the channels; then, constructing the correlation between channels through fully connected layers, the GELU activation function, and the hard_sigmoid activation function to learn the relationship between different channels and obtain the weights of each channel; finally, weighting the obtained weights onto the features of each channel.
[0018] The Droppath is used to randomly deactivate the branches of the residual structure block1 and uses progressively increasing parameters to improve the recognition accuracy of the TbGhostNet network.
[0019] Furthermore, the residual structure block2 includes GhostModel and Droppath, wherein the activation function GELU is employed.
[0020] Furthermore, the TbGhostNet network uses a separate downsampling layer before the block layer and adds normalization processing before the downsampling layer;
[0021] The downsampling layer regularizes the input feature map using LayerNorm before performing a convolution operation; the number of channels remains constant during the downsampling process.
[0022] Furthermore, the loss function in the TbGhostNet network adopts the label smoothing loss function. The formula is as follows:
[0023]
[0024] in, The smoothed distribution of the sample. For probability distribution, This is a hyperparameter.
[0025] Furthermore, when training the TbGhostNet network, warm-up and cosine annealing are used to adjust the learning rate.
[0026] Furthermore, before training the TbGhostNet network using the classification dataset, the fish images in the classification dataset are preprocessed; the preprocessing includes data augmentation and normalization, and the data augmentation includes random cropping and rotation of the images.
[0027] The second objective of this invention can be achieved by adopting the following technical solution:
[0028] A fish identification system, the system comprising:
[0029] The dataset acquisition module is used to acquire a fish classification dataset; the classification dataset includes images of various fish species.
[0030] The model building module is used to construct a TbGhostNet network based on the GhostNet network. The block layer in the TbGhostNet network is based on the original block layer structure of the GhostNet network with the addition of a residual network. The residual network includes residual structures block1 and block2. Residual structure block1 is used to extract shallow features of fish images and extract key features in fish images through an attention mechanism. Residual structure block2 is used to extract higher-level features from the features extracted by residual structure block1.
[0031] The model training module is used to train the TbGhostNet network using the classification dataset;
[0032] The fish identification module is used to acquire images of fish to be classified, preprocess the fish images, and input them into the trained TbGhostNet network to output the types of fish.
[0033] The third objective of this invention can be achieved by adopting the following technical solution:
[0034] A computer device includes a processor and a memory for storing a processor-executable program, wherein when the processor executes the program stored in the memory, it implements the above-described fish identification method.
[0035] The fourth objective of this invention can be achieved by adopting the following technical solution:
[0036] A storage medium storing a program that, when executed by a processor, implements the aforementioned fish identification method.
[0037] The present invention has the following advantages over the prior art:
[0038] 1. The method provided in this invention addresses the challenges of imbalanced fish data, exhibiting a long-tailed distribution, complex backgrounds, and irregular shapes in the samples. Furthermore, different fish species often exhibit weak color contrast and small feature differences. Therefore, it is necessary to extract more comprehensive and representative features to ensure classification accuracy. To further improve GhostNet's feature extraction capabilities, a residual network layer is added to the GhostNet block layer, becoming a new block layer. The network parameters are fine-tuned to construct a fish recognition model, TbGhostNet, with initialized parameters. The TbGhostNet network comprises two residual structures. The first residual structure extracts surface features from the fish image and then uses an attention mechanism for weighting, enhancing the ability to extract image features. The second residual structure extracts higher-level features from the extracted image features.
[0039] 2. The method provided in this invention uses a separate downsampling layer and adds normalization before the downsampling layer, which helps stabilize the training of the network model. Furthermore, Droppath is used to randomly deactivate the main branch, which has a regularizing effect on the network model and improves its accuracy. By using the learning strategies of Warm-up and CosineLR, the learning rate is adjusted during training, making the model more stable during training, resulting in faster convergence and better performance.
[0040] 3. Through testing, the accuracy rate of fish identification using the GhostNet network reached 83.9%, and the accuracy rate of fish identification using the TbGhostNet network reached 86.0%, which fully demonstrates that the accuracy rate was further improved after optimizing the GhostNet network. Attached Figure Description
[0041] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.
[0042] Figure 1 This is a flowchart of the fish identification method according to Embodiment 1 of the present invention.
[0043] Figure 2 This is a schematic diagram of the TbGhostNet network structure in Embodiment 1 of the present invention.
[0044] Figure 3 (a) is a schematic diagram of the structure of the primary feature extraction module in Embodiment 1 of the present invention. Figure 3(b) is a schematic diagram of the block layer structure in the TbGhostNet network. Figure 3 (c) is a schematic diagram of the downsampling layer.
[0045] Figure 4 (a) is a schematic diagram of the residual structure Block1 in Embodiment 1 of the present invention. Figure 4 (b) is a schematic diagram of the residual structure Block2.
[0046] Figure 5 This is a flowchart illustrating the SE attention mechanism of Embodiment 1 of the present invention.
[0047] Figure 6 This is a structural block diagram of the fish identification system according to Embodiment 2 of the present invention.
[0048] Figure 7 This is a structural block diagram of the computer device according to Embodiment 3 of the present invention. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. It should be understood that the specific embodiments described are merely used to explain this application and are not intended to limit this application.
[0050] Example 1:
[0051] like Figure 1 As shown, this embodiment provides a fish identification method. This method optimizes the GhostNet network to obtain the TbGhostNet network, uses the TbGhostNet network to identify 500 fish species, and uses both the GhostNet and TbGhostNet networks to identify fish. The identification results are then compared and analyzed. The method includes the following steps:
[0052] S101. Obtain the fish classification dataset.
[0053] Images of various fish species were acquired and preprocessed. The preprocessed images constituted a fish classification dataset.
[0054] The preprocessing includes data augmentation and normalization of the image, wherein data augmentation includes random cropping and rotation of the image.
[0055] S102. Construct a TbGhostNet network based on the GhostNet network.
[0056] Furthermore, step S102 includes:
[0057] (1) Structure of TbGhostNet network.
[0058] like Figure 2 As shown, the TbGhostNet network structure retains the main layers of the GhostNet network, changing the GhostNet activation function ReLU to GELU (Gaussian Error Linear Unit). Compared to traditional convolution, it first generates some intrinsic feature maps, reduces parameter calculations by concatenation, and enhances features, increasing the number of channels. Based on the network's feature extraction and processing characteristics, it can be simply divided into three layers: a primary feature extraction module, a block layer, and a downsampling layer.
[0059] (1-1) Primary feature extraction module.
[0060] like Figure 3 As shown in (a), the primary feature extraction module includes a convolution H_conv and a LayerNorm. The convolution kernel of H_conv is 4×4, and the stride is 4. Input is an image of a fish. Where H represents the height of the image, W represents the width of the image, and C represents the number of channels in the image; Through a convolutional layer Combining LayerNorm with LayerNorm to extract primary features :
[0061]
[0062] in, LayerNorm represents convolution processing, and LayerNorm represents normalization processing.
[0063] (1-2) Block layer.
[0064] The block layer in the GhostNet network is based on the original block layer structure of the TbGhostNet network, with the addition of a residual network. The residual network includes residual structures block1 and block2, such as... Figure 3 As shown in (b).
[0065] (1-2-1) Residual structure block1.
[0066] like Figure 4As shown in (a), the main function of block1 is to extract some shallow features of fish and, through the attention mechanism, enable the network model to extract key features of fish while ignoring irrelevant information. Block1 consists of GhostModel, BatchNorm, Depthwise Convolution, SE attention mechanism, and Droppath.
[0067] Deep hierarchical convolution can achieve better network model performance while reducing the number of parameters; the overall idea of the SE attention mechanism is to assign different weights to each feature map, thereby obtaining channel features with higher information content that the network focuses on, and suppressing channel features with lower information content. Its implementation steps are as follows: Figure 5 As shown, global average pooling is first used to compress the two-dimensional feature information of all channels into a single real number, thus obtaining the global feature information of the channel. Then, a fully connected layer, activation function, and another fully connected layer with activation function are used to construct the correlation between channels, learning the connections between different channels and obtaining the weights of each channel. Finally, the obtained weights are weighted onto the features of each channel; in this embodiment, each channel is multiplied by its corresponding weight coefficient. Droppath performs a regularization effect by randomly deactivating the multi-branch structure in the block layer. This embodiment uses Droppath to randomly deactivate the branches of the residual structure, using progressively increasing parameters to improve the training speed of the network and slightly improve the network's accuracy, thereby enhancing the performance of the network model.
[0068] (1-2-2) Residual structure block2.
[0069] like Figure 4 As shown in (b), the main function of block2 is to further extract richer features of fish. Block2 consists of GhostModel and Droppath, with GELU as the activation function.
[0070] The essence of an activation function is to add a non-linear transformation to a network model. It processes the output of neurons in the upper layer and passes the result to neurons in the next layer. This addresses the limitations of linear models in terms of expressive power, enabling neural networks to fit non-linear functions.
[0071] The activation function used in this embodiment is the Gaussian Error Linear Unit (GELU) activation function, and its formula is as follows:
[0072]
[0073] Where x is the feature matrix extracted from the image by the network model.
[0074] In fields such as computer vision, natural language processing, and automatic speech recognition, the Gaussian Error Linear Unit (GELU) activation function achieves performance that matches or surpasses ReLU or ELU.
[0075] To extract more fish
[0076] (1-3) Downsampling layer.
[0077] Compared to GhostNet, GhostNet uses a separate downsampling layer before the block layer and adds normalization processing before the downsampling layer.
[0078] like Figure 3 As shown in (c), the downsampling layer extracts the features. LayerNorm regularization is applied before convolution. Maintaining channel consistency during downsampling increases the receptive field of subsequent features, further stabilizing the network model.
[0079] (2) Loss function in TbGhostNet network.
[0080] In common image classification problems, the cross-entropy loss function is typically used to calculate the loss. Its formula is as follows:
[0081]
[0082] in, Represents cross-entropy. Indicates sample The true distribution This represents the distribution predicted by the model.
[0083] In this process, the goal is to make the output probability of each sample in its corresponding class as close to 1 as possible. The smaller the cross-entropy value, the better the prediction result of the network model. However, this has a problem: if there is a correlation between samples of different classes, the generalization ability of the model cannot be guaranteed, which will lead to a certain degree of overfitting, making the posterior probability inaccurate.
[0084] This embodiment employs the label smoothing loss function, which modifies the target vector by a small value. Therefore, the accurate class predicted by the network model is no longer 1, but a smoothed numerical value. In contrast, other categories will be predicted as... , where K is the total number of sample classes. This is equivalent to adding noise to the original labels, causing the network model to allocate the predicted values to the lower-probability classes, reducing attention to the higher-probability classes, avoiding overconfidence, and improving the robustness and performance of the network. The formula is as follows:
[0085]
[0086] in, The smoothed distribution of the sample. For probability distribution, This is a hyperparameter.
[0087] S103. Train the TbGhostNet network using a fish classification dataset.
[0088] Furthermore, step S103 includes:
[0089] (1) The TbGhostNet network was trained using the training set in the fish classification dataset.
[0090] In this embodiment, the dataset includes 500 fish species and a total of 32,768 images, of which 26,415 images are used as the training set and 6,353 images are used as the test set. After preprocessing, a suitable dataset is formed. The TbGhostNet network model is trained on the training set and then tested on the test set to obtain a stable TbGhostNet network model.
[0091] The learning rate is one of the hyperparameters affecting the performance of a network model. An excessively large learning rate can easily lead to NaN (Not In Education, Navigation, or Non-Number) results during training; a too-small learning rate makes the network model take a long time to train, resulting in a very slow training process. Therefore, adjusting the learning rate is necessary in practical training. During network training, the model's weights are randomly initialized, and their values differ significantly from the final trained parameters. Using a large learning rate during initial training may cause the network model to oscillate, leading to poor learning performance.
[0092] Warm-up involves setting a progressive learning rate, starting from the initial minimum and gradually increasing it with each step until it reaches the initially set maximum, while continuing network training. During this learning rate adjustment process, the model gradually stabilizes, ultimately leading to faster convergence and better performance.
[0093] However, maintaining a large learning rate for an extended period can cause the gradient of the weights to oscillate repeatedly when the network training loss becomes very small. This prevents the training loss from reaching its minimum, resulting in poor learning performance for the network model. Cosine Annealing (LR) is a learning rate adjustment algorithm that uses a cosine function to adjust the learning rate, causing it to decrease slowly initially, then rapidly, and finally slowly again. Its formula is as follows:
[0094]
[0095] in, This represents the current learning rate. This represents the minimum learning rate. This represents the maximum value of the learning rate. This indicates the current epoch number. This represents the total number of epochs during the i-th training iteration.
[0096] The maximum and minimum values of the learning rate define the range of variation of the learning rate.
[0097] (2) Test the TbGhostNet network using the test set in the fish classification dataset.
[0098] During testing, the fish dataset was not uniformly distributed. Multiple loss functions were used for validation within the TbGhostNet network, including CrossEntropyLoss, Weighted CrossEntropy, Focal Loss, and Label Smoothing. The results are shown in Table 1.
[0099] Table 1. Accuracy of TbGhostNet under different loss functions
[0100]
[0101] The Label Smoothing loss function achieves over 2% higher validation accuracy on the test set than other loss functions.
[0102] S104. Compare the recognition rates of GhostNet network and the trained TbGhostNet network for fish images.
[0103] Furthermore, step S104 includes:
[0104] (1) Accuracy of GhostNet and TbGhostNet networks under the same loss function.
[0105] In this embodiment, the same cross-entropy loss function was used to compare the recognition results of GhostNet network and TbGhostNet network (different models). The results are shown in Table 2:
[0106] Table 2. Accuracy of different models under the same loss function.
[0107]
[0108] Under the cross-entropy loss function, TbGhostNet achieves the same fish recognition performance as GhosNet, 0.2% higher than ResNet50, and 1.1% higher than ConvNet. Transformer, due to limited image data and less obvious feature extraction, performs poorly in fish recognition, achieving only 66.9%.
[0109] (2) Accuracy of GhostNet and TbGhostNet networks under learning rate adjustment.
[0110] The learning rate was adjusted using a warm-up process, reaching its maximum value after 20 epochs. Then, cosine annealing was used to gradually reduce the learning rate in the remaining epochs. Different models were compared under a relatively smooth loss function, and the results are shown in Table 3.
[0111] Table 3. Accuracy of different models under learning rate adjustment
[0112]
[0113] After adjusting the learning rate, the TbGhostNet network model achieved higher accuracy than other models in fish identification, resulting in a better performance improvement. The improved Ghost branch was able to extract better local region information, which was the main reason for the success of this improvement.
[0114] S105. Obtain the fish image to be classified, input the processed image into the trained TbGhostNet network, and output the fish type.
[0115] Before inputting the image of the fish into the trained TbGhostNet network, the image is preprocessed as in step S101.
[0116] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware, and the corresponding program can be stored in a computer-readable storage medium.
[0117] It should be noted that although the method operations of the above embodiments are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. On the contrary, the order of execution of the described steps may be changed. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0118] Example 2:
[0119] like Figure 6 As shown, this embodiment provides a fish identification system, which includes a dataset acquisition module 601, a model building module 602, a model training module 603, and a fish identification module 604, wherein:
[0120] The dataset acquisition module 601 is used to acquire a fish classification dataset; the classification dataset includes images of various fish species.
[0121] The model building module 602 is used to build a TbGhostNet network based on the GhostNet network. The block layer in the TbGhostNet network is based on the original block layer structure of the GhostNet network with the addition of a residual network. The residual network includes residual structures block1 and block2. The residual structure block1 is used to extract shallow features of the fish image and extract key features in the fish image through an attention mechanism. The residual structure block2 is used to extract higher-level features from the features extracted by the residual structure block1.
[0122] The model training module 603 is used to train the TbGhostNet network using the classification dataset;
[0123] The fish identification module 604 is used to acquire images of fish to be classified, preprocess the fish images, input them into the trained TbGhostNet network, and output the types of fish.
[0124] The specific implementation of each module in this embodiment can be found in Embodiment 1 above, and will not be repeated here. It should be noted that the system provided in this embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure can be divided into different functional modules to complete all or part of the functions described above.
[0125] Example 3:
[0126] This embodiment provides a computer device, which can be a computer, such as... Figure 7As shown, the processor 702, memory, input device 703, display 704, and network interface 705 are connected via system bus 701. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium 706 and internal memory 707. The non-volatile storage medium 706 stores the operating system, computer programs, and database. The internal memory 707 provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. When the processor 702 executes the computer program stored in the memory, it implements the identification method of Embodiment 1 described above, as follows:
[0127] Obtain a fish classification dataset; the classification dataset includes images of various fish species;
[0128] The TbGhostNet network is constructed based on the GhostNet network. The block layer in the TbGhostNet network is based on the original block layer structure of the GhostNet network with the addition of a residual network. The residual network includes residual structures block1 and block2. Residual structure block1 is used to extract shallow features of fish images and extract key features in fish images through an attention mechanism. Residual structure block2 is used to extract higher-level features from the features extracted by residual structure block1.
[0129] The TbGhostNet network is trained using the aforementioned classification dataset;
[0130] Obtain the fish images to be classified, preprocess the fish images, and then input them into the trained TbGhostNet network to output the types of fish.
[0131] Example 4:
[0132] This embodiment provides a storage medium, which is a computer-readable storage medium, storing a computer program. When the computer program is executed by a processor, it implements the identification method of Embodiment 1 described above, as follows:
[0133] Obtain a fish classification dataset; the classification dataset includes images of various fish species;
[0134] The TbGhostNet network is constructed based on the GhostNet network. The block layer in the TbGhostNet network is based on the original block layer structure of the GhostNet network with the addition of a residual network. The residual network includes residual structures block1 and block2. Residual structure block1 is used to extract shallow features of fish images and extract key features in fish images through an attention mechanism. Residual structure block2 is used to extract higher-level features from the features extracted by residual structure block1.
[0135] The TbGhostNet network is trained using the aforementioned classification dataset;
[0136] Obtain the fish images to be classified, preprocess the fish images, and then input them into the trained TbGhostNet network to output the types of fish.
[0137] It should be noted that the computer-readable storage medium in this embodiment can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.
[0138] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope disclosed in the present invention, based on the technical solution and inventive concept of the present invention, shall fall within the scope of protection of the present invention.
Claims
1. A method for identifying fish, characterized in that, The method includes: Obtain a fish classification dataset; the classification dataset includes images of various fish species; A TbGhostNet network is constructed. The TbGhostNet network includes a primary feature extraction module, multiple T-block module groups, and an output layer connected in sequence, with downsampling layers inserted between adjacent T-block module groups. The primary feature extraction module serves as the first layer of the network, consisting of a convolutional layer and a layer normalization layer. Each T-block module employs a two-layer residual structure. In the first residual structure, the input, after being processed by the sequentially connected Ghost Module, BatchNorm, deep hierarchical convolution, SE attention mechanism, Ghost Module, and Droppath, is added to the input of that layer to obtain the residual mapping between the input and output of that layer, which serves as the output of the first residual structure block1. The output of the first residual structure block1 is used as the input of the second residual structure block2. In the second residual structure, the input, after being processed by the sequentially connected Ghost Module, BatchNorm, GELU activation function, and Ghost... The output obtained after processing by Module, BatchNorm, and Droppath is added to the input of the layer to obtain the residual mapping between the input and output of the layer, which is used as the output of the second residual structure block2. The downsampling layer consists of layer normalization and a convolutional layer. The output layer consists of global average pooling, layer normalization, and fully connected layers connected in sequence to generate the image recognition result. The TbGhostNet network is trained using the aforementioned classification dataset; Obtain the fish images to be classified, preprocess the fish images, and then input them into the trained TbGhostNet network to output the types of fish.
2. The identification method according to claim 1, characterized in that, The SE attention mechanism is used to assign different weights to each feature map, thereby obtaining channel features with high information content that the network focuses on, and suppressing channel features with low information content. The implementation steps include: first, compressing the two-dimensional feature information of all channels into a single real number through global average pooling, thereby obtaining the global feature information of the channels; then, constructing the correlation between channels through fully connected layers, the GELU activation function, and the hard_sigmoid activation function, learning the relationship between different channels, and obtaining the weights of each channel; finally, weighting the obtained weights onto the features of each channel. The Droppath is used to randomly deactivate the branches of the residual structure block1 and uses progressively increasing parameters to improve the recognition accuracy of the TbGhostNet network.
3. The identification method according to claim 1, characterized in that, Normalization is added before the downsampling layer to ensure that the number of channels remains constant during the downsampling process.
4. The identification method according to claim 1, characterized in that, The loss function used in the TbGhostNet network is the label smoothing loss function. The formula is as follows: ; in, For the sample Smoothed distribution Indicates sample The true distribution This represents the distribution predicted by the model. Represents cross-entropy. For probability distribution, This is a hyperparameter.
5. The identification method according to claim 1, characterized in that, When training the TbGhostNet network, warm-up and cosine annealing are used to adjust the learning rate.
6. The identification method according to any one of claims 1-5, characterized in that, Before training the TbGhostNet network using the classification dataset, the fish images in the classification dataset are preprocessed. The preprocessing includes data augmentation and normalization, and the data augmentation includes random cropping and rotation of the image.
7. A fish identification system, characterized in that, The system includes: The dataset acquisition module is used to acquire a fish classification dataset; the classification dataset includes images of various fish species. The model building module is used to construct the TbGhostNet network. The TbGhostNet network includes a primary feature extraction module, multiple T-block module groups, and an output layer connected in sequence, with downsampling layers inserted between adjacent T-block module groups. The primary feature extraction module, serving as the first layer of the network, consists of a convolutional layer and a layer normalization layer. Each T-block module employs a two-layer residual structure. In the first residual structure, the input, after being processed by the sequentially connected Ghost Module, BatchNorm, deep hierarchical convolution, SE attention mechanism, Ghost Module, and Droppath, is added to the input of that layer to obtain the residual mapping between the input and output of that layer, which serves as the output of the first residual structure block1. The output of the first residual structure block1 is used as the input of the second residual structure block2. In the second residual structure, the input, after being processed by the sequentially connected Ghost Module, BatchNorm, GELU activation function, and Ghost... The output obtained after processing by Module, BatchNorm, and Droppath is added to the input of the layer to obtain the residual mapping between the input and output of the layer, which is used as the output of the second residual structure block2. The downsampling layer consists of layer normalization and a convolutional layer. The output layer consists of global average pooling, layer normalization, and fully connected layers connected in sequence to generate the image recognition result. The model training module is used to train the TbGhostNet network using the classification dataset; The fish identification module is used to acquire images of fish to be classified, preprocess the fish images, and input them into the trained TbGhostNet network to output the types of fish.
8. A computer device comprising a processor and a memory for storing a processor-executable program, characterized in that, When the processor executes the program stored in the memory, it implements the identification method according to any one of claims 1-6.
9. A storage medium storing a program, characterized in that, When the program is executed by the processor, it implements the identification method according to any one of claims 1-6.