A training method, medium and system of a port entry and exit fishing boat name number area extraction model
By constructing a multi-scale feature fusion architecture and feature matching algorithm, the problem of regional feature differences in the names of fishing vessels of different sizes was solved, achieving high-precision identification of the names of various types of fishing vessels and improving the automation level of fisheries management and port monitoring.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIHAI FORECASTING CENT OF STATE OCEANIC ADMINISTRATION ((QINGDAO MARINE FORECASTING STATION OF STATE OCEANIC ADMINISTRATION) (QINGDAO MARINE ENVIRONMENT MONITORING CENT OF STATE OCEANIC ADMINISTRATION))
- Filing Date
- 2025-07-25
- Publication Date
- 2026-06-09
Smart Images

Figure CN120932037B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine vision model technology, and specifically relates to a training method, medium and system for a model of extracting the vessel name region of fishing vessels entering and leaving ports. Background Technology
[0002] Vessel name recognition is an important technical means for fisheries management and port monitoring. Traditional methods mainly use image processing techniques such as edge detection and color segmentation or single-scale deep learning models to locate the vessel name region. These methods can achieve basic vessel name region recognition on a single type of fishing vessel and are widely used in scenarios such as fishing port entry and exit management and fishing vessel identity verification.
[0003] However, traditional techniques face significant challenges in recognizing the names of fishing vessels of different sizes. First, the significant size differences between different types of fishing vessels result in the names exhibiting various scale features in the image. Second, the name area of small fishing vessels occupies a small portion of the image, making it easy to lose detailed features. Furthermore, while the name of large fishing vessels is larger in size, it may be distorted due to viewing angle, increasing the difficulty of recognition. Existing single-scale feature extraction models struggle to adapt to these size variations simultaneously, particularly exhibiting weak detection capabilities for small-sized name areas.
[0004] Therefore, effectively extracting the vessel name regions of fishing vessels of different sizes, especially the smaller vessel name regions on smaller vessels, has become a core problem that current fishing vessel monitoring technology urgently needs to solve. Existing technologies struggle to establish deep learning models that adapt to multi-scale features, making it impossible to accurately identify the vessel name regions of fishing vessels of different sizes, severely impacting the efficiency and accuracy of fisheries monitoring. In other words, existing technologies suffer from a technical problem in adapting to the differences in the feature characteristics of vessel name regions across different vessel sizes. Summary of the Invention
[0005] In view of this, the present invention provides a training method, medium and system for extracting the vessel name region of fishing vessels entering and leaving ports, which can solve the technical problem in the prior art that it is difficult to adapt to the differences in the feature characteristics of the vessel name region of fishing vessels of different sizes.
[0006] The present invention is implemented as follows: The first aspect of the present invention provides a training method for a fishing vessel name region extraction model for vessels entering and leaving ports, comprising: constructing a multi-scale feature fusion architecture combining a feature pyramid network and a path aggregation network to form a prototype of the fishing vessel name region extraction model; enhancing the detection capability of small-sized vessel name regions through top-down and bottom-up feature transfer paths; acquiring images of fishing vessels entering and leaving ports and labeling the vessel name regions; establishing a physical model of light reflection from the vessel name regions; constructing a feature matching algorithm using optimal transmission theory; dividing the training dataset; designing a three-stage training strategy; calculating the average accuracy index of the model on the validation set and optimizing the model performance; processing test set images using the trained model and evaluating the model effect; and fine-tuning the model parameters based on the test results to form the final fishing vessel name region extraction model for vessels entering and leaving ports.
[0007] Specifically, the step of establishing the physical model of the ship's name light reflection is as follows: the reflectivity of the ship's name surface under different lighting conditions is calculated based on the Fresnel reflection equation. The input parameters include the incident angle of light, the refractive index of the ship's hull material, the thickness of the ship's hull coating, the ambient light intensity, and the wavelength of the light. The output is the effective contrast value of the ship's name area.
[0008] Specifically, the step of constructing the feature matching algorithm using the optimal transmission theory is as follows: based on the spectral distribution of the visual features of the ship name, the optimal transmission theory is applied to construct the feature matching algorithm, transforming the problem into Wasserstein distance calculation, minimizing the distribution difference between the source domain feature distribution and the target domain feature distribution, and improving the model's generalization ability.
[0009] The three-stage training strategy is designed as follows: the first stage uses a basic training set to train the backbone network of the model; the second stage introduces an enhanced training set to fine-tune the detection head network; and the third stage performs end-to-end full network optimization training.
[0010] The feature pyramid network is a multi-scale feature extraction architecture for target detection. It achieves the fusion of features at different levels through top-down paths and lateral connections, effectively handling the detection problem of targets of different sizes. The path aggregation network is an improved feature fusion network. It adds bottom-up path enhancement on the basis of the feature pyramid network to form richer feature representations and enhance the detection capability of small targets.
[0011] The Fresnel reflection equation is a physical equation describing the reflection and transmission behavior of light at the interface of two different media. In the extraction of ship name regions, it is used to simulate the influence of hull surface reflection on imaging quality under different lighting conditions.
[0012] The optimal transmission theory is a mathematical theory that studies how to transform one probability distribution into another with minimal cost. In ship name recognition, it is applied to the alignment and domain adaptation problems of feature space, and achieves feature matching between different data distributions by solving the Wasserstein distance minimization problem.
[0013] The detailed structure of the prototype model for extracting the vessel name regions of fishing vessels entering and leaving the port includes: using the remaining network 50 as the backbone network to extract multi-level features; constructing a five-layer feature pyramid on the backbone network, corresponding to five scale layers from P2 to P6; fusing features in each feature layer through top-down paths and lateral connections; then introducing a path aggregation network structure to add bottom-up paths and strengthen the representation of small-sized vessel name features; performing channel unification processing on the feature maps of each layer through 1×1 convolution; finally, setting up three parallel detection head networks to predict vessel name regions of three scales: large, medium, and small, with each detection head network outputting the coordinates and confidence value of the vessel name region.
[0014] A second aspect of the present invention provides a computer-readable storage medium storing program instructions, which, when executed in a computer, are used to perform the above-described training method for a fishing vessel name region extraction model for entering and leaving ports.
[0015] A third aspect of the present invention provides a training system for extracting the vessel name region of fishing vessels entering and leaving ports, comprising the aforementioned computer-readable storage medium. The system can be any one of a computer, a server, or a microcontroller. The computer-readable storage medium is disposed within the system, and the system is provided with a microprocessor that executes the program instructions stored in the computer-readable storage medium.
[0016] This invention effectively enhances the detection capability of fishing vessel names of different sizes by constructing a multi-scale feature fusion architecture, especially improving the recognition accuracy of small-sized vessel names on small fishing vessels. It introduces a top-down and bottom-up bidirectional feature transfer mechanism, achieving effective fusion of features at different scales and solving the problem that single-scale feature extraction cannot adapt to changes in vessel name size.
[0017] This method constructs a feature matching algorithm based on optimal transport theory, minimizing the Wasserstein distance between the feature distributions of the source and target domains, significantly improving the model's generalization ability on fishing vessels of different sizes. A three-stage training strategy and a gradient weighting mechanism for difficult examples further optimize the model's performance in detecting the names of small-sized vessels, enabling the model to adapt to various size variations from micro to large fishing boats.
[0018] This invention successfully solves the problem of identification difficulties caused by the regional feature differences of fishing vessel names of different sizes, and realizes high-precision identification of the names of various types of fishing vessels. It provides more reliable technical support for fisheries management and port monitoring, and has significant advantages in application scenarios such as monitoring the entry and exit of mixed fishing vessels, greatly improving the automation level and efficiency of fisheries supervision. Attached Figure Description
[0019] Figure 1 This is a flowchart of the method of the present invention.
[0020] Figure 2 This is a schematic diagram of the structure of the model for extracting the vessel name region of fishing vessels entering and leaving the port in Example 2. Detailed Implementation
[0021] 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.
[0022] like Figure 1 The diagram shown is a flowchart of a training method for a fishing vessel name region extraction model for entering and leaving ports, provided by the first aspect of this invention. This method includes the following steps:
[0023] S01. Construct a multi-scale feature fusion architecture that combines feature pyramid network and path aggregation network to form a prototype of the fishing vessel name region extraction model for entering and leaving ports. Enhance the detection capability of small-sized vessel names through top-down feature transfer path and bottom-up feature transfer path.
[0024] S02. Collect images of fishing vessels entering and leaving the port, including different lighting conditions, weather conditions, shooting angles and vessel types. Accurately label the vessel name area and create a labeling file to record the coordinate information of the vessel name area and the corresponding category label.
[0025] S03. Establish a physical model of the ship's name light reflection. Calculate the surface reflectivity of the ship's name under different lighting conditions based on the Fresnel reflection equation. Input parameters include the incident angle of light, the refractive index of the ship's hull material, the thickness of the ship's hull coating, the ambient light intensity, and the wavelength of the light. The output is the effective contrast value of the ship's name area.
[0026] S04. Based on the spectral distribution of the visual features of the ship's name, a feature matching algorithm is constructed using the optimal transmission theory. The problem is transformed into Wasserstein distance calculation, which minimizes the distribution difference between the source domain feature distribution and the target domain feature distribution, thereby improving the model's generalization ability.
[0027] S05. Divide the training dataset into a basic training set, an augmented training set, and a validation set. The basic training set is used for initial model training, the augmented training set contains hard examples for improving model performance, and the validation set is used to evaluate the model training effect.
[0028] S06. Design a three-stage training strategy: the first stage uses the basic training set to train the backbone network of the model; the second stage introduces the enhanced training set to fine-tune the detector head network; and the third stage performs end-to-end full network optimization training.
[0029] S07. Calculate the average accuracy index of the model on the validation set, analyze the feature distribution of erroneous detection samples, adjust the importance weight of difficult samples using the gradient weighting method, and optimize the model's detection performance for small-sized ship names.
[0030] S08. Use the trained model to process the test set images, extract the ship name region, calculate the detection precision, recall and F1 score, and evaluate the actual application effect of the model.
[0031] S09. Based on the test results, fine-tune the parameters of the prototype model for extracting the names of fishing vessels entering and leaving the port, save the optimal model parameters, and form the final model for extracting the names of fishing vessels entering and leaving the port.
[0032] Among them, the Feature Pyramid Network is a multi-scale feature extraction architecture for object detection. It achieves the fusion of features at different levels through top-down paths and lateral connections, effectively handling the detection problem of targets of different sizes.
[0033] Among them, the path aggregation network is an improved feature fusion network. It adds bottom-up path enhancement to the feature pyramid network to form richer feature representations and enhance the detection capability of small targets.
[0034] The Fresnel reflection equation is a physical equation describing the reflection and transmission behavior of light at the interface between two different media. In the extraction of ship name and number regions, it is used to simulate the influence of ship surface reflection on image quality under different lighting conditions. The inputs include the incident angle of light, the refractive index of the ship material, the thickness of the ship coating, the ambient light intensity, and the wavelength of light. The outputs are the effective contrast value and visibility prediction value of the ship name and number region.
[0035] Among them, optimal transmission theory is a mathematical theory that studies how to transform one probability distribution into another with the least cost. In ship name recognition, it is applied to the alignment and domain adaptation problems of feature space. It achieves feature matching between different data distributions by solving the Wasserstein distance minimization problem.
[0036] Among them, the incident angle of light is the angle between the light ray and the normal direction of the ship's surface, which is obtained by measuring the angle at which the ship is illuminated by sunlight or artificial light sources at different times.
[0037] Among them, the refractive index of the hull material refers to the degree of light refraction by the material on the hull surface. It is obtained through material databases or experimental measurements. Different ships use paint materials with different refractive index values.
[0038] Among them, the thickness of the hull coating refers to the thickness of the paint on the surface of the hull, which affects the scattering and absorption of light within the coating, and is obtained through ship maintenance records or on-site measurements.
[0039] Ambient light intensity refers to the light intensity in the shooting environment, measured by a photometer or obtained from meteorological data, and is measured in lux.
[0040] Among them, the wavelength of light refers to the range of wavelengths of incident light, which is measured by a spectrometer or determined according to the characteristics of the light source, and affects the interaction between the light and the surface of the ship. The unit is nanometers.
[0041] The effective contrast value refers to the degree of brightness difference between the ship name area and the background, which directly affects the recognizability of the ship name and is used to guide the model to detect the ship name area under different lighting conditions. The value range is from 0 to 1.
[0042] Among them, the source domain feature distribution refers to the feature probability distribution extracted from the training data, which is obtained by statistically analyzing the numerical distribution of each feature dimension in the training dataset.
[0043] Among them, the target domain feature distribution refers to the probability distribution of features extracted from the test data, which is obtained by statistically analyzing the numerical distribution of each feature dimension in the test dataset.
[0044] Among them, difficult examples refer to ship name samples that the model has difficulty correctly identifying. These typically include small-sized, low-contrast, or severely occluded ship name images, which are identified by the model's prediction error rate.
[0045] The detection accuracy value refers to the ratio of the number of ship name regions correctly detected by the model to the total number of regions predicted by the model, and is used to evaluate the accuracy of the model.
[0046] The recall rate is the ratio of the number of ship name regions correctly detected by the model to the total number of actual ship name regions, and is used to evaluate the completeness of the model.
[0047] The F1 score is the harmonic mean of precision and recall, which comprehensively evaluates the overall performance of the model. By default, the calculation formula is F1 score = 2 × precision × recall / (precision + recall).
[0048] The detailed structure of the prototype model for extracting the vessel name regions of fishing vessels entering and leaving the port includes: using the remaining network 50 as the backbone network to extract multi-level features; constructing a five-layer feature pyramid on the backbone network, corresponding to five scale layers from P2 to P6; fusing features in each feature layer through top-down paths and lateral connections; then introducing a path aggregation network structure to add bottom-up paths and strengthen the representation of small-sized vessel name features; performing channel unification processing on the feature maps of each layer through 1×1 convolution; finally, setting up three parallel detection head networks to predict vessel name regions of three scales: large, medium, and small, with each detection head network outputting the coordinates and confidence value of the vessel name region.
[0049] The specific steps for establishing the training dataset are as follows: First, collect high-definition images captured by various fishing port monitoring cameras; label the ship name and number regions in each image with rectangular boxes; record the coordinate values, aspect ratios, and visibility values of the ship name and number regions; divide the samples into three categories—large, medium, and small—based on the size of the ship name and number; randomly divide them into training, validation, and test sets in a 7:2:1 ratio; apply random scaling, rotation, and color adjustments to the training set for data augmentation; generate training samples and corresponding label files; and finally, build a batch data loader to achieve efficient data reading and preprocessing.
[0050] The three-stage training strategy is detailed as follows: In the first stage, the backbone network parameters are fixed, and only the feature pyramid network and the detector head network are trained, with a learning rate of 10. -3 The training process is repeated for 30 cycles; in the second phase, the high-level backbone network is unfrozen, and the feature extraction and detection modules are jointly trained, with the learning rate reduced to 10%. -4 The training lasted for 20 cycles; in the third stage, the entire network was unfrozen for end-to-end fine-tuning, and the learning rate was further reduced to 10%. -5 The training process lasted for 10 epochs. Cosine annealing learning rate scheduling was used throughout the training process. The batch size was set to 16, and an adaptive moment estimation optimizer was used with a momentum parameter of 0.9 and a weight decay coefficient of 5 × 10⁻⁶. -4 .
[0051] Among them, the remaining network 50 is a deep convolutional neural network structure containing 50 network layers. It alleviates the gradient vanishing problem of deep networks through the remaining connections and performs well in image recognition tasks.
[0052] Among them, the adaptive moment estimator optimizer is an optimization algorithm that automatically adjusts the learning rate. It adaptively adjusts the learning rate of each parameter based on the first-order moment estimate and the second-order moment estimate of the gradient, thereby accelerating the convergence process.
[0053] Cosine annealing learning rate scheduling is a learning rate adjustment strategy that gradually reduces the learning rate according to the cosine function curve. It provides a larger learning rate in the early stage of training to achieve rapid convergence and a smaller learning rate in the later stage of training to achieve fine optimization.
[0054] The specific implementation of the above steps is described in detail below. Step S01 involves constructing a multi-scale feature fusion architecture based on a combination of a feature pyramid network and a path aggregation network. This architecture first uses the remaining network 50 as the backbone network to extract multi-level feature representations from the input image. Then, a five-layer feature pyramid structure is constructed on the backbone network, corresponding to five scale layers from P2 to P6. Layer P2 has the highest resolution, with a feature map size of 1 / 4 of the input image, while layer P6 has the lowest resolution, with a feature map size of 1 / 64 of the input image. Next, a top-down feature propagation path is implemented. High-level semantically rich feature maps are upsampled (using nearest neighbor interpolation) to the same size as the low-level feature maps, and then element-wise fused with the low-level feature maps. This process is performed layer by layer from P6 to P2. To enhance the detection capability of small-sized ship names, a path aggregation network structure is introduced to increase the bottom-up feature propagation path. Starting from P2, low-level feature maps are fused with adjacent high-level feature maps after a 3×3 convolution operation. This process is performed layer by layer from P2 to P6. Each feature map layer is then subjected to a 1×1 convolution to unify the number of channels to 256, ensuring consistency in feature dimensions. Finally, three parallel detection head networks are set up to predict ship name regions of three scales: large (above 64×64 pixels), medium (32×64 pixels), and small (below 16×32 pixels). Each detection head network consists of four 3×3 convolutional layers, outputting the coordinates of the ship name region and a confidence value. The purpose of this step is to build a deep learning model architecture that can effectively handle ship name regions of different sizes, with a particular focus on enhancing the detection capability for small ship name regions.
[0055] The specific implementation of step S02 involves data collection and annotation. First, fishing ports covering different environmental conditions are selected as data collection points, including ports along the eastern, southern, and northern coasts. High-definition cameras (resolution no less than 1920×1080 pixels) are used to collect images of fishing boats at different times (morning, noon, evening, and night), ensuring data coverage of various lighting conditions (strong light, weak light, backlight, sidelight), weather conditions (sunny, cloudy, rainy, foggy), shooting angles (front, side, oblique), and boat types (large, medium, and small fishing boats). The collected images are pre-processed, including adjusting the resolution to a uniform standard (1280×720 pixels), brightness normalization, and color balance adjustment. Image annotation tools are used to accurately label the ship name region in each image with rectangular bounding boxes. The annotation information includes the coordinates of the top-left corner, width, height, and a visibility score for the ship name (a value between 0 and 1, where 0 indicates completely invisible and 1 indicates fully visible; a visibility threshold of 0.3 is typically set, and samples with values below this are not included in the training set). A standard-format annotation file is created, recording the coordinates of the ship name region in each image and its corresponding category label ("ship name category"). The annotation file is stored in JSON format for easy retrieval during subsequent training. The purpose of this step is to establish a high-quality, diverse training dataset, providing the model with sufficient learning samples and ensuring that the model can adapt to various real-world application scenarios.
[0056] The specific implementation of step S03 involves establishing a physical model of the ship's name light reflection. This model is based on the Fresnel reflection equation to simulate the impact of hull surface reflection on image quality under different lighting conditions. First, hull material parameters are collected, including refractive index data for different types of hull coatings (generally, the refractive index range for fishing boat coatings is 1.4–1.7) and diffuse reflection coefficients (generally, the range is 0.2–0.8). Based on the hull surface characteristics, the Fresnel reflection equation is parameterized as follows: incident ray angle (0°–90°, where 0° represents perpendicular incidence and 90° represents parallel incidence), hull material refractive index (corresponding to different coating types), hull coating thickness (generally, the range is 50–200 μm), ambient light intensity (approximately 10,000 lux under clear daytime conditions, approximately 2,000 lux under cloudy conditions, and approximately 200 lux under artificial lighting at night), and light wavelength range (visible spectrum 400–700 nm). Then, calculations are performed based on the Fresnel reflection equation, which can calculate the reflectance of s-polarized light and p-polarized light separately. The s-polarized reflectance is determined by the incident angle, air refractive index, and the refractive index of the hull material; the p-polarized reflectance is also determined by these parameters but calculated using a different formula. The final total reflectance is the average of the s-polarized and p-polarized reflectances. In the calculation, the air refractive index is approximated as 1.0, and the hull material refractive index is taken according to the coating type. The incident angle and refraction angle follow the law of refraction. Based on the Fresnel reflection calculation results, combined with the coating thickness parameter and ambient light intensity, the effective contrast value of the ship name area is calculated. The effective contrast value is obtained by dividing the difference between the maximum and minimum brightness values of the ship name area by their sum. This contrast value is an important indicator of the visibility of the ship name, directly affecting the ease of recognition. The purpose of this step is to quantitatively analyze the visibility of the ship name under different conditions using a physical optics model, providing a theoretical basis for subsequent model training and improving the model's ability to recognize ship names under different lighting conditions. By understanding the interaction mechanism between light and the ship's surface, we can better design corresponding solutions for the ship name and number detection problem under different lighting conditions, thereby enhancing the robustness and adaptability of the model.
[0057] The specific implementation of step S04 involves constructing a feature matching algorithm using optimal transmission theory. First, feature vectors for ship name regions are extracted from the training image set. A backbone network is then used to extract features from each ship name region, resulting in a high-dimensional feature representation. The data is divided into multiple subdomains based on different shooting conditions, such as well-lit regions, poorly lit regions, and regions with severe reflections. Each subdomain corresponds to a feature distribution. The differences in feature distributions between subdomains are calculated. Feature distributions under different lighting conditions are considered as probability measures, and the differences between different distributions are calculated using the Wasserstein distance from optimal transmission theory. The feature matching problem is transformed into an optimal transmission problem, i.e., finding an optimal feature mapping method that minimizes the Wasserstein distance between the source and target domain feature distributions. The Sinkhorn algorithm is used to solve the regularized optimal transmission problem. This algorithm transforms the optimal transmission problem into an entropy-regularized convex optimization problem, which is solved iteratively with 100 iterations and a convergence threshold of 10. -6 Based on the solution results, a feature transformation function is constructed to map the features in the source domain to a feature space consistent with the target domain, reducing inter-domain differences. This method effectively solves the problem of inconsistent representation of ship name features under different lighting conditions and significantly improves the model's domain generalization ability. The purpose of this step is to construct a feature matching algorithm through optimal transport theory to reduce the data distribution differences under different shooting conditions and improve the model's generalization ability in complex environments.
[0058] The specific implementation of step S05 involves dataset partitioning and organization. First, based on the labeled data obtained in step S02, a complete dataset is formed, with a total sample size of no less than 10,000 images. Samples are evaluated and classified according to the clarity, size, and environmental complexity of the ship name region. Clarity scores (between 0 and 1) are calculated based on contrast value and edge sharpness. Size is categorized as large (area greater than 1 / 64 of the input image), medium (area between 1 / 64 and 1 / 256 of the input image), and small (area less than 1 / 256 of the input image). Environmental complexity scores (between 0 and 1) are comprehensively evaluated based on background texture complexity, occlusion degree, and drastic lighting changes. The dataset is divided into three subsets: a basic training set (60% of the total data, containing samples with high clarity and low environmental complexity), an augmented training set (20% of the total data, mainly containing difficult samples, such as small ship name regions, low-contrast samples, severely occluded samples, and samples with severe lighting reflection), and a validation set (20% of the total data, covering a balanced sample distribution across various situations). Data augmentation techniques were applied to both the basic and augmented training sets, including random horizontal flipping (probability 0.5), random brightness adjustment (range ±0.2), random contrast adjustment (range 0.8–1.2), random scaling (range 0.8–1.2), random rotation (range ±15°), and random cropping (preserving the original ship name area). A data loader was constructed with a batch size of 16, employing multi-threading to improve data loading efficiency. The data order was randomly shuffled during each training epoch. The purpose of this step was to rationally organize the training data, ensuring that the model could learn progressively from basic samples to difficult examples, thereby improving training efficiency and model generalization ability.
[0059] The specific implementation of step S06 involves executing a three-stage training strategy. This strategy achieves stable and efficient model convergence by gradually releasing network parameters during training. The first stage is the backbone network training stage, using a basic training set, fixing the remaining 50 pre-trained network parameters, and training only the feature pyramid network and the detector head network. An adaptive moment estimation optimizer is used, with an initial learning rate set to 10. -3 The momentum parameters β1 and β2 are set to 0.9 and 0.999 respectively, and the weighted decay coefficient is 5 × 10⁻⁶. -4 The training run is conducted for 30 epochs. In the first training phase, the cross-entropy loss function is used to calculate the classification loss, and the smoothed L1 loss function is used to calculate the regression loss. The total loss function is a weighted sum of the classification and regression losses, with a weight ratio of 1:1. The second phase is the fine-tuning phase. Using the base training set and 20% of the augmented training set samples, the remaining 50% of the high-level parts of the network (the 3rd and 4th convolutional layers) are unfrozen, and the feature extraction and detection modules are jointly trained. The learning rate is reduced to 10%. -4Other optimizer parameters remain unchanged, and training is performed for 20 epochs. In this stage, a hard example mining mechanism is added, assigning higher loss weights to samples that are difficult to detect. Hard examples are defined as samples with a prediction confidence below 0.3 or a localization accuracy below 0.5 IOU, and the loss weight for hard example samples is set to 2.0. The third stage is the full network optimization stage, using all basic and augmented training set samples, unfreezing all network parameters, and performing end-to-end fine-tuning, further reducing the learning rate to 10%. -5 The training process lasts for 10 epochs. Throughout the training, a cosine annealing learning rate scheduling strategy is employed, gradually reducing the learning rate from its initial value to 0.1 times its final value according to a cosine function curve. After each training epoch, model performance is evaluated on the validation set, the average accuracy is recorded, and the optimal model parameters are saved. The purpose of this step is to progressively optimize model parameters through a carefully designed multi-stage training strategy, avoiding overfitting and improving the model's generalization ability and stability.
[0060] The specific implementation of step S07 involves model optimization based on the validation set results. First, the model trained in step S06 is used to predict images on the validation set, obtaining the prediction results, including the predicted ship name area coordinates and confidence values. The average precision (AP) of the model on the validation set is calculated, with different intersection-over-union (IoU) thresholds. Commonly used IoU thresholds include 0.5, 0.75, and 0.5–0.95 (averaged in 0.05 steps), to comprehensively evaluate model performance. False detection samples are analyzed, categorized into false positives (misdetections) and false negatives (missed detections). Error rates are statistically analyzed for different sizes (large, medium, small), lighting conditions, and background complexity. Feature visualization techniques are used to analyze the feature distribution of false samples. The t-SNE dimensionality reduction algorithm is used to reduce high-dimensional features to a two-dimensional space for visualization, observing the differences in the distribution of correct and false detection samples in the feature space. Based on the error analysis results, a gradient weighting method was used to adjust the importance weights of difficult examples. For small-sized ship name samples, the weight coefficient was set according to the ratio of their area to the standard detection size, with smaller areas receiving larger weights, and a maximum weight of 2.0. For samples with severe illumination reflection (effective contrast values below 0.4), the weight coefficient w = 1.5 was set; for samples with high background complexity (complexity scores above 0.7), the weight coefficient w = 1.3 was set. The model was retrained using the adjusted sample weights, with particular attention paid to the detection performance of small-sized ship name samples. The purpose of this step was to improve the model's ability to detect difficult examples, especially small-sized ship name samples, by deeply analyzing the model's performance on the validation set and adjusting the training strategy accordingly.
[0061] The specific implementation of step S08 involves model testing and performance evaluation. First, an independent test dataset is prepared. This dataset, which was not involved in the model training and validation process, contains over 500 images of fishing vessels entering and leaving ports in real-world scenarios, covering various lighting conditions, shooting angles, and vessel types. The trained model is used to process the test dataset images, extracting the vessel name regions and recording the predicted region coordinates and confidence values. A confidence threshold of 0.5 is set to filter low-confidence detection results. Non-Maximum Suppression (NMS) is performed to eliminate duplicate detection boxes, with an IoU threshold set to 0.45. The model's prediction results are compared with manually labeled real vessel name regions. When the IoU between the predicted and real regions is greater than 0.5, the detection is considered correct. The performance metrics of the model on the test set are calculated, including: Precision = Number of correctly detected ship name regions / Total number of regions predicted by the model; Recall = Number of correctly detected ship name regions / Total number of actual ship name regions; F1 score = 2 × Precision × Recall / (Precision + Recall). The detection performance for large, medium, and small ship name regions is calculated separately to comprehensively evaluate the model's performance on targets of different scales. The detection performance under different environmental conditions (such as insufficient lighting, severe glare, and complex backgrounds) is statistically analyzed to assess the model's adaptability. The purpose of this step is to objectively measure the model's practical application effect through comprehensive evaluation on an independent test set, providing a basis for subsequent model improvement.
[0062] The specific implementation of step S09 involves model optimization and parameter saving. Based on the test results of step S08, the model for extracting the vessel name region of fishing boats entering and leaving the port is further fine-tuned. First, the model's performance on the test set is analyzed, focusing on scene types with F1 scores below 0.8. Different optimization strategies are set for different problems: for the problem of insufficient small target detection performance, the weights of low-level features in the feature pyramid network are enhanced, and the channel weight coefficient of the P2 layer feature map is adjusted to 1.2; for the problem of insufficient adaptability to illumination changes, an illumination normalization layer is added, and Local Response Normalization (LRN) processing is added before the network input, with the normalization radius set to 5 and the scaling factor set to 10. -4 The exponent parameter was set to 0.75. To address the issue of severe background interference, the ability to acquire contextual information was enhanced by adding an attention mechanism module to the detection head network. This module combines channel attention and spatial attention. Channel attention uses a squeeze-excitation structure with a compression ratio of 16, while spatial attention uses 3×3 convolutions to extract spatial correlations. Using the optimized model structure, the network was retrained for 5 epochs on the complete training dataset (including the basic training set and the augmented training set) with a learning rate of 10%. -5Other parameters are the same as in step S06, stage 3. Evaluate the performance of the optimized model on the validation and test sets to ensure improvements in all metrics. Save the optimal model parameters, including the network weight file, model structure description file, and training hyperparameter configuration file. Record the performance metrics of the final model on the test set as a reference for model deployment. The purpose of this step is to optimize the model structure and parameters based on the test results, improve the model's performance in practical applications, and save the optimal model for subsequent deployment.
[0063] A second aspect of the present invention provides a computer-readable storage medium storing program instructions, which, when executed in a computer, are used to perform the above-described training method for a fishing vessel name region extraction model for entering and leaving ports.
[0064] A third aspect of the present invention provides a training system for extracting the vessel name region of fishing vessels entering and leaving ports, comprising the aforementioned computer-readable storage medium. The system can be any one of a computer, a server, or a microcontroller. The computer-readable storage medium is disposed within the system, and the system is provided with a microprocessor that executes the program instructions stored in the computer-readable storage medium.
[0065] The mathematical model or calculation process involved in this invention will be described in detail below.
[0066] In step S03, the physical model for the reflection of the ship's name light is based on the Fresnel reflection equation, which is specifically expressed as follows:
[0067]
[0068]
[0069] In the formula, R s R is the reflectivity of s-polarized light, with a value ranging from 0 to 1; p θ is the reflectivity of p-polarized light, ranging from 0 to 1; R is the total reflectivity, ranging from 0 to 1; n1 is the refractive index of air, approximately 1.0 under standard atmospheric conditions; n2 is the refractive index of the hull material, ranging from 1.4 to 1.7 for commonly used coatings on fishing boats; θ i θ is the angle of incidence, ranging from 0° to 90°. t The angle of refraction is calculated using Snell's law (the law of refraction).
[0070] The Fresnel reflection equation describes the physical laws governing the reflection and transmission of light at the interface between two different media. By calculating the reflectivity at different incident angles, the light reflection characteristics of a ship's surface can be predicted. The square term is used because reflectivity is proportional to the square of the electric field amplitude, which conforms to the principle of conservation of electromagnetic energy. The fractional form reflects the relative relationship between the properties of the media on both sides of the interface; the greater the difference in refractive index between the two media, the higher the reflectivity. This equation considers the wave nature of light, calculating the light in both s-polarized and p-polarized cases separately, and finally taking the average as the total reflectivity. This approach better reflects the actual situation under natural lighting conditions.
[0071] Based on Fresnel reflection calculations, and combined with coating thickness and ambient light intensity, the effective contrast value of the ship name area was calculated:
[0072]
[0073] I max =I0(1-R) 背景 )+I 环境 ;
[0074] I min =I0(1-R) 船名 )+I 环境 ;
[0075] I0 = I 光源 ·cosα·e -βd ;
[0076] In the formula, C is the effective contrast value, ranging from 0 to 1; I max The maximum brightness value of the background in the ship name area; I min I0 is the minimum brightness value of the ship name area; R is the effective intensity of the incident light; 背景 R represents the reflectance of the background region. 船名 Reflectance of the area for the ship's name; I 环境 Ambient light intensity, measured in lux; I 光源 α is the light source intensity, measured in lux; α is the angle between the light source direction and the surface normal; β is the atmospheric attenuation coefficient, approximately 0.1 km² in clear weather. -1 In foggy weather, the range can reach 1.0 km. -1 Above; d represents the distance light travels, in kilometers.
[0077] The effective contrast ratio formula adopts the Michelson contrast ratio definition, calculated by dividing the difference between the maximum and minimum brightness by their sum. This calculation method normalizes the contrast ratio to the range of 0-1, facilitating subsequent processing. The effective intensity of the incident light is calculated using a combination of cosine and exponential attenuation, reflecting the influence of the incident angle and atmospheric scattering on the light intensity, which conforms to the laws of photophysics. The contrast ratio calculation considers the reflectivity difference between the ship name area and the background area, as well as the influence of ambient light, providing a more comprehensive simulation of the actual visual imaging process.
[0078] In step S04, the optimal transport theory is applied to construct a feature matching algorithm, the core of which is the Wasserstein distance:
[0079]
[0080] In the formula, W p denoted as p-order Wasserstein distance; μ is the source domain feature distribution; v is the target domain feature distribution; Π(μ, ν) is the set of all possible joint distributions, satisfying the marginal distributions μ and ν respectively; d(x, y) is the distance metric in the feature space; p is the distance order, usually taken as p = 1 or p = 2.
[0081] The Wasserstein distance describes the minimum "work" required to transform one probability distribution into another, where "work" is defined as the product of the distance and the mass of the moving probability. The power form is used to satisfy the mathematical properties of the distance metric; p = 1 corresponds to Earth Mover's Distance, and p = 2 corresponds to the optimal transmission of the squared Euclidean distance. The derivation of this distance is based on the principle of minimizing transmission cost, taking into account the geometric structure of the feature space, and is more suitable for handling distributions with non-overlapping support sets compared to traditional metrics such as KL divergence.
[0082] To solve the above optimization problem, the Sinkhorn algorithm is used to compute the regularized optimal transport problem:
[0083] W ∈ (μ, v) = min γ∈Π(μ,v) <γ, C>-∈H(γ);
[0084] γ * = diag(u)·K·diag(v);
[0085] K = e -C / ∈ ;
[0086]
[0087] In the formula, W ∈Here, is the Wasserstein distance for entropy regularization; ∈ is the regularization parameter, controlling the smoothness of the calculation, usually set to 0.01 to 0.1; H(γ) is the entropy function, defined as H(γ) = -∑ i,j γ i,j (logγ i,j -1); C is the cost matrix, C i,j =d(x i y j ) p This indicates that the source domain features x i Mapping to target domain features y j Cost; γ * For the optimal transmission plan; K is the kernel matrix; u and v are vectors in the iteration process; a and b are the probability mass vectors of the source and target domains, respectively; l is the iteration number.
[0088] The introduction of entropy regularization transforms the original linear programming problem into one that can be efficiently solved using iterative algorithms. The Sinkhorn algorithm achieves rapid computation of the optimal transport plan by alternately updating the u and v vectors. The kernel matrix K is used in exponential form to transform the original cost matrix into a non-negative matrix, making the iterative process more stable. The algorithm has a time complexity of O(n log n). 2 This method significantly improves computational efficiency compared to traditional linear programming methods, making it possible to apply optimal transport theory in high-dimensional feature spaces.
[0089] In step S05, the sharpness score of the sample is calculated as follows:
[0090] S 清晰度 =w1C + w2E;
[0091]
[0092] In the formula, S 清晰度 The sharpness score ranges from 0 to 1; C is the effective contrast value; E is the edge sharpness value; w1 and w2 are weighting coefficients, and w1 + w2 = 1, usually w1 = 0.6 and w2 = 0.4. For the image at point (x i y i The gradient magnitude at point () represents the number of edge pixels in the ship name region.
[0093] The sharpness score uses a weighted sum of contrast and edge sharpness, fully considering two key aspects of image quality. Contrast reflects the brightness difference between the ship's name and the background, while edge sharpness reflects the sharpness of the ship's name edges. The combination of both provides a comprehensive assessment of the ship's name's recognizability. Using a weighted sum instead of a product is to avoid a single factor causing an overall low score, thus improving the stability of the score. Edge sharpness is obtained by calculating the average gradient magnitude of the edge regions, which utilizes the basic principles of edge detection in image processing; a larger gradient indicates a sharper edge.
[0094] The environmental complexity score is calculated as follows:
[0095] S 复杂度 =w3T+w4O+w5L;
[0096]
[0097] In the formula, S 复杂度 The environmental complexity score ranges from 0 to 1; T represents the background texture complexity; O represents the degree of occlusion; L represents the degree of drastic change in lighting; w3, w4, and w5 are weighting coefficients, and w3 + w4 + w5 = 1, typically w3 = 0.3, w4 = 0.4, and w5 = 0.3; var(P i ) represents the image block P i The pixel variance; M is the number of blocks; A 遮挡 A represents the area where the ship's name and number are obscured. 总面积 The total area of the ship name region; max(I) and min(I) are the maximum and minimum brightness values within the image region, respectively; the standard illumination intensity is a reference value, usually taken as 5000 lux.
[0098] The environmental complexity score comprehensively considers three factors: background texture complexity, occlusion level, and illumination variation, all of which affect the difficulty of detecting ship names. Background texture complexity is quantified by calculating the variance of image blocks; a larger variance indicates more complex textures. Occlusion level is measured by the proportion of occluded area to the total area. The severity of illumination variation is represented by the ratio of extreme brightness differences to standard values. Using a weighted sum format allows for flexible adjustment of the importance of each factor, making the score more consistent with actual detection difficulty.
[0099] In step S06, the total loss function during training is calculated as follows:
[0100] L 总 =L 分类 +λL 回归 ;
[0101]
[0102] In the formula, L 总 L is the total loss function; 分类 L is the classification loss function; 回归 λ is the regression loss function; λ is the balance coefficient, usually taken as 1.0; N is the batch size; w i Let y be the weight of the i-th sample; i p represents the true class label of the i-th sample, which is either 0 or 1; i t represents the prediction confidence value for the i-th sample; i Let be the coordinates of the predicted bounding box of the i-th sample; Let be the coordinates of the ground truth bounding box of the i-th sample; smooth L1 (x) is the smoothed L1 loss function; IoU i Let be the intersection-union ratio (IoU) between the predicted bounding box and the ground truth bounding box of the i-th sample.
[0103] The total loss function is a weighted sum of classification and regression losses, a standard practice in object detection tasks, optimizing object presence prediction and location accuracy respectively. The classification loss uses cross-entropy loss, a standard loss function for binary classification problems, effectively measuring the difference between predicted probabilities and true labels. The regression loss uses smoothed L1 loss, which is smoother in small error regions than traditional L1 loss, promoting model convergence, and less sensitive to outliers than L2 loss. The weight of hard examples is set to twice that of ordinary examples. By increasing the loss weight of hard examples, the model is guided to focus more on samples that are difficult to detect correctly, thus improving the lower bound of model performance.
[0104] In step S07, the weight adjustment formula for the small-sized ship name sample is as follows:
[0105]
[0106] In the formula, w 小尺寸 1 represents the weighting coefficient for small-sized samples; width and height are the width and height of the ship name area, respectively, in pixels; 2.0 is the upper limit of the weighting.
[0107] The weight adjustment for small-sized samples uses a square root approach, a design that considers the non-linear relationship between area and detection difficulty. As the target size decreases, the rate of increase in detection difficulty is typically not linear, but rather closer to a square root relationship. Setting the weight cap to 2.0 prevents excessively small targets from receiving too high a weight, leading to training instability. The formula uses 64×64 pixels as a reference size because this is generally considered the smallest target size that can be stably detected in convolutional neural networks; targets smaller than this size become significantly more difficult to detect.
[0108] For samples with severe light reflection and high background complexity, the weight adjustment formula is as follows:
[0109] w 综合 =max(w 小尺寸 w 光照 w 背景 );
[0110] In the formula, w 光照 The weighting coefficients for the illumination reflection samples are: C = w; effective contrast value is C; w is w. 背景 S represents the weighting coefficients for samples with complex backgrounds. 复杂度 Score the environmental complexity; w 综合 This is the overall weighting coefficient.
[0111] The weights for illumination reflection and background complexity are set as thresholds rather than continuously varying values. This simplifies the implementation process and avoids introducing too many hyperparameters. The thresholds are chosen based on empirical values; samples with an effective contrast below 0.4 are generally difficult to distinguish visually, while samples with a background complexity above 0.7 typically contain a large amount of interfering information. Finally, the maximum value is used to determine the overall weights, rather than a product or weighted sum. This is to avoid excessively high weights due to the superposition of multiple challenging factors and to maintain training stability.
[0112] In step S08, the model performance evaluation index is calculated as follows:
[0113]
[0114]
[0115] In the formula, TP represents the number of true positives, i.e., the number of correctly detected ship name regions; FP represents the number of false positives, i.e., the number of incorrectly detected non-ship name regions; FN represents the number of false negatives, i.e., the number of undetected ship name regions; AP represents the average precision, i.e., the area under the precision-recall curve; r i For the recall value sequence; p 插值 (r) represents the interpolation precision, defined as the maximum precision value among all points with a recall greater than or equal to r.
[0116] Precision and recall evaluate model performance from the perspectives of prediction accuracy and completeness, respectively. The F1 score, as the harmonic mean of these two metrics, provides a balanced assessment. The harmonic mean, compared to the arithmetic mean, tends to penalize metrics with lower precision, thus better reflecting the overall model performance. Mean precision (AP) is a standard evaluation metric in object detection tasks. It is calculated by placing the area under the precision-recall curve, comprehensively evaluating the model's performance at different confidence thresholds. The use of interpolation precision makes AP calculation more stable, unaffected by local fluctuations in the precision-recall curve.
[0117] In step S09, the formula for calculating Local Response Normalization (LRN) is as follows:
[0118]
[0119] In the formula, b i,x,y a is the value of the i-th channel at position (x, y) of the normalized feature map; i,x,y is the value of the i-th channel at position (x, y) of the feature map before normalization; k is the bias constant, usually taken as 2; α is the scaling factor, with a value of 10. -4 β is the exponential parameter, with a value of 0.75; n is the normalized radius, with a value of 5; N is the number of channels in the feature map.
[0120] Local response normalization simulates the lateral inhibition mechanism in biological neural systems, enhancing the discriminative power of feature maps by normalizing the responses of neighboring channels. The normalization formula uses a power-law form, consistent with models in neuroscience; the normalization radius defines the range of neighboring channels involved in the calculation, typically covering 5–9 channels; the scaling factor controls the intensity of normalization; and the exponential parameter determines the degree of nonlinearity of inhibition. This operation effectively suppresses excessively strong responses and enhances the model's robustness to changes in illumination, which is particularly helpful in handling images under different lighting conditions during ship name region extraction.
[0121] The attention mechanism module added to the detection head network calculates channel attention as follows:
[0122]
[0123] F excitation =σ(W2δ(W1F) squeeze ));
[0124]
[0125] In the formula, Input feature map; The feature vector after global pooling;
[0126] For channel attention weights; F out This is the weighted output feature map; and σ is the weight matrix of the fully connected layer; r is the compression ratio, with a value of 16; σ is the sigmoid activation function; δ is the ReLU activation function; This is a multiplication of the channel dimension.
[0127] The channel attention mechanism employs a "squeeze-and-excitation" structure. First, global average pooling is used to compress the spatial dimension, obtaining the global response for each channel. Then, two fully connected layers learn the interrelationships between channels, generating importance weights for each channel. Finally, these weights are multiplied by the original feature map to enhance important channels. A compression ratio of 16 is set to strike a balance between model complexity and expressive power; this value has been proven optimal in the original SENet architecture. This mechanism effectively captures the dependencies between channels, enhancing the model's ability to represent ship name features.
[0128] Spatial attention is calculated as follows:
[0129] M=δ(Conv 3×3 (Concat[AvgPool(F);MaxPool(F)]));
[0130]
[0131] In the formula, Input feature map; This represents the average pooling result along the channel dimension; This represents the max pooling result along the channel dimension; Concat is the concatenation operation along the channel dimension; Conv 3×3 This is a 3×3 convolution operation; This is the attention map; σ is the sigmoid activation function; δ is the ReLU activation function; For spatial dimension multiplication; F 空间 The feature map after spatial attention weighting.
[0132] The spatial attention mechanism learns weights in the spatial dimension to highlight feature representations of important regions. It first calculates the average pooling and max pooling results of the feature map in the channel dimension. These two pooling operations provide complementary information: average pooling captures background information, while max pooling highlights target features. Then, the pooling results are concatenated and a spatial attention map is learned through a 3×3 convolution. Finally, the attention map is normalized using the sigmoid function and multiplied with the original feature map to achieve spatial feature enhancement. This mechanism helps the model focus on regions in the image that may contain ship names, reducing the influence of background interference.
[0133] The final attention enhancement features are calculated as follows:
[0134] F 增强 =F 空间 +F out ;
[0135] In the formula, F 增强The feature map after attention enhancement; F 空间 The feature map after spatial attention weighting; F out The feature map after channel attention weighting.
[0136] The attention-enhanced features are fused additively rather than sequentially. This design aims to avoid information loss that may result from cascading attention mechanisms and to enhance the complementarity of the two attention mechanisms. Channel attention primarily learns "what" are important features, while spatial attention primarily learns "where" important features exist. Combining the two comprehensively enhances the representation ability of ship name regions. The introduction of this attention mechanism effectively mitigates the impact of complex backgrounds and changes in lighting on ship name detection, improving the model's robustness in practical applications.
[0137] Specifically, the principle of this invention is as follows: The core technical principle of this invention lies in constructing a multi-scale feature fusion architecture to achieve effective identification of the names and numbers of fishing vessels of different sizes. First, through an architecture combining a Feature Pyramid Network (FPN) and a Path Aggregation Network (PANet), a bidirectional feature transfer path from top to bottom and from bottom to top is established, forming a multi-scale feature fusion system, which overcomes the limitation of traditional single-scale feature extraction models that are difficult to adapt to the detection of names and numbers of different sizes of fishing vessels.
[0138] The Feature Pyramid Network, through top-down paths and lateral connections, fuses high-level semantic information with low-level detailed features, improving the detection capability of large fishing vessel names. Meanwhile, the Path Aggregation Network, by adding bottom-up path enhancements, transmits low-level detailed information back to the high-level feature map, significantly enhancing the detection capability of small-sized vessel names on small fishing vessels. This bidirectional feature transfer mechanism ensures that the model can simultaneously capture vessel name features at different scales, adapting to various size variations from micro to large fishing vessels.
[0139] This invention innovatively categorizes training data into three types—large, medium, and small—based on the size of the vessel names, and designs three parallel detection head networks to predict vessel name regions of different scales. This specialized design enables the model to more accurately identify vessel names of various sizes, particularly improving the detection accuracy for vessel names on small fishing boats. The three-stage training strategy, by gradually unfreezing network layers, achieves progressive optimization from shallow to deep features, ensuring stable convergence of model parameters.
[0140] The gradient-weighted approach for difficult examples further optimizes for small-sized vessel name samples. By adjusting the weights of these difficult samples in the loss function, the model is guided to focus more on these hard-to-identify samples, thereby improving the model's detection performance on small fishing boats. The application of optimal transport theory ensures feature matching between data distributions of fishing boats of different sizes, improving the model's generalization ability. This combination of multi-scale feature fusion and specialized optimization achieves high-precision identification of vessel names for various types of fishing boats.
[0141] The following provides a specific embodiment 1 of the present invention, and the specific implementation of each step in this embodiment 1 is described in detail below.
[0142] The specific implementation of step S01 involves constructing a multi-scale feature fusion architecture based on a combination of a feature pyramid network and a path aggregation network, forming a prototype model for extracting the vessel name regions of fishing boats entering and leaving ports. This architecture first uses the remaining network 50 as the backbone network to extract multi-level feature representations from the input image. Then, a five-layer feature pyramid structure is constructed on the backbone network, corresponding to five scale layers from P2 to P6. Layer P2 has the highest resolution, with a feature map size of 1 / 4 of the input image, while layer P6 has the lowest resolution, with a feature map size of 1 / 64 of the input image. A top-down feature transfer path is implemented, where high-level semantically rich feature maps are upsampled to the same size as low-level feature maps and then element-wise fused with them. This process is performed layer by layer from P6 to P2. To enhance the detection capability of small-sized vessel names, a path aggregation network structure is introduced to increase the bottom-up feature transfer path. Starting from P2, low-level feature maps are fused with adjacent high-level feature maps after a 3×3 convolution operation. This process is performed layer by layer from P2 to P6. Each feature map layer undergoes a 1×1 convolution to unify the number of channels to 256, ensuring consistency in feature dimensions. Finally, three parallel detection head networks are set up to predict ship name regions of three scales: large (above 64×64 pixels), medium (32×64 pixels), and small (below 16×32 pixels). Each detection head network outputs the coordinates and confidence value of the ship name region. The purpose of this step is to construct a deep learning model architecture capable of effectively handling ship name regions of different sizes, with a particular emphasis on enhancing the detection capability for small-sized ship name regions.
[0143] Step S02 involves data collection and annotation. First, fishing ports covering different environmental conditions are selected as data collection points, including ports along the eastern, southern, and northern coasts. High-definition cameras (resolution no less than 1920×1080 pixels) are used to collect images of fishing boats at different times (morning, noon, evening, and night), ensuring data coverage of various lighting conditions (strong light, weak light, backlight, sidelight), weather conditions (sunny, cloudy, rainy, foggy), shooting angles (front, side, oblique), and boat types (large, medium, and small fishing boats). The collected images are pre-processed, including adjusting the resolution to a uniform standard (1280×720 pixels), brightness normalization, and color balance adjustment. Image annotation tools were used to accurately label the ship name region in each image with rectangular bounding boxes. The annotation information included the coordinates of the top-left corner, width, height, and a visibility score for the ship name (a value between 0 and 1, where 0 indicates completely invisible and 1 indicates fully visible; the visibility threshold was set to 0.3, and samples with values below this threshold were not included in the training set). A standard-format annotation file was created, recording the coordinates of the ship name region in each image and its corresponding category label ("ship name category"). The annotation file was stored in JSON format for easy retrieval during subsequent training. The purpose of this step was to establish a high-quality, diverse training dataset, providing the model with sufficient learning samples and ensuring that the model could adapt to various real-world application scenarios.
[0144] The specific implementation of step S03 involves establishing a physical model of the ship's name light reflection. This model, based on the Fresnel reflection equation, simulates the impact of hull surface reflection on image quality under different lighting conditions. First, hull material parameters are collected, including refractive index data for different types of hull coatings (generally, the refractive index range for fishing boat coatings is 1.4–1.7) and diffuse reflection coefficients (generally ranging from 0.2 to 0.8). Based on the hull surface characteristics, the Fresnel reflection equation is parameterized, and the reflectivity under different conditions is calculated, as shown below:
[0145]
[0146] In the formula, R s R is the reflectivity of s-polarized light, with a value ranging from 0 to 1; p θ is the reflectivity of p-polarized light, ranging from 0 to 1; R is the total reflectivity, ranging from 0 to 1; n1 is the refractive index of air, approximately 1.0 under standard atmospheric conditions; n2 is the refractive index of the hull material, ranging from 1.4 to 1.7 for commonly used coatings on fishing boats; θ i θ is the angle of incidence, ranging from 0° to 90°. t The angle of refraction is calculated using Snell's law. Based on the Fresnel reflection calculation results, combined with the coating thickness and ambient light intensity, the effective contrast value of the ship name area is calculated using the following formula:
[0147]
[0148] I max =I0(1-R) 背景 )+I 环境 ;
[0149] I min =I0(1-R) 船名 )+I 环境 ;
[0150] I0 = I 光源 ·cosα·e -βd ;
[0151] In the formula, C is the effective contrast value, ranging from 0 to 1; I max The maximum brightness value of the background in the ship name area; I min I0 is the minimum brightness value of the ship name area; R is the effective intensity of the incident light; 背景 R represents the reflectance of the background region. 船名 Reflectance of the area for the ship's name; I 环境 Ambient light intensity, measured in lux; I 光源 α is the light source intensity, measured in lux; α is the angle between the light source direction and the surface normal; β is the atmospheric attenuation coefficient, approximately 0.1 km² in clear weather. -1 In foggy weather, the range can reach 1.0 km. -1 The above; d represents the light propagation distance in kilometers. The purpose of this step is to quantitatively analyze the visibility of ship names under different conditions using a physical optics model, providing a theoretical basis for subsequent model training and improving the model's ability to recognize ship names under different lighting conditions.
[0152] The specific implementation of step S04 involves constructing a feature matching algorithm using optimal transmission theory. First, feature vectors for the ship name regions are extracted from the training image set. A backbone network is then used to extract features from each ship name region, resulting in a high-dimensional feature representation. The data is divided into multiple subdomains based on different shooting conditions, such as well-lit regions, poorly lit regions, and regions with severe reflections. Each subdomain corresponds to a feature distribution. Based on optimal transmission theory, Wasserstein distance is used to calculate the differences between different distributions, as specifically shown below:
[0153]
[0154] In the formula, W pLet be the p-th order Wasserstein distance; μ be the source domain feature distribution; ν be the target domain feature distribution; Π(μ, ν) be the set of all possible joint distributions, satisfying the marginal distributions μ and ν respectively; d(x, y) be the distance metric in the feature space; and p be the distance order, typically p = 1 or p = 2. To solve the above optimization problem, the Sinkhorn algorithm is used to compute the regularized optimal transport problem:
[0155] W ∈ (μ, v) = min γ∈Π(μ,v) <γ, C>-∈H(γ);
[0156] γ * = diag(u)·K·diag(v);
[0157] K = e -C / ∈ ;
[0158]
[0159] In the formula, W ∈ Here, is the Wasserstein distance for entropy regularization; ∈ is the regularization parameter, controlling the smoothness of the calculation, usually set to 0.01 to 0.1; H(γ) is the entropy function, defined as H(γ) = -∑ i,j γ i,j (logγ i,j -1); C is the cost matrix, C i,j =d(x i y j ) p This indicates that the source domain features x i Mapping to target domain features y j Cost; γ * The optimal transmission plan is defined by K; the kernel matrix is K; u and v are vectors in the iteration process; a and b are the probability mass vectors of the source and target domains, respectively; and l is the iteration number. A feature transformation function is constructed based on the solution results to map the features in the source domain to a feature space consistent with the target domain, reducing inter-domain differences. This method effectively solves the problem of inconsistent representation of ship name features under different lighting conditions and significantly improves the model's domain generalization ability. The iteration number is set to 100, and the convergence threshold is set to 10. -6 The purpose of this step is to construct a feature matching algorithm based on optimal transmission theory, reduce the differences in data distribution under different shooting conditions, and improve the model's generalization ability in complex environments.
[0160] The specific implementation of step S05 involves dataset partitioning and organization. First, based on the labeled data obtained in step S02, a complete dataset is formed, with a total sample size of no less than 10,000 images. The samples are evaluated and classified according to the sharpness, size, and environmental complexity of the ship name region. The sharpness score and environmental complexity score are calculated as follows:
[0161] S 清晰度 =w1C + w2E;
[0162]
[0163] S 复杂度 =w3T+w4O+w5L;
[0164]
[0165] In the formula, S 清晰度 The sharpness score ranges from 0 to 1; C is the effective contrast value; E is the edge sharpness value; w1 and w2 are weighting coefficients, and w1 + w2 = 1, usually w1 = 0.6 and w2 = 0.4. For the image at point (x i y i The gradient magnitude at point ); N is the number of edge pixels in the ship name region; S 复杂度 The environmental complexity score ranges from 0 to 1; T represents the background texture complexity; O represents the degree of occlusion; L represents the degree of drastic change in lighting; w3, w4, and w5 are weighting coefficients, and w3 + w4 + w5 = 1, typically w3 = 0.3, w4 = 0.4, and w5 = 0.3; var(P i ) represents the image block P i The pixel variance; M is the number of blocks; A 遮挡 The area where the ship's name is obscured; a 总面积 The total area of the ship name region; max(I) and min(I) are the maximum and minimum brightness values within the image region, respectively; the standard illumination intensity is a reference value, usually taken as 5000 lux.
[0166] Based on the evaluation results, the dataset was divided into three subsets: a basic training set (60% of the total data, containing samples with high clarity and low environmental complexity), an augmented training set (20% of the total data, mainly containing difficult examples, such as small ship names, low-contrast samples, severely occluded samples, and samples with severe light reflection), and a validation set (20% of the total data, covering a balanced sample distribution across various scenarios). Data augmentation techniques were applied to the basic and augmented training sets, including random horizontal flipping (probability 0.5), random brightness adjustment (range ±0.2), random contrast adjustment (range 0.8–1.2), random scaling (range 0.8–1.2), random rotation (range ±15°), and random cropping (preserving the integrity of the original ship name area). A data loader was constructed with a batch size of 16, employing multi-threading to improve data reading efficiency, and the data order was randomly shuffled in each training cycle. The purpose of this step was to rationally organize the training data, ensuring that the model could learn progressively from basic samples to difficult examples, thereby improving training efficiency and model generalization ability.
[0167] The specific implementation of step S06 involves executing a three-stage training strategy. This strategy achieves stable and efficient model convergence by gradually releasing network parameters during training. The first stage is the backbone network training stage, using a basic training set, fixing the remaining 50 pre-trained network parameters, and training only the feature pyramid network and the detector head network. An adaptive moment estimation optimizer is used, with an initial learning rate set to 10. -3 The momentum parameters β1 and β2 are set to 0.9 and 0.999 respectively, and the weighted decay coefficient is 5 × 10⁻⁶. -4 The training run is performed for 30 epochs. The total loss function during training is calculated as follows:
[0168] L 总 =L 分类 +λL 回归 ;
[0169]
[0170] In the formula, L 总 L is the total loss function; 分类 L is the classification loss function; 回归 λ is the regression loss function; λ is the balance coefficient, usually taken as 1.0; N is the batch size; w i Let y be the weight of the i-th sample; i p represents the true class label of the i-th sample, which is either 0 or 1; i t represents the prediction confidence value for the i-th sample; i Let be the coordinates of the predicted bounding box of the i-th sample; Let be the coordinates of the ground truth bounding box of the i-th sample; smooth L1 (x) is the smoothing L1 loss function.
[0171] The second stage is the fine-tuning stage. Combining the basic training set and 20% of the augmented training set samples, the remaining 50% of the high-level parts of the network (the 3rd and 4th convolutional layers) are unfrozen, and the feature extraction and detection modules are trained together. The learning rate is reduced to 10%. -4 While keeping other optimizer parameters unchanged, training is performed for 20 epochs. During this phase, a hard example discovery mechanism is added, assigning higher loss weights to samples that are difficult to detect.
[0172]
[0173] In the formula, w i p represents the weight of the i-th sample; i Let IoU be the prediction confidence value for the i-th sample. i Let be the intersection-union ratio (IoU) between the predicted bounding box and the ground truth bounding box of the i-th sample.
[0174] The third stage is the full network optimization stage, which uses all basic and augmented training set samples, unfreezes all network parameters, and performs end-to-end fine-tuning, further reducing the learning rate to 10%. -5 The training process lasts for 10 epochs. Throughout the training, a cosine annealing learning rate scheduling strategy is employed, gradually reducing the learning rate from its initial value to 0.1 times its final value according to a cosine function curve. After each training epoch, model performance is evaluated on the validation set, the average accuracy is recorded, and the optimal model parameters are saved. The purpose of this step is to progressively optimize model parameters through a carefully designed multi-stage training strategy, avoiding overfitting and improving the model's generalization ability and stability.
[0175] The specific implementation of step S07 involves model optimization based on the validation set results. First, the model trained in step S06 is used to predict the images on the validation set, obtaining the model's prediction results on the validation set, including the predicted ship name region coordinates and confidence values. The average precision (AP) of the model on the validation set is calculated as follows:
[0176]
[0177] In the formula, AP is the average precision, i.e., the area under the precision-recall curve; r i For the recall value sequence; p 插值 (r) represents the interpolation precision, defined as the maximum precision value among all points with a recall greater than or equal to r. Precision values are calculated for different Intersection over Union (IoU) thresholds. Commonly used IoU thresholds include 0.5, 0.75, and 0.5–0.95 (averaged with a step size of 0.05). The model performance is then comprehensively evaluated.
[0178] False detection samples were analyzed and categorized into false positives (false detections) and false negatives (false negatives). Error rates were statistically analyzed under different sizes (large, medium, and small), lighting conditions, and background complexities. Feature visualization techniques were used to analyze the feature distribution of false samples. The t-SNE dimensionality reduction algorithm was employed to reduce high-dimensional features to a two-dimensional space for visualization, observing the differences in the distribution of correct and false detection samples in the feature space. Based on the error analysis results, a gradient weighting method was used to adjust the importance weights of difficult samples. The weight adjustment formula is as follows:
[0179] w 综合 =max(w 小尺寸 w 光照 w 背景 );
[0180] In the formula, w 小尺寸 represents the weighting coefficient for small-sized samples; width and height are the width and height of the ship name area, respectively, in pixels; 2.0 is the upper limit of the weight; w 光照 The weighting coefficients for the illumination reflection samples are: C = w; effective contrast value is C; w is w. 背景 S represents the weighting coefficients for samples with complex backgrounds. 复杂度 Score the environmental complexity; w 综合 The weighting coefficients are used for the overall model. The model is retrained using the adjusted sample weights, with particular attention paid to the detection performance of small-sized ship names. The purpose of this step is to improve the model's ability to detect difficult samples, especially small-sized ship names, by deeply analyzing the model's performance on the validation set and adjusting the training strategy accordingly.
[0181] The specific implementation of step S08 involves model testing and performance evaluation. First, an independent test dataset is prepared. This dataset, not involved in model training and validation, contains over 500 images of fishing vessels entering and leaving ports in real-world scenarios, covering various lighting conditions, shooting angles, and vessel types. The trained model is used to process the test dataset images, extracting the vessel name regions and recording the predicted region coordinates and confidence values. A confidence threshold of 0.5 is set to filter low-confidence detection results. Non-Maximum Suppression (NMS) is performed to eliminate duplicate detection boxes, with an IoU threshold of 0.45. The model's prediction results are compared with manually labeled real vessel name regions. When the IoU between the predicted and real regions is greater than 0.5, the detection is considered correct. Performance metrics of the model on the test set are calculated, including:
[0182]
[0183] In the formula, TP represents the number of true positives, i.e., the number of correctly detected ship name regions; FP represents the number of false positives, i.e., the number of incorrectly detected non-ship name regions; and FN represents the number of false negatives, i.e., the number of undetected ship name regions. The detection performance for large, medium, and small ship name regions is calculated separately to comprehensively evaluate the model's performance on targets of different scales. The detection performance under different environmental conditions (such as insufficient lighting, severe glare, and complex backgrounds) is statistically analyzed to assess the model's adaptability. The purpose of this step is to objectively measure the model's practical application effect through comprehensive evaluation on an independent test set, providing a basis for subsequent model improvement.
[0184] The specific implementation of step S09 involves model optimization and parameter saving. Based on the test results of step S08, the model for extracting the vessel name regions of fishing boats entering and leaving the port is further fine-tuned. First, the model's performance on the test set is analyzed, focusing on scene types with F1 scores below 0.8. Different optimization strategies are set for different problems: for the problem of insufficient small target detection performance, the weights of low-level features in the feature pyramid network are enhanced, and the channel weight coefficients of the P2 layer feature map are adjusted to 1.2; for the problem of insufficient adaptability to illumination changes, an illumination normalization layer is added, and Local Response Normalization (LRN) processing is added before the network input. The normalization calculation is as follows:
[0185]
[0186] In the formula, b i,x,y a is the value of the i-th channel at position (x, y) of the normalized feature map; i,x,y is the value of the i-th channel at position (x, y) of the feature map before normalization; k is the bias constant, usually taken as 2; α is the scaling factor, with a value of 10. -4 β is the exponential parameter, with a value of 0.75; n is the normalized radius, with a value of 5; N is the number of channels in the feature map.
[0187] To address the issue of severe background interference, the ability to acquire contextual information is enhanced by adding an attention mechanism module to the detection head network, employing a combination of channel attention and spatial attention. The calculation of channel attention and spatial attention is as follows:
[0188]
[0189] F excitation =σ(W2δ(W1F) squeeze ));
[0190]
[0191] M=δ(Conv 3×3(Concat[AvgPool(F);MaxPool(F)]));
[0192]
[0193] F 增强 =F 空间 +F out ;
[0194] In the formula, Input feature map; The feature vector after global pooling; For channel attention weights; F out The feature map is after channel attention weighting; and σ is the weight matrix of the fully connected layer; r is the compression ratio, with a value of 16; σ is the sigmoid activation function; δ is the ReLU activation function; Multiplication for the channel dimension; This represents the average pooling result along the channel dimension; This represents the max pooling result along the channel dimension; Concat is the concatenation operation along the channel dimension; Conv 3×3 This is a 3×3 convolution operation; For attention graphs; F 空间 The feature map after spatial attention weighting; F 增强 This is the feature map after attention enhancement.
[0195] Using the optimized model architecture, retrain for 5 epochs on the complete training dataset (including the base training set and the augmented training set), with a learning rate of 10%. -5 Other parameters are the same as in step S06, stage 3. Evaluate the performance of the optimized model on the validation and test sets to ensure improvements in all metrics. Save the optimal model parameters, including the network weight file, model structure description file, and training hyperparameter configuration file. Record the performance metrics of the final model on the test set as a reference for model deployment. The purpose of this step is to optimize the model structure and parameters based on the test results, improve the model's performance in practical applications, and save the optimal model for subsequent deployment.
[0196] This embodiment, through the above nine steps, combines the advantages of feature pyramid networks and path aggregation networks. It simulates the visibility of ship names and numerals under different lighting conditions using a Fresnel reflection physical model, employs optimal transmission theory to improve the model's adaptability to data from different domains, uses a three-stage training strategy to progressively optimize model parameters, and uses a gradient weighting method to improve detection performance for difficult samples. Finally, through model optimization and parameter saving, a high-performance ship name and numeral region extraction model is formed. This method particularly enhances the detection capabilities for small-sized ship names and numerals, ship names and numerals against complex backgrounds, and ship names and numerals under different lighting conditions, and can be effectively applied to practical maritime surveillance scenarios.
[0197] To better understand and implement this invention, Example 2, a specific application scenario, is provided below: Researchers conducted a three-month study on the region extraction model for the names of fishing vessels entering and leaving a fishing port in the East China Sea. The port sees an average of about 120 vessels entering and leaving daily, encompassing three types: large ocean-going fishing vessels, medium-sized near-shore fishing vessels, and small coastal fishing vessels. The vessels have varying hull paint schemes, and their names are significantly affected by factors such as lighting, weather, and vessel attitude, making name identification quite challenging. Based on the aforementioned training method, the researchers constructed a complete region extraction system for the names of fishing vessels.
[0198] First, researchers collected 12,000 high-resolution images of fishing boats, including 4,000 images taken on sunny days, 3,500 on cloudy days, 2,500 on rainy days, 1,200 at night, and 800 in foggy conditions. The images were all uniformly set at 1920×1080 pixels, covering different lighting conditions, shooting angles, and boat types. Through manual annotation, the precise coordinates of the boat name area in each image were determined, and the images were then filtered based on visibility scores. The basic information of the annotated dataset is shown in Table 1.
[0199] Table 1. Basic Information of the Annotated Dataset
[0200] Data types Quantity (sheets) Average ship name area size (pixels) Average visibility score large ships 3600 128×45 0.87 medium-sized vessels 5400 64×24 0.72 small boats 3000 32×12 0.53 Sunny Day Data 4000 85×32 0.88 Cloudy data 3500 82×31 0.76 Rainy day data 2500 79×29 0.61 Nighttime data 1200 75×27 0.42 Foggy Day Data 800 73×26 0.39
[0201] During the physical modeling phase, researchers measured the refractive index and reflectivity of the hull coatings of different types of fishing vessels and recorded the relationship between the incident angle and the effective contrast of the vessel name under various lighting conditions. The parameter settings for the physical model of the vessel name light reflection established using the Fresnel reflection equation are shown in Table 2.
[0202] Table 2. Parameters of the Physical Model for Light Reflection of Ship Names
[0203] Parameter type Numerical range Measurement / Setting Method Refractive index of hull coating 1.42~1.65 Refractometer measurement angle of incidence 0°~85° 5° interval sampling Hull coating thickness 75~180μm Coating thickness gauge measurement Ambient light intensity (sunny day) 8000-12000 lux Photometer measurement Ambient light intensity (cloudy day) 1500-3000 lux Photometer measurement Ambient light intensity (rainy day) 800-1500 lux Photometer measurement Ambient light intensity (nighttime) 150-300 lux Photometer measurement Atmospheric attenuation coefficient (sunny day) 0.12 km -1 ]] Meteorological data Atmospheric attenuation coefficient (foggy weather) <![CDATA[0.85km -1 ]]> Meteorological data
[0204] The researchers divided the collected data into training, validation, and test sets in a 7:2:1 ratio and constructed the model architecture according to the configuration shown in Table 3:
[0205] Table 3 Model Architecture Configuration Table
[0206] Network components Configuration parameters Function Description backbone network Remaining network 50 Feature extraction Feature pyramid hierarchy P2~P6 (5th floor) Multi-scale feature representation P2 layer feature map size 1 / 4 of the input High-resolution features P6 layer feature map size 1 / 64 of the input Low-resolution features Number of feature channels 256 Unified feature dimension Number of detection head networks 3 For different sizes Small goal definition <32×16 pixels Detection difficulties
[0207] Model prototype Figure 2 As shown, the model employs a three-stage training strategy. In the first stage, the backbone network parameters are fixed, and only the feature pyramid network and the detector head network are trained, with a learning rate set to 10. -3 The training process is repeated for 30 epochs; in the second phase, the remaining 50 high-level layers of the network are unfrozen, and the feature extraction and detection modules are jointly trained, with the learning rate reduced to 10%. -4 The training lasted for 20 cycles; in the third stage, the entire network was unfrozen for end-to-end fine-tuning, and the learning rate was further reduced to 10%. -5 The training was conducted for 10 cycles. The trend of loss changes during the training process is shown in Table 4:
[0208] Table 4. Loss Changes During Model Training
[0209] Training phase Initial total loss Total losses ended Classification loss change Changes in regression loss Phase 1 3.74 1.26 2.31→0.82 1.43→0.44 Phase Two 1.26 0.58 0.82→0.39 0.44→0.19 Phase Three 0.58 0.31 0.39→0.20 0.19→0.11
[0210] On the validation set, researchers analyzed the feature distribution of falsely detected samples and found that the error rate was highest for small-sized ship name numbers and ship name numbers under strong reflective conditions. To address this issue, a gradient weighting method was applied to adjust the importance weights of difficult samples. The weight coefficients for different types of samples are shown in Table 5.
[0211] Table 5 Sample Weight Adjustment Coefficients
[0212] Sample type Weighting coefficient Sample proportion Small sample size (16×8 pixels) 2.0 8.7% Small sample size (24×10 pixels) 1.63 12.4% Small sample size (32×12 pixels) 1.41 18.2% Low contrast samples (contrast < 0.4) 1.5 15.8% Complex background samples (complexity > 0.7) 1.3 21.3% normal samples 1.0 23.6%
[0213] The performance metrics of the model after weight adjustment on the test set are shown in Table 6:
[0214] Table 6. Model Performance Evaluation Results
[0215]
[0216] Finally, the researchers optimized the model to address the issues identified during the testing phase. The main optimization measures included: increasing the channel weight coefficients of the P2 layer feature maps to 1.2, adding local response normalization processing, and introducing channel attention and spatial attention mechanisms into the detection head network. Table 7 shows the performance comparison of the model before and after optimization under different conditions.
[0217] Table 7 Performance Comparison Before and After Model Optimization
[0218] Test conditions F1 score before optimization Optimized F1 score Increase Small ship name 0.809 0.872 7.79% Strong light reflection on sunny days 0.793 0.886 11.73% Low contrast in rainy weather 0.745 0.821 10.20% Low light conditions at night 0.712 0.804 12.92% Foggy conditions 0.684 0.776 13.45% Complex background interference 0.762 0.845 10.89%
[0219] Traditional methods for identifying fishing vessel names primarily rely on region-based convolutional neural networks (R-CNN, FastR-CNN, etc.). These methods perform poorly when dealing with small targets and complex lighting conditions, with detection accuracies generally between 0.7 and 0.8, and they exhibit poor adaptability to environmental changes. In contrast, the multi-scale feature fusion architecture proposed in this invention, combining a feature pyramid network and a path aggregation network, significantly enhances the detection capability for small vessel names through top-down and bottom-up feature transfer paths. Simultaneously, the introduction of a Fresnel reflection physical model to quantify the visibility of vessel names under different lighting conditions, combined with a feature matching algorithm constructed using optimal transmission theory, greatly improves the model's generalization ability under various lighting and weather conditions. In particular, the introduction of gradient weighting and attention mechanisms for difficult examples improves the model's F1 score for small vessel name detection from approximately 0.65 in traditional methods to 0.872, and the F1 score under complex lighting conditions from approximately 0.6 to over 0.8, resulting in an overall improvement in detection accuracy of approximately 20%. The system can adapt to various complex environmental conditions in practical applications, providing reliable technical support for maritime supervision.
[0220] It should be noted that the variables involved in this invention are explained in detail in Tables 8 and 9 below.
[0221] Table 8. Variable Explanation Table (Part 1)
[0222]
[0223] Table 9. Variable Explanation Table (Part Two)
[0224]
[0225]
[0226] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A training method for a model of extracting the vessel name regions of fishing vessels entering and leaving ports, characterized in that, include: A multi-scale feature fusion architecture combining a feature pyramid network and a path aggregation network was constructed to form a prototype model for extracting the vessel name regions of fishing vessels entering and leaving the port. The detection capability of small vessel name regions was enhanced by top-down and bottom-up feature transfer paths. Images of fishing vessels entering and leaving the port were collected and the vessel name regions were labeled. A physical model of light reflection from the vessel name regions was established. A feature matching algorithm was constructed by applying optimal transmission theory. Divide the training dataset; design a three-stage training strategy; Calculate the average accuracy of the model on the validation set and optimize the model performance; process test set images using the trained model and evaluate the model effect; fine-tune the model parameters based on the test results to form the final model for extracting the name and number regions of fishing vessels entering and leaving the port. The specific steps for establishing the physical model of the ship's name light reflection are as follows: the reflectivity of the ship's name surface under different lighting conditions is calculated based on the Fresnel reflection equation. The input parameters include the incident angle of light, the refractive index of the ship's hull material, the thickness of the ship's hull coating, the ambient light intensity, and the wavelength of light. The output is the effective contrast value of the ship's name area. The specific steps of constructing the feature matching algorithm using the optimal transmission theory are as follows: based on the spectral distribution of the visual features of the ship name, the optimal transmission theory is applied to construct the feature matching algorithm, transforming the problem into Wasserstein distance calculation, minimizing the distribution difference between the source domain feature distribution and the target domain feature distribution, and improving the model's generalization ability. The three-stage training strategy is designed as follows: the first stage uses the basic training set to train the backbone network of the model; the second stage introduces the enhanced training set to fine-tune the detector head network; and the third stage performs end-to-end full network optimization training. The physical model for the reflection of light from the ship's name is specifically represented as follows: ; ; ; ; In the formula, denoted as s-polarized light reflectance, with a value ranging from 0 to 1; is the reflectivity of p-polarized light, with a value ranging from 0 to 1; The total reflectance ranges from 0 to 1. The refractive index of air is 1.0 under standard atmospheric conditions. The refractive index of the hull material is 1.4 to 1.7, which is commonly used in coatings for fishing boats. The angle of incidence ranges from 0° to 90°. The angle of refraction is calculated using Snell's law; Based on Fresnel reflection calculations, and combined with coating thickness and ambient light intensity, the effective contrast value of the ship name area was calculated: ; ; ; ; In the formula, The effective contrast value ranges from 0 to 1. The maximum brightness value of the background for the ship's name area; The minimum brightness value for the ship name area; The effective intensity of the incident light; The reflectance of the background area; The reflectance of the area containing the ship's name; Ambient light intensity, measured in lux; Light source intensity, measured in lux; The angle between the direction of the light source and the surface normal; Atmospheric attenuation coefficient; This represents the distance light travels, measured in kilometers.
2. The training method for the fishing vessel name region extraction model for entering and leaving ports according to claim 1, characterized in that, The Feature Pyramid Network is a multi-scale feature extraction architecture for target detection. It achieves the fusion of features at different levels through top-down paths and lateral connections, effectively handling the detection problem of targets of different sizes. The Path Aggregation Network is an improved feature fusion network. It adds bottom-up path enhancement to the Feature Pyramid Network to form richer feature representations and enhance the detection capability of small targets.
3. The training method for the fishing vessel name region extraction model for entering and leaving ports according to claim 2, characterized in that, The Fresnel reflection equation is a physical equation describing the reflection and transmission behavior of light at the interface between two different media. In the extraction of ship name regions, it is used to simulate the influence of hull surface reflection on imaging quality under different lighting conditions.
4. The training method for the fishing vessel name region extraction model for entering and leaving ports according to claim 3, characterized in that, The optimal transmission theory is a mathematical theory that studies how to transform one probability distribution into another with minimal cost. In ship name recognition, it is applied to the alignment and domain adaptation problems of feature space, and achieves feature matching between different data distributions by solving the Wasserstein distance minimization problem.
5. The training method for the fishing vessel name region extraction model for entering and leaving ports according to claim 4, characterized in that, The detailed structure of the prototype model for extracting the vessel name regions of fishing vessels entering and leaving the port includes: using the remaining network 50 as the backbone network to extract multi-level features; constructing a five-layer feature pyramid on the backbone network, corresponding to five scale layers from P2 to P6; fusing features in each feature layer through top-down paths and lateral connections; then introducing a path aggregation network structure to add bottom-up paths and strengthen the representation of small-sized vessel name features; performing channel unification processing on the feature maps of each layer through 1×1 convolution; finally, setting up three parallel detection head networks to predict vessel name regions of large, medium, and small scales respectively, with each detection head network outputting the coordinates and confidence value of the vessel name region.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program instructions, which, when executed in a computer, are used to perform a training method for a fishing vessel name region extraction model according to any one of claims 1-5.
7. A training system for a model of extracting the vessel name regions of fishing vessels entering and leaving ports, characterized in that, The system includes the computer-readable storage medium of claim 6, wherein the system is any one of a computer, a server, or a microcontroller, the computer-readable storage medium is disposed within the system, and the system is provided with a microprocessor that executes the program instructions stored in the computer-readable storage medium.