A ReID method for tracking individual fish underwater

The ReID method, optimized by explicit local texture representation and contrastive learning, solves the problems of misassociation and identity switching after occlusion recovery in underwater fish individual identification and tracking, and achieves stability and accuracy in fish individual identity maintenance in high-density occlusion scenarios.

CN122090255APending Publication Date: 2026-05-26SHANGHAI OCEAN UNIV
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202610549901.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-24
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In high-density underwater aquaculture scenarios, existing technologies for underwater fish identification and tracking suffer from problems such as misassociation and identity switching after occlusion recovery, and excessively high similarity of homogeneous individual features. These issues make it difficult to maintain the consistency of individual fish identities under conditions of occlusion, imaging degradation, and high homogeneity.

Method used

We adopt a ReID method based on explicit local texture representation and contrastive learning optimization. We extract texture feature vectors through the LBP algorithm, combine supervised contrastive learning to constrain feature vector aggregation and separation, and use cosine similarity matching and EMA template update mechanism to suppress the influence of noise and pose changes.

Benefits of technology

It improves the distinguishability between homogeneous individuals and the stability of identity retention after occlusion recovery, and enhances the accuracy and stability of individual fish identification in high-density occlusion scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122090255A_ABST
    Figure CN122090255A_ABST
Patent Text Reader

Abstract

This invention discloses a ReID method for tracking individual fish underwater. The method involves acquiring underwater images containing multiple individual fish, using a segmentation network model to obtain the Region of Interest (ROI) corresponding to each individual fish in the underwater image, extracting texture feature vectors from each ROI using the LBP algorithm, extracting global feature vectors from each ROI, and then weighted and fused these global feature vectors with the corresponding texture feature vectors to obtain a fused feature vector. Using the fused feature vector as input, a supervised contrastive learning method is used to train the recognition model. During the inference phase, steps one to three are repeated to obtain the fused feature vectors corresponding to each individual fish in the image to be detected. Using these fused feature vectors as input, the trained recognition model generates normalized feature vectors corresponding to each individual fish. By calculating the cosine similarity between the normalized feature vector and the feature vector of the historical identity template, individual fish weight recognition is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the technical field of image processing, specifically relating to a ReID method for tracking individual underwater fish. Background Technology

[0002] With economic and social development, my country's aquaculture industry has also developed rapidly, and aquaculture methods are gradually shifting towards intelligent, precise, and large-scale development. Automated identification of individual fish is a prerequisite for achieving precision aquaculture. Precise identification of individual fish in a fishpond is beneficial for observing their growth status and is one of the technologies that makes aquaculture management more scientific and efficient.

[0003] In existing technologies, underwater fish individual identification and continuous tracking are typically achieved through cross-frame association based on detection results. This includes methods that rely solely on bounding box spatial overlap (e.g., IoU) and motion prediction for association, or methods that superimpose appearance re-identification (Re-ID) feature similarity for association. These methods generally suffer from the following drawbacks in high-density underwater aquaculture scenarios: First, in high-density occlusion and intersection scenarios, relying solely on bounding box overlap (e.g., IoU) and simple geometric constraints for cross-frame association can lead to rapid changes in the spatial relationships between targets, resulting in mis-associations and identity switching after occlusion recovery. Second, existing appearance re-identification schemes often use convolutional neural networks to extract global appearance features. However, when fish of the same size and age have highly similar appearances, global features are insensitive to subtle texture differences between individuals, leading to excessively high similarity between different individuals and inducing identity confusion in densely intersecting scenarios. These drawbacks make it difficult for existing technologies to maintain stable fish individual identity consistency over the long term under conditions of occlusion, imaging degradation, and high individual homogeneity. Summary of the Invention

[0004] To address the aforementioned issues, this invention provides a ReID method for tracking individual underwater fish based on explicit local texture representation and contrastive learning optimization. This method improves the distinguishability between homogeneous individuals by encoding local textures in candidate regions (ROIs) and constructing texture feature representations. Supervised contrastive learning constrains the aggregation of feature vectors for samples with the same identity and the separation of feature vectors for samples with different identities. Furthermore, during the inference stage, similarity matching and appearance template updating mechanisms are employed to suppress the impact of noise and pose changes on features, thereby enhancing the stability of identity preservation after occlusion recovery.

[0005] To achieve the above objectives, the present invention provides the following technical solution: A ReID method for tracking individual fish underwater includes the following steps: Step 1: Acquire underwater images containing multiple individual fish, and use a segmentation network model to obtain the ROI region corresponding to each individual fish in the underwater image; Step 2: Extract texture feature vectors from each ROI region using the LBP algorithm; Step 3: Extract global feature vectors from each ROI region, and then perform weighted fusion of the global feature vectors with the corresponding texture feature vectors to obtain fused feature vectors; Step 4: Using the fused feature vectors as input, a supervised contrastive learning method is employed to train the recognition model. During the inference phase, steps 1 to 3 are repeated to obtain the fused feature vectors corresponding to each individual fish in the image to be inspected. These fused feature vectors are then used as input to generate normalized feature vectors for each individual fish using the trained recognition model. By calculating the cosine similarity between the normalized feature vectors and the feature vectors of the historical identity templates, identity matching is completed, thus achieving individual fish weight recognition. The historical identity template feature vector is generated and maintained during the reasoning stage: when a single fish appears for the first time or its normalized feature vector has a cosine similarity to any historical identity template feature vector in the identity template library that is lower than a preset threshold, the normalized feature vector of the single fish is added to the identity template library as a new historical identity template feature vector. When a single fish successfully matches the feature vector of a historical identity template in the identity template library, the corresponding historical identity template feature vector is updated using an exponential moving average method and then normalized.

[0006] Furthermore, in step two, each pixel in each ROI region is first LBP encoded, then the encoded ROI region is divided into multiple grid units, then the LBP encoded value corresponding to each pixel in each grid unit is counted and converted into a histogram vector, and finally the histogram vectors corresponding to all grid units are concatenated to obtain the texture feature vector.

[0007] Furthermore, each ROI region is first converted to grayscale, and the LBP encoding value corresponding to each pixel is calculated using the following formula. , in, This represents the position coordinates of a specific pixel. Represents pixels The corresponding grayscale value, Represented by pixels Any sampling point within a neighborhood of radius R centered at R grayscale value, This represents the total number of sampling points within the neighborhood; Then, the encoded ROI region is uniformly divided into M*N grid cells, and the histogram vector corresponding to each grid cell is calculated using the following formula. and for all histogram vectors Normalization is performed to obtain the normalized histogram vector. , in, Indicates the index of the grid cell; Indicates the first LBP mode histogram vector corresponding to each grid cell; superscript The histogram represents the first... Each pattern category , The number of bins in the histogram represents the total number of pattern categories. Finally, the histogram vectors corresponding to all grid cells are concatenated to obtain the texture feature vector. .

[0008] Furthermore, the texture feature vector is first projected and mapped. Obtain the texture mapping vector Similarly, the global feature vector is projected and mapped. Obtain the global mapping vector Then the texture mapping vector Global mapping vector The weighted fusion and projection mapping are performed sequentially to obtain the fused feature vector. ,in, All of these represent weighting coefficients.

[0009] Furthermore, the global feature vector is obtained by performing ROIAlign and pooling on each ROI region based on the four-dimensional feature map output by the segmentation network model during the forward computation process.

[0010] Furthermore, the four-dimensional feature map is taken from the feature map output of the RepBlock layer before the input of the Detecthead in the segmentation network model. The coordinates of the Regions of Interest (ROIs) obtained through the segmentation network model in the input image are proportionally mapped to the coordinate system of the four-dimensional feature map. An ROIAlign operation is then performed on each ROI in the four-dimensional feature map to align the region features. Fixed-size ROI feature blocks are then extracted, and pooling operations are performed on these blocks to obtain pooled feature vectors. , Where C represents the number of feature map channels, and then the pooled feature vector is... Mapped to a fixed-dimensional global feature vector through a linear projection layer. : in, Represents the projection weight matrix. For bias vectors, This is the preset embedding dimension.

[0011] Compared with the prior art, the beneficial effects of the present invention are: 1) Employ LBPH explicit encoding of microtexture to enhance sensitivity to fine-grained differences; (2) Improve the generalizable discrimination ability under open set conditions by optimizing the feature space through supervised InfoNCE contrastive learning; (3) Cosine similarity matching and EMA template update are used to improve the stability of the inference stage and suppress feature drift caused by instantaneous noise and pose changes; (4) Robustness is improved by the fusion output and fallback texture output mechanism, and usable texture feature vectors can still be output when the fusion model is unavailable, loading fails or resources are limited. Attached Figure Description

[0012] Figure 1 This is a schematic diagram of the overall process of the present invention. The training stage and the inference stage are the same method in different working states. The training stage is used to obtain a trained recognition model. After the training is completed, the inference stage is entered. The inference stage takes the video frame to be recognized as input and outputs the re-recognition result. Figure 2 This is a schematic diagram of the entire network structure of the present invention; Figure 3 This is a schematic diagram of the texture feature extraction process in one embodiment of the present invention, wherein: (a) is a schematic diagram of the original underwater image and the candidate region of fish (ROI); (b) is a schematic diagram of cropping the candidate region (ROI); (c) is a schematic diagram of the LBP texture response obtained by performing local binary mode encoding on the ROI; and (d) is the corresponding normalized LBP mode histogram. Figure 4 This is a diagram illustrating some of the annotation documents of the present invention, wherein the first column is the category index. The second to fifth columns are the normalized bounding box coordinates. The sixth column shows the trajectory of the target within the current video sequence. ; Figure 5 This is a schematic diagram illustrating the generation process of the pseudo-global identity tag global_id according to the present invention; Figure 6 This diagram illustrates a comparison between the identification method of this invention and the Botsort algorithm. Detailed Implementation

[0013] To make the technical means, creative features, objectives and effects of this invention easier to understand, the following embodiments, in conjunction with the accompanying drawings, specifically illustrate the ReID method for tracking individual underwater fish of this invention. It should be noted that the description of these embodiments is for the purpose of helping to understand this invention, but does not constitute a limitation of this invention.

[0014] like Figure 1 and 2 As shown, this invention provides a ReID method for tracking individual fish underwater. It acquires underwater images or video frames and obtains candidate Regions of Interest (ROIs) corresponding to individual fish. Then, the ROIs are grayscaled and locally textured. Texture feature vectors are extracted based on Local Binary Pattern Histogram (LBPH), while global feature vectors are extracted from the ROIs. The texture feature vectors and global feature vectors are fused and projected to obtain a fused feature vector, which is then L2 normalized. During the training phase, pseudo-global identity labels are constructed based on video sequence identifiers and trajectory identifiers. The InfoNCE loss function based on cosine similarity is used to optimize the feature space, enabling the aggregation of embeddings of the same identity and the separation of embeddings of different identities. During the inference phase, the cosine similarity between the normalized feature vector and the feature vector of the historical identity template is calculated to achieve identity matching. The appearance template is updated using exponential moving average to suppress the influence of noise. The present invention also provides a two-path output mechanism: the fusion mode outputs a preset dimension embedding, wherein the fusion mode adopts the method of "mapping the ROI-level global feature branch and the LBPH texture feature branch respectively, weighting and concatenating them, and then outputting the embedding through fusion mapping"; when the fusion model is unavailable or fails to load, the system automatically switches to the texture mode, and generates a normalized embedding vector output based only on the LBPH texture feature vector to improve the robustness of the system.

[0015] Specifically as follows: Step 1: Acquire underwater images containing multiple individual fish and obtain the Region of Interest (ROI) corresponding to each individual fish in the underwater images.

[0016] In one specific implementation, a segmentation network model, such as the YOLO series, is used. The training process may include: acquiring video or image data of underwater aquaculture scenes or experimental tank scenes, and extracting frames at preset intervals to form training samples; using an annotation tool to annotate the bounding boxes of each individual fish in each frame; dividing the samples into training and validation sets, and then training the segmentation network model using a deep learning framework to obtain a detection model capable of outputting fish bounding boxes. During inference, the underwater image to be processed is input into the segmentation network model to obtain the bounding box coordinates and confidence score corresponding to each individual fish, and the area covered by each bounding box is used as the candidate Region of Interest (ROI) for that individual fish.

[0017] Furthermore, to extract the global feature vector corresponding to each ROI, this implementation utilizes the four-dimensional feature map generated by the segmentation network model during the same forward inference process. Obtain ROI-level deep features. Specifically, four-dimensional feature maps. The feature map is taken from the RepBlock layer output at the end of the neck network and before the input of the detector head in the segmentation network model. To adapt to the stride constraint of this segmentation network model, the input image is preferably padded with stride alignment before forward inference so that its height and width are integer multiples of the network stride. In this embodiment, this four-dimensional feature map... For a feature map with stride=32, for example, an input size of... At that time, the output feature map size is The number of channels is 128. After obtaining the ROI, the coordinates of the ROI in the input image are mapped proportionally to the four-dimensional feature map. The coordinate system, and in the four-dimensional feature map The above performs the ROIAlign operation on each ROI to align region features and extract ROI feature blocks of a fixed size (e.g., output size is...). Then, pool the ROI feature block (e.g., mean pooling) to obtain the pooled feature vector. , Where C is the number of feature map channels, and then the pooled feature vector is... Mapped to a fixed-dimensional global feature vector through a linear projection layer. : in, The projection weight matrix is... For bias vectors, For the preset embedding dimension (e.g.) Through the above method, the global feature vector It comes from the same forward inference process of the detection network as the ROI.

[0018] Step 2: Use the LBP algorithm to extract texture feature vectors from each ROI region.

[0019] like Figure 3 As shown, the local texture of the ROI region can be explicitly encoded using the Local Binary Patterns Histogram (LBPH) to obtain the texture feature vector. .

[0020] 1. Grayscale Converting a candidate region of interest (ROI) from color space to grayscale can be achieved using a weighted averaging method to transform the R, G, and B channels into single-channel grayscale. For example... .

[0021] 2. LBP encoding The total number of sampling points is set to and sampling radius Construct a neighborhood of the ring structure. For any pixel in the grayscale image... Its grayscale value is denoted as With this pixel Any sampling point within the neighborhood of the center The grayscale value is denoted as Then the pixel point LBP encoded value It can be represented as: Among them, the typical choice is , In standard LBP encoding, Each sampling point can generate Different encoding modes, when There are a total of 256 patterns. However, a large number of non-uniform patterns (i.e., patterns with more than two 0-1 transitions in binary encoding) contribute little to texture representation and are susceptible to noise. To improve the robustness and compactness of features, this embodiment uses a uniform pattern for encoding.

[0022] A uniform pattern is defined as a pattern in an LBP-encoded circular binary sequence where the number of transitions between 0 and 1 does not exceed two. For The number of sampling points and the number of uniform patterns are: If all non-uniform patterns are grouped into an additional category, the total number of buckets in the histogram is: In this embodiment, take ,but: By using uniform pattern mapping, the original 256 LBP patterns are compressed into 59, which reduces the feature dimension and enhances noise resistance while preserving the main texture information.

[0023] 3. Grid division and histogram statistics The ROI region is spatially divided into A grid cell, for example Each grid cell covers a portion of the ROI. The LBP encoded values ​​of all pixels within each grid cell are statistically analyzed to obtain a length of... histogram vector ; The meanings of the symbols are consistent with those in the aforementioned formula.

[0024] Then for all histogram vectors Normalization is performed, such as using L1 / L2 normalization algorithms, to obtain the normalized histogram vector. , in, To prevent division by zero of extremely small positive numbers, normalization makes ROIs of different sizes comparable. Indicates the first The LBP mode category within each grid cell is: The pixel count value, that is, the LBP encoding result of the pixels in this grid falling into the first... Number of times the class is used.

[0025] The LBP code is obtained by comparing neighboring sample points, where The total number of sampling points in the neighborhood. For the first Index of each sampling point ( Therefore, the LBP encoding result corresponds to a discrete category number, thus forming the buckets of the histogram.

[0026] 4. Feature splicing The histogram vectors corresponding to all grid cells are concatenated to obtain the texture feature vector. .

[0027] The normalized histogram vectors corresponding to each grid cell are concatenated in a fixed order to form the final texture feature vector. : like ,and Then the texture feature vector The dimension is This invention is not limited to specific examples. , and The value can be adjusted according to different fish species and resolutions.

[0028] Through the above steps, the microscopic texture patterns of fish scales, spots, etc. on the surface of the fish can be explicitly encoded into high-dimensional histogram vectors, providing input for subsequent feature fusion and contrastive learning.

[0029] Step 3: Fuse the global feature vector and the texture feature vector to obtain the fused feature vector.

[0030] Texture feature vectors of the same candidate region of interest (ROI) and global feature vectors First, perform projection mapping separately. Obtain the texture mapping vector and global mapping vector Then, weighting coefficients are introduced. , The two mapping vectors are weighted and concatenated, and then projected onto the concatenated mapping vector. Output preset dimensions fused feature vector In this embodiment, YOLOv8 is used as the recognition model to fuse the texture feature vectors and global feature vectors of the same ROI into a unified-dimensional re-recognition feature vector. Its structure includes a texture projection layer, a global projection layer, a feature weighted concatenation module, and a fusion mapping network. For example... Figure 2 As shown, specifically, the texture branch will divide the texture feature vector Through texture projection mapping Mapped to texture mapping vector The global branch will generate global feature vectors. Through global projection mapping Mapped to a global mapping vector Then, weighting coefficients were introduced. and Scale the two branch mapping vectors, i.e., calculate them separately. and The combined feature vector is obtained by concatenating the features according to the channel dimension. Finally, the combined feature vector is input into the fusion mapping network. Output fused feature vector And perform L2 normalization to obtain normalized feature vectors for training and matching: Among them, the fusion mapping network A multilayer perceptron structure (e.g., composed of multiple fully connected layers and nonlinear activation functions, and optionally including regularization structures such as Dropout) can be used to enhance robustness to underwater noise and attitude changes.

[0031] Step 4: Using the fused feature vector as input, train the recognition model using a supervised contrastive learning method, and then use the trained recognition model to identify the weight of individual fish.

[0032] It should be noted that this embodiment uses a YOLOv8-based recognition model, and its training and inference mechanisms are as follows: Training Phase: The YOLOv8-based recognition model receives fused feature vectors as input and optimizes the feature space through supervised contrastive learning, aggregating feature vectors of samples with the same identity and separating feature vectors of samples with different identities. During training, discrete identity numbers are not output; instead, the feature representation capability is directly optimized through contrastive loss.

[0033] Inference phase: The YOLOv8-based recognition model outputs a normalized feature vector for each individual fish. Identity matching is completed by calculating the cosine similarity between the normalized feature vector and the historical identity template. For details on the matching method, please refer to Part 2 of this step.

[0034] 1. Supervised Comparative Learning Training (InfoNCE): During the training phase, pseudo-global identity labels are constructed using video sequence identifiers and trajectory identifiers. and the label Injecting re-identification label vectors into training batches ; In one implementation, such as Figure 5 As shown, this pseudo-global identity label The construction and usage process are as follows: (1) Annotation file format and trajectory identifier reading This embodiment uses the Track 1.0 annotation format, such as... Figure 4 As shown, each annotation file corresponds to one image frame, and each line in the file describes one target, in the following format: in, For category indexing, For normalized bounding box coordinates, for The target's trajectory identifier (integer) within the current video sequence. The 6th column field is read sequentially from the annotation file corresponding to each frame. .

[0035] (2) Video sequence identifier parsing Parse video sequence identifiers based on the storage path of the annotation file. Specifically, the annotation files are stored in the `labels_track / ` directory, organized by subdirectories for each video sequence. The first and second level directory names following `labels_track / ` are extracted from the annotation file path as... For example, the path labels_track / train / video_05 / 000123.txt corresponds to 。

[0036] (3) Construction of global mapping table During training, maintain a global mapping dictionary, Key-value pairs are mapped to unique integer numbers. For the first key-value pair encountered during training, assign it the current maximum number plus 1 as its value. When the same trajectory reappears in a subsequent video sequence, the original number is used to ensure that the label for the same trajectory remains consistent across different frames. This mapping table is valid within a single training session.

[0037] (4) Label injection and invalid sample handling The result Re-identification label vectors injected into the training batch in ROI order This is used for calculating the loss in supervised contrastive learning. When a ROI sample is missing trajectory identifiers, has insufficient labeled row fields, or fails to be parsed, it is... Assign an invalid value (e.g.) And in the InfoNCE loss calculation, this sample is masked and not included in the optimization.

[0038] The feature space is optimized by using supervised InfoNCE loss based on cosine similarity and temperature coefficient, which enables the aggregation of feature vectors of samples with the same identity and the separation of feature vectors of different identities, thereby improving the distinguishability and cross-frame stability of homogeneous individuals.

[0039] For all valid samples in a training batch ( Normalized eigenvectors of ) Its tags During the training phase, labels are set for each ROI sample. This is a pseudo-global identity identifier. Specifically, this involves parsing the trajectory identifiers corresponding to each ROI from the annotation file with trajectory identifiers. At the same time, obtain the video sequence identifier to which the annotation file belongs. Combine the two into a key-value pair And through a pre-maintained mapping table, this key-value pair is mapped to a unique integer number, i.e., a pseudo-global identity identifier. , .

[0040] Cosine similarity is defined as: in, Indicates the first , No. The L2 normalized feature vectors of each sample; The cosine similarity function, after L2 normalization, is equivalent to a vector dot product: .

[0041] And introduce temperature coefficient Get the similarity logit: in, Temperature is a hyperparameter used to adjust the smoothness of the similarity distribution; in this embodiment, it is taken as... 。 A smaller temperature coefficient makes the model more sensitive to differences in similarity, which is helpful in distinguishing highly homogeneous individuals.

[0042] To avoid self-matching interference, a self-matching mask matrix is ​​introduced when calculating the similarity matrix. The diagonal elements are 1s, and the rest are 0s. Before calculating the InfoNCE loss, the diagonal positions of the similarity matrix are assigned extremely negative values ​​(e.g., ...). ), making the self-matching item in softmax After normalization, the value approaches zero, thus excluding samples that match themselves.

[0043] In addition, for samples with invalid labels ( For example, samples with missing labels or failed parsing are masked in the loss calculation and do not participate in the construction of positive and negative sample pairs and gradient backpropagation, thereby avoiding interference from invalid labels to training.

[0044] For anchor samples Its positive sample set and negative sample set are defined as follows: in, Indicates the first The identity label of each sample; when If the identity has no other samples within the batch, the sample is ignored. For anchor samples with positive samples, a supervised InfoNCE loss based on "positive sample similarity mean aggregation" is applied. in, Represents anchor sample Aggregate the mean similarity of positive samples; Indicates a sample The InfoNCE loss value for the anchor.

[0045] The batch loss is obtained by averaging all valid anchor samples that meet the conditions. in, To simultaneously satisfy and The sample index set is used. By minimizing this loss, feature vectors of samples with the same identity are aggregated, while feature vectors of samples with different identities are separated, thereby improving the separability among homogeneous underwater individuals and the stability of cross-frame matching.

[0046] 2. Fish individual weight identification After training the recognition model, the inference phase performs individual fish identification on each individual fish target in the input underwater image or video frame to obtain its identity number (ID) and maintain identity consistency across frames. The specific implementation process is as follows: First, target detection or segmentation is performed on the input image / video frame to obtain the candidate region of interest (ROI) and its bounding box coordinates for each individual fish, and each candidate region is treated as an instance to be identified. Then, following the methods described in steps one to three, a fusion feature vector is generated for each ROI: In fusion mode, LBPH texture feature vectors are extracted based on the ROI. The global feature vector is obtained by performing ROIAlign and pooling on the four-dimensional feature map output from the forward pass of the detection network for that ROI. The two are mapped separately, weighted and concatenated, and then fused to obtain a fused feature vector. This fused feature vector is then input into the trained recognition model to obtain a feature vector, which is then L2 normalized to obtain a normalized feature vector. When the fusion model is unavailable, fails to load, or has limited computing resources, the system automatically falls back to using only the texture feature vector. Generate texture feature vectors and normalize the output to ensure the system is robust and usable.

[0047] After obtaining the normalized feature vectors of each detected target in the current frame. Then, it is compared with the feature vector of the maintained identity template library. Cosine similarity is calculated to complete identity matching. Cosine similarity is defined as: in, The cosine similarity function is equivalent to the dot product of vectors after L2 normalization of the feature vectors. The normalized identity template feature vector corresponding to a certain historical trajectory (or identity template) is called the historical identity template feature vector. This represents the normalized feature vector corresponding to the target detected in the current frame. Identity matching is completed by global allocation based on the principle of maximum similarity or by constructing a similarity matrix; when the maximum similarity is lower than a preset threshold, it can be determined that a match cannot be made and a new identity template (or a new trajectory) is created.

[0048] Once a target is successfully matched with an identity template, to reduce feature fluctuations caused by underwater noise, ambiguity, and attitude changes, the identity template is updated and normalized using an exponential moving average (EMA) method. in , representing the update coefficient (historical template weight) of the exponential moving average. Indicates the weight of the currently detected feature vector; This is the L2 normalization operator. During initialization, when a target is detected for the first time, the current frame's... It is directly used as the initial value of the feature vector of this identity template, that is = After each successful match, the EMA algorithm is used to update the settings. ,therefore Essentially The time-series cumulative version, namely the historical identity template feature vector, is calculated in the same way, but it has undergone EMA smoothing. Simply put, it is a normalized feature vector. It is calculated in real time for the current frame, and It is a historical version that has been cumulatively updated by EMA.

[0049] In this way, the template update mechanism can enhance the stability of identity retention after occlusion recovery and reduce the probability of identity switching.

[0050] To verify the ability of this invention to distinguish homogeneous individuals and maintain identity stability after occlusion recovery in high-density underwater aquaculture scenarios, this embodiment compares and evaluates the method of this invention with several existing multi-target tracking / association methods under the same detector output candidate box conditions. The evaluation metrics used are commonly employed in the field of multi-target tracking: High-Order Tracking Accuracy (HOTA), Identity F1 Score (IDF1), Multi-Target Tracking Accuracy (MOTA), Association Accuracy (AssA), and Detection Accuracy (DetA).

[0051] (1) Quantitative comparison results (Table 1) Table 1 presents the overall performance comparison results of the re-identification method of the present invention with existing methods such as StrongSORT (strong online real-time tracking algorithm), DeepOCSORT (deep observation center online real-time tracking algorithm), OC-SORT (observation center online real-time tracking algorithm), ByteTrack (byte-level detection and tracking algorithm), BotSORT (robust correlation online real-time tracking algorithm), and SU-T tracking algorithm on the test set. As shown in Table 1, the method of the present invention achieves better results on the IDF1 metric (measuring identity preservation ability) and the HOTA (holistic tracking quality index), indicating that the representation based on LBPH texture features and contrastive learning can effectively suppress identity switching caused by occlusion and crossover.

[0052] Table 1. Overall Tracking Performance Comparison Results on the Fish Dataset 2) Visual comparison of identity changes caused by occlusion like Figure 6 As shown, the top row displays the tracking results of the BotSORT comparison method, while the bottom row displays the tracking results of the method proposed in this invention. The figure shows the tracking output of the same sequence in Frames 722, 743, and 760. Colored boxes represent different trajectory identification numbers, and yellow boxes mark the areas where the comparison method causes identity jumps after individual cross-occlusion. The method proposed in this invention maintains more stable identity consistency within the same segment, indicating that appearance representation optimized based on texture-dominated embedding and contrastive learning helps improve the ability to preserve identity after occlusion recovery.

[0053] It is important to note that the schemes and arrangements of this application shown in the exemplary embodiments are merely exemplary. Although only a few embodiments are described in detail in this disclosure, those who consult this disclosure will readily understand that many modifications are possible (e.g., variations in various parameter values ​​(temperature, power, humidity, etc.), installation arrangements, names, colors, logical orders, etc.) without substantially departing from the novel teachings and advantages of the subject matter described in this application. Therefore, all such modifications are also included within the scope of the invention, and the order or sequence of any process or method steps may be changed or rearranged according to alternative embodiments. In the claims, any "apparatus plus function" clause is intended to cover the structure described herein for performing the function, and not only structurally equivalent but also equivalent in structure. Other substitutions, modifications, alterations, and omissions may be made in the design, operation, and arrangement of the exemplary embodiments without departing from the scope of the invention. Therefore, the invention is not limited to the particular embodiments but extends to a variety of modifications that still fall within the scope of the appended claims.

[0054] Furthermore, in order to provide a concise description of exemplary embodiments, not all features of actual embodiments (i.e., those features that are not relevant to the best mode of carrying out the invention as currently considered, or those features that are not relevant to implementing the invention) may be omitted.

[0055] It should be understood that numerous specific implementation decisions can be made during the development of any practical implementation, such as in any engineering or design project. Such development efforts may be complex and time-consuming, but for those skilled in the art who benefit from this disclosure, the development effort will be a routine work of design, manufacturing, and production without requiring much experimentation.

[0056] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A ReID method for tracking individual fish underwater, characterized in that... Includes the following steps: Step 1: Acquire underwater images containing multiple individual fish, and use a segmentation network model to obtain the ROI region corresponding to each individual fish in the underwater image; Step 2: Extract texture feature vectors from each ROI region using the LBP algorithm; Step 3: Extract global feature vectors from each ROI region, and then perform weighted fusion of the global feature vectors with the corresponding texture feature vectors to obtain fused feature vectors; Step 4: Using the fused feature vectors as input, a supervised contrastive learning method is employed to train the recognition model. During the inference phase, steps 1 to 3 are repeated to obtain the fused feature vectors corresponding to each individual fish in the image to be inspected. These fused feature vectors are then used as input to generate normalized feature vectors for each individual fish using the trained recognition model. By calculating the cosine similarity between the normalized feature vectors and the feature vectors of the historical identity templates, identity matching is completed, thus achieving individual fish weight recognition. The historical identity template feature vector is generated and maintained during the reasoning stage: when a single fish appears for the first time or its normalized feature vector has a cosine similarity to any historical identity template feature vector in the identity template library that is lower than a preset threshold, the normalized feature vector of the single fish is added to the identity template library as a new historical identity template feature vector. When a single fish successfully matches the feature vector of a historical identity template in the identity template library, the corresponding historical identity template feature vector is updated using an exponential moving average method and then normalized.

2. The ReID method for tracking individual underwater fish according to claim 1, characterized in that: In step two, each pixel in each ROI region is first LBP encoded, then the encoded ROI region is divided into multiple grid units, then the LBP encoded value of each pixel in each grid unit is counted and converted into a histogram vector, and finally the histogram vectors corresponding to all grid units are concatenated to obtain the texture feature vector.

3. The ReID method for tracking individual underwater fish according to claim 2, characterized in that: First, each ROI region is converted to grayscale. Then, the LBP encoding value corresponding to each pixel is calculated using the following formula. , in, This represents the position coordinates of a specific pixel. Represents pixels The corresponding grayscale value, Represented by pixels Any sampling point within a neighborhood of radius R centered at R grayscale value, This represents the total number of sampling points within the neighborhood; Then, the encoded ROI region is uniformly divided into M*N grid cells, and the histogram vector corresponding to each grid cell is calculated using the following formula. and for all histogram vectors Normalization is performed to obtain the normalized histogram vector. , in, Indicates the index of the grid cell; Indicates the first LBP mode histogram vector corresponding to each grid cell; superscript The histogram represents the first... Each pattern category , The number of bins in the histogram represents the total number of pattern categories. Finally, the histogram vectors corresponding to all grid cells are concatenated to obtain the texture feature vector. .

4. The ReID method for tracking individual underwater fish according to claim 1, characterized in that: First, the texture feature vector is projected and mapped. Obtain the texture mapping vector Similarly, the global feature vector is projected and mapped. Obtain the global mapping vector Then the texture mapping vector Global mapping vector The weighted fusion and projection mapping are performed sequentially to obtain the fused feature vector. ,in, All of these represent weighting coefficients.

5. The ReID method for tracking individual underwater fish according to claim 4, characterized in that: The global feature vector is obtained by performing ROIAlign operations and pooling on each ROI region based on the four-dimensional feature map output by the segmentation network model during the forward computation process.

6. The ReID method for tracking individual underwater fish according to claim 5, characterized in that: The four-dimensional feature map is taken from the feature map output of the RepBlock layer before the input of the Detect head in the segmentation network model, at the end of the neck network. The coordinates of the Regions of Interest (ROIs) obtained through the segmentation network model in the input image are proportionally mapped to the coordinate system of the four-dimensional feature map. An ROIAlign operation is then performed on each ROI in the four-dimensional feature map to align the region features. Fixed-size ROI feature blocks are then extracted, and pooling operations are performed on these blocks to obtain pooled feature vectors. , Where C represents the number of feature map channels, and then the pooled feature vector is... Mapped to a fixed-dimensional global feature vector through a linear projection layer. : in, Represents the projection weight matrix. For bias vectors, This is the preset embedding dimension.

Citation Information

Patent Citations

  • Novel online real-time pedestrian tracking method based on deep learning feature template matching

    CN111325135A

  • Model training method, pedestrian re-identification method and device, equipment and medium

    CN114821657A

  • Template matching gesture recognition method, system and equipment based on recommendation algorithm and medium

    CN118397706A

  • Method, medium and equipment for identifying underwater behaviors of cultured fishes

    CN121074621A

  • Offshore multi-target tracking detection method for unmanned ship

    CN121305346A