Image adaptive adjustment method for unmanned aerial vehicle inspection of port equipment

CN122741774APending Publication Date: 2026-09-11TIANJIN RES INST FOR WATER TRANSPORT ENG M O T
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610871355.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-16
Publication Date
2026-09-11

AI Technical Summary

Technical Problem

[0005]为此,本发明提供用于港口设备无人机巡检的成像自适应调整方法,用以克服现有技术中在港口金属结构巡检场景下,常规自动曝光方法无法针对性处理强反光与深阴影并存的复杂光照环境,偏振角度调节依赖人工经验设定而难以根据实时光照变化进行动态优化,以及图像质量评价与成像参数调节相分离、缺乏以质量反馈为核心的闭环调控机制导致难以快速收敛至最优成像参数组合的问题

Benefits of technology

其一,本发明通过构建以轻量级卷积神经网络为骨干、以梯度幅值和信息熵联合驱动的图像质量评价模型,并以该模型输出的质量评分为反馈信号,结合强化学习决策模型对曝光参数和偏振角度进行闭环迭代调控,解决了现有技术中图像质量评价与成像参数调节相分离、缺乏以客观质量反馈为核心的自主决策机制的问题,实现了面向港口金属结构微裂纹成像的全闭环自动化优化,提高了复杂光照条件下成像参数调节的准确性与自主性;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122741774A_ABST
    Figure CN122741774A_ABST
Patent Text Reader

Abstract

This invention proposes an adaptive imaging adjustment method for UAV inspection of port equipment, belonging to the field of imaging adjustment technology. Addressing the problems of existing technologies, such as inability to handle complex lighting environments, difficulty in dynamically optimizing polarization angle adjustment, and the separation of image quality evaluation and imaging parameter adjustment, lacking a closed-loop control mechanism, this invention constructs a lightweight convolutional neural network image quality evaluation model driven jointly by gradient magnitude and information entropy. It defines a three-dimensional state space including exposure parameters, polarization angle, and quality score, and five discrete adjustment actions. A deep Q-network is used to train the model to output the optimal adjustment action, which is then executed in closed-loop iterative control during UAV online inspection, supplemented by a maximum iteration count guarantee and a threshold adaptive adjustment mechanism. This invention improves the contrast and detail clarity of microcrack imaging in metal structures under complex lighting conditions, and enhances the automation and robustness of imaging parameter adjustment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of imaging adjustment technology, and in particular to an adaptive imaging adjustment method for UAV inspection of port equipment. Background Technology

[0002] With the rapid development of drone technology, its application in the inspection of large port equipment is becoming increasingly widespread. Drones, with their advantages of vertical takeoff and landing, low-altitude hovering, and flexible operation, can approach critical parts of port machinery such as quay cranes—high-altitude trusses, tie rod nodes, welds, and other areas difficult for humans to reach. By acquiring images of the metal structure surface using high-resolution visible light cameras, they can efficiently inspect for damage such as fatigue cracks. In this application scenario, image quality directly determines the accuracy of subsequent crack detection and identification. Imaging adaptive adjustment technology, as a key means to ensure image quality, focuses on adjusting camera exposure parameters and polarization angles in real time according to the lighting conditions of the shooting scene to enhance the contrast and detail clarity of the target area. With the continuous evolution of artificial intelligence technology, the combination of deep learning-based image quality evaluation and reinforcement learning-based parameter decision-making is becoming an important development direction in the field of imaging adaptive adjustment.

[0003] However, existing adaptive imaging adjustment methods still have significant shortcomings when facing port metal structure inspection scenarios. The surfaces of metal structures such as port quay cranes exhibit strong specular reflections, compounded by localized shadows from high-altitude areas, creating a complex imaging environment with extremely uneven lighting. Conventional automatic exposure methods typically adjust the average brightness of the entire image, lacking targeted processing for reflective areas of the metal, making it difficult to clearly present the morphological characteristics of microcracks under conditions of strong reflections and deep shadows. Some existing methods introduce polarization imaging to suppress reflections, but the adjustment of the polarization angle often relies on manual experience or fixed-angle shooting, failing to dynamically optimize according to real-time lighting changes, resulting in unsatisfactory contrast between the crack area and the background. Furthermore, in existing technologies, image quality evaluation and imaging parameter adjustment are usually two separate processes, lacking a closed-loop control mechanism centered on image quality feedback. This makes it difficult to quickly converge to the optimal imaging parameter combination within a limited number of shots, affecting inspection efficiency and crack detection rate.

[0004] Therefore, this invention is proposed. Summary of the Invention

[0005] To address these issues, this invention provides an adaptive imaging adjustment method for UAV inspection of port equipment. This method overcomes the problems in existing technologies where conventional automatic exposure methods cannot specifically handle complex lighting environments with both strong reflections and deep shadows in port metal structure inspection scenarios. Furthermore, polarization angle adjustment relies on manual experience and is difficult to dynamically optimize based on real-time lighting changes. Additionally, image quality evaluation and imaging parameter adjustment are separated, and the lack of a closed-loop control mechanism centered on quality feedback makes it difficult to quickly converge to the optimal combination of imaging parameters.

[0006] To achieve the above objectives, the present invention provides an imaging adaptive adjustment method for UAV inspection of port equipment, comprising: S1, Construct an image quality evaluation model based on a lightweight convolutional neural network; S2, acquire image samples of the metal surface under different exposure parameters and polarization angles, calculate the gradient magnitude and information entropy of the image samples, and train the image quality assessment model based on the gradient magnitude and information entropy so that the image quality assessment model learns the mapping relationship from image to quality score; S3, Construct a reinforcement learning decision model, and train the reinforcement learning decision model using a reinforcement learning algorithm, so that the reinforcement learning decision model learns the imaging parameter adjustment actions to improve the quality score; S4. When the UAV is conducting inspections, images are acquired using initial imaging parameters and input into the image quality evaluation model to generate an initial quality score. S5, the initial quality score and initial imaging parameters are combined to form a state vector, which is then input into the reinforcement learning decision model to obtain the imaging parameter adjustment action; S6, adjust the imaging parameters of the UAV according to the imaging parameter adjustment action, acquire the image according to the adjusted imaging parameters, and input it into the image quality evaluation model to generate a corrected quality score; S7 iterates through S4 to S6 until the quality score reaches the preset score threshold, and the image with the quality score reaching the preset score threshold is used as the output image.

[0007] Furthermore, the image quality evaluation model takes a single frame of metal surface image as input and outputs a quality score to characterize the contrast and detail clarity of the crack area.

[0008] Furthermore, the lightweight convolutional neural network uses MobileNetV3 as the backbone network, and after removing the fully connected layers, it replaces them with a global average pooling layer and two fully connected layers, outputting a quality score with a value between 0 and 1.

[0009] Furthermore, image samples of the metal surface under different exposure parameters and polarization angles are acquired, the gradient magnitude and information entropy of the image samples are calculated, and the image quality assessment model is trained based on the gradient magnitude and information entropy to enable the image quality assessment model to learn the mapping relationship from image to quality score, including: S21, perform grayscale processing and Gaussian filtering to denoise the image samples to obtain the preprocessed image; S22, calculate the average gradient magnitude and the information entropy of the grayscale histogram for each preprocessed image, normalize the average gradient magnitude and information entropy to the [0,1] interval respectively, and perform weighted summation according to preset weights to generate a comprehensive quality score, which serves as the supervision label for the image samples; S23, input the image sample into the lightweight convolutional neural network to obtain the prediction quality score output by the lightweight convolutional neural network; S24, using the mean squared error between the predicted quality score and the supervision label as the loss function, the gradient of the loss function with respect to the parameters of the lightweight convolutional neural network is calculated through backpropagation, and the parameters of the lightweight convolutional neural network are updated along the gradient direction using stochastic gradient descent. The training is iterated until the loss function converges, and the trained image quality evaluation model is obtained.

[0010] Furthermore, the construction of a reinforcement learning decision model and the training of the reinforcement learning decision model using a reinforcement learning algorithm, so that the reinforcement learning decision model learns imaging parameter adjustment actions to improve quality scores, includes: S31, Define a state space, which includes the current exposure parameters, the current polarization angle, and the quality score output by the image quality evaluation model for the current image; S32, Define the action space, which is a discrete set of actions, including at least: increasing the exposure value, decreasing the exposure value, rotating the polarizer in the forward direction to increase the polarization angle, rotating the polarizer in the reverse direction to decrease the polarization angle, and keeping the current imaging parameters unchanged; S33, define a reward function that uses the difference between the quality score of the image obtained after the adjustment action and the quality score of the image before the adjustment action as the reward value, and applies a negative penalty when the image is overexposed or underexposed. S34. A deep Q-network algorithm is adopted, with the state vector of the state space as input and the state-action value corresponding to each adjustment action in the action space as output. Through an ε-greedy strategy, the adjustment action is randomly selected with probability ε, and the adjustment action with the highest state-action value among the currently learned strategies is selected with probability 1-ε, balancing random exploration and strategy utilization. It interacts with UAV imaging to collect an experience sample consisting of the current state, the executed adjustment action, the reward value calculated according to the reward function, and the next state entered after executing the adjustment action, and stores the experience sample in the experience replay buffer. Batch experience samples are randomly sampled from the experience replay buffer, the temporal difference error is calculated, the parameters of the deep Q-network are updated by gradient descent, and iterative training is performed until convergence to obtain the trained reinforcement learning decision model.

[0011] Furthermore, the iterative execution of S4 to S6 also includes: The maximum number of iterations is preset to N; After each execution of S6 to generate a corrected quality score, the current iteration number is compared with the maximum iteration number N; If the corrected quality score still does not reach the preset score threshold when the current iteration number reaches the maximum iteration number N, then the iteration stops, and the image with the highest quality score output by the image quality evaluation model is selected as the output image from all images obtained in previous iterations.

[0012] Furthermore, during the iterative execution of S4 to S6, the process also includes making a reasonable judgment and adjustment on the preset scoring threshold, including: Record the quality score output by the image quality assessment model in each iteration to form a quality score sequence; When the number of iterations reaches the preset monitoring window length M, calculate the mean and variance of the quality scores corresponding to the most recent M iterations; If the mean does not show an upward trend for K consecutive monitoring windows and the variance is lower than the preset fluctuation threshold, it is determined that the current imaging parameter adjustment has converged to a stable state. After determining that convergence has reached a stable state, if the maximum value of the quality score in the current iteration is still lower than the preset score threshold, it is determined that the preset score threshold is set too high, and the preset score threshold is automatically adjusted to the sum of the maximum value of the quality score in the current iteration and the preset tolerance value. Continue executing S7 using the adjusted preset scoring threshold.

[0013] Furthermore, the gradient magnitude is the average pixel gray-level change rate calculated using the Sobel operator on the preprocessed image, used to characterize the image edge sharpness; the information entropy refers to the entropy value calculated from the gray-level histogram of the preprocessed image, used to characterize the richness of image texture information.

[0014] Furthermore, the state-action value in the deep Q-network algorithm is an evaluation value output by the deep Q-network, taking the state vector and adjustment action as input, to measure the expected cumulative reward that can be obtained by performing the adjustment action in the current state; the experience replay buffer is a data cache used to store the experience samples during training, and batches of experience samples are randomly sampled from it to break the temporal correlation between training data; the temporal difference error is the difference between the deep Q-network's estimate of the current state-action value and the target estimate calculated based on the reward value and the next state-action value, used to drive the gradient descent update of the deep Q-network parameters.

[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: Firstly, this invention constructs an image quality evaluation model with a lightweight convolutional neural network as its backbone and driven by gradient magnitude and information entropy. The quality score output by this model is used as a feedback signal, and a reinforcement learning decision model is combined to perform closed-loop iterative control of exposure parameters and polarization angle. This solves the problems of separation between image quality evaluation and imaging parameter adjustment and lack of an autonomous decision-making mechanism with objective quality feedback as the core in the existing technology. It realizes fully closed-loop automated optimization for imaging microcracks in port metal structures and improves the accuracy and autonomy of imaging parameter adjustment under complex lighting conditions. Secondly, this invention incorporates the polarization angle and exposure parameters into the action space of the reinforcement learning decision model. It uses five discrete adjustment actions, including increasing the exposure value, decreasing the exposure value, rotating the polarizer in the forward direction, rotating the polarizer in the reverse direction, and keeping the current parameters unchanged, to perform joint optimization. This solves the problem in the prior art that the polarization angle depends on manual experience and cannot be dynamically and adaptively adjusted according to real-time lighting changes and the reflectivity of the metal surface. It achieves synergistic optimization of exposure compensation and polarization anti-reflection, and improves the image contrast and detail recognition of the microcrack area under the condition of strong reflection and deep shadow. Third, this invention organically integrates offline training of the image quality evaluation model, interactive training of the reinforcement learning decision model, and adaptive closed-loop control of UAV online inspection. It also incorporates a maximum iteration count guarantee mechanism and a preset scoring threshold rationality judgment and adaptive adjustment mechanism to construct an imaging adaptive adjustment method covering the entire process of model training, online decision-making, and anomaly handling. This solves the problem in existing technologies where imaging parameter adjustment easily falls into infinite iteration or outputs invalid images under extreme lighting conditions, thus improving the robustness, practicality, and operational efficiency of the UAV inspection imaging system for port equipment under various lighting conditions. Attached Figure Description

[0016] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0017] Figure 1 The flowchart illustrates the imaging adaptive adjustment method for UAV inspection of port equipment provided in this embodiment of the invention. Detailed Implementation

[0018] To make the objectives and advantages of the present invention clearer, the present invention will be further described below with reference to embodiments; it should be understood that the specific embodiments described herein are merely for explaining the present invention and are not intended to limit the present invention.

[0019] Preferred embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.

[0020] It should be noted that in the description of this invention, the terms "upper", "lower", "left", "right", "inner", "outer", etc., which indicate directions or positional relationships, are based on the directions or positional relationships shown in the accompanying drawings. This is only for the convenience of description and is not intended to indicate or imply that the device or element must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation of this invention.

[0021] Furthermore, it should be noted that, in the description of this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0022] Example 1 like Figure 1 As shown, this invention provides an adaptive imaging adjustment method for UAV inspection of port equipment. include: S1, Construct an image quality evaluation model based on a lightweight convolutional neural network; The image quality assessment model takes a single frame of metal surface image as input and outputs a quality score to characterize the contrast and detail clarity of the crack area.

[0023] The lightweight convolutional neural network uses MobileNetV3 as the backbone network. After removing the fully connected layers, it replaces them with global average pooling layers and two fully connected layers, and outputs a quality score with a value between 0 and 1.

[0024] In one possible implementation, MobileNetV3-Small is selected as the backbone network. MobileNetV3-Small is a lightweight convolutional neural network designed specifically for mobile and embedded devices. Its core modules employ depthwise separable convolutions and inverse residual structures, and introduce a lightweight Squeeze-and-Excitation attention mechanism, achieving good feature extraction capabilities while maintaining low computational overhead. The pre-trained weights for this network on the ImageNet dataset are publicly available, and this embodiment uses these pre-trained weights as initialization parameters to accelerate model convergence.

[0025] The structure of MobileNetV3-Small was modified by removing the fully connected classification layer at the end of the original network, while retaining the convolutional layers and inverse residual modules at the front end used for feature extraction. After the last convolutional layer, a global average pooling layer, a fully connected layer with 128 neurons, a ReLU activation function, and a fully connected layer with 1 neuron were added sequentially, finally connected by a Sigmoid activation function. The output range of the Sigmoid activation function is (0,1), so the model ultimately outputs a continuous value between 0 and 1, which is the quality score. A higher value indicates stronger contrast and better detail clarity in the cracked areas of the image.

[0026] After the model is built, a single-frame image of a metal surface is used as input. Before being fed into the network, the input image is uniformly scaled to 224×224 pixels and pixel values ​​are normalized by dividing the pixel values ​​of each channel by 255 and standardizing according to the mean and standard deviation of the ImageNet dataset. After forward propagation, the model outputs a scalar value, which is the quality score characterizing the contrast and detail sharpness of the crack area in the input image. For example, an image with sharp crack edges and clear texture can achieve a quality score of 0.85 or higher; while an image with overexposed crack areas and lost detail due to metal reflection may have a quality score below 0.30.

[0027] This invention constructs an image quality evaluation model that uses a lightweight convolutional neural network, MobileNetV3, as the backbone network. After removing the fully connected layers, it replaces them with a global average pooling layer and two fully connected layers, outputting a quality score with values ​​ranging from 0 to 1. This model takes a single frame of metal surface image as input and evaluates the contrast and detail clarity of the crack area. It solves the problem of the lack of objective and real-time evaluation methods for microcrack imaging quality of port metal structures in the existing technology, and improves the accuracy and computational efficiency of crack image quality evaluation under complex lighting conditions.

[0028] S2, acquire image samples of the metal surface under different exposure parameters and polarization angles, calculate the gradient magnitude and information entropy of the image samples, and train the image quality assessment model based on the gradient magnitude and information entropy, so that the image quality assessment model learns the mapping relationship from image to quality score, including: S21, perform grayscale processing and Gaussian filtering to denoise the image samples to obtain the preprocessed image; S22, calculate the average gradient magnitude and the information entropy of the grayscale histogram for each preprocessed image, normalize the average gradient magnitude and information entropy to the [0,1] interval respectively, and perform weighted summation according to preset weights to generate a comprehensive quality score, which serves as the supervision label for the image samples; S23, input the image sample into the lightweight convolutional neural network to obtain the prediction quality score output by the lightweight convolutional neural network; S24, using the mean squared error between the predicted quality score and the supervision label as the loss function, the gradient of the loss function with respect to the parameters of the lightweight convolutional neural network is calculated through backpropagation, and the parameters of the lightweight convolutional neural network are updated along the gradient direction using stochastic gradient descent. The training is iterated until the loss function converges, and the trained image quality evaluation model is obtained.

[0029] The gradient magnitude is the average rate of change of pixel grayscale values ​​calculated using the Sobel operator on the preprocessed image, used to characterize the edge sharpness of the image; the information entropy refers to the entropy value calculated from the grayscale histogram of the preprocessed image, used to characterize the richness of the image texture information.

[0030] In one possible implementation, a visible light camera mounted on a drone is used to photograph the surface of the metal structure of a port quay crane under different combinations of exposure parameters and polarization angles, collecting image samples of the metal surface including fatigue crack areas. The exposure parameters can be adjusted from shutter speeds of 1 / 500s to 1 / 2000s and ISO gains of 100 to 800, while the polarization angle can be adjusted from 0° to 90°, to cover various imaging conditions from underexposure to overexposure, and from no polarization to maximum anti-reflection effect. At least 500 image samples are collected, covering typical lighting scenarios such as strong reflections, localized shadows, and uniform illumination.

[0031] Each image sample is converted to grayscale using a weighted average method, calculated as: Gray = 0.299 × R + 0.587 × G + 0.114 × B, where Gray is the grayscale value, and R, G, and B are the pixel values ​​of the red, green, and blue channels of the image, respectively. After grayscale conversion, a 3 × 3 Gaussian filter with a standard deviation σ = 0.8 is used to perform convolutional denoising on the grayscale image, resulting in a preprocessed image. The purpose of Gaussian filtering denoising is to suppress the interference of image sensor noise on subsequent gradient and entropy calculations.

[0032] For each preprocessed image, its average gradient magnitude and the information entropy of its grayscale histogram are calculated. The average gradient magnitude is calculated as follows: the Sobel operator is used to calculate the gradient components Gx and Gy in the horizontal and vertical directions of the image, respectively. Then, the gradient magnitude √(Gx² + Gy²) is calculated for each pixel position. Finally, the arithmetic mean of the gradient magnitudes of all pixels is taken to obtain the average gradient magnitude G of the image. The average gradient magnitude reflects the overall edge sharpness of the image; the clearer the edges and the more distinct the contours of the cracked areas, the higher the value.

[0033] The information entropy is calculated as follows: First, the gray-level histogram of the preprocessed image is statistically analyzed, with gray levels ranging from 0 to 255, to obtain the frequency p(i) of each gray level i. Then, the information entropy is calculated according to the formula H = -Σ p(i)×log2(p(i)), where the summation iterates through all 256 gray levels, and this term is 0 when p(i) is 0. Information entropy reflects the richness of image texture information; the more crack details and the more complex the texture, the higher the value.

[0034] The calculated average gradient magnitude G and information entropy H are normalized to the interval [0,1]. The normalized average gradient magnitude and information entropy are then weighted and summed according to preset weights to generate a comprehensive quality score. The calculation formula is: Comprehensive Quality Score = α × Average Gradient Magnitude + (1-α) × Information Entropy, where the weight coefficient α can be selected as 0.5, meaning that the two are equally weighted. This comprehensive quality score serves as the supervision label for the image sample, with a value range of [0,1].

[0035] Image samples are scaled to 224×224 pixels and normalized before being input into an image quality assessment model using MobileNetV3 as the backbone network. The image quality assessment model calculates a predicted quality score within the range (0,1) through forward propagation. The predicted quality score Q is then used as the basis for the calculation. p With supervision label Q l The mean squared error (MSE) between the two sides is the loss function, i.e., Loss = (1 / B)×Σ(Q) p - Q l )², where B is the batch size for each training iteration, which can be 32. Stochastic gradient descent (SGD) is used for optimization, with an initial learning rate of 0.001, momentum factor of 0.9, and weight decay coefficient of 0.0001. During training, after each iteration through all training samples, the validation loss is calculated on the validation set. When the validation loss no longer decreases for 10 consecutive iterations, the loss function is considered converged, training is stopped, and the trained image quality evaluation model is obtained. The trained model can automatically output a quality score strongly correlated with the image quality jointly represented by gradient magnitude and information entropy for any input metal surface image.

[0036] This invention collects metal surface image samples under different exposure parameters and polarization angles, uses gradient magnitude to represent image edge sharpness and information entropy to represent the richness of image texture information, normalizes and weights the two to generate a comprehensive quality score as a supervision label, and uses mean square error as the loss function and stochastic gradient descent to iteratively train an image quality evaluation model based on MobileNetV3. This solves the problem of the lack of objective and automated evaluation model training methods for microcrack imaging quality of port metal structures in the existing technology. The trained model can automatically learn the accurate mapping relationship from image to quality score, avoiding the unreliability and non-repeatability of manual subjective scoring, and improving the accuracy and consistency of crack image quality evaluation under complex lighting conditions. At the same time, the model does not need to calculate gradient magnitude and information entropy again in the inference stage, and only needs a single forward propagation to output the quality score.

[0037] S3, Construct a reinforcement learning decision model, and train the reinforcement learning decision model using a reinforcement learning algorithm, so that the reinforcement learning decision model learns imaging parameter adjustment actions to improve quality scores, including: S31, Define a state space, which includes the current exposure parameters, the current polarization angle, and the quality score output by the image quality evaluation model for the current image; S32, Define the action space, which is a discrete set of actions, including at least: increasing the exposure value, decreasing the exposure value, rotating the polarizer in the forward direction to increase the polarization angle, rotating the polarizer in the reverse direction to decrease the polarization angle, and keeping the current imaging parameters unchanged; S33, define a reward function that uses the difference between the quality score of the image obtained after the adjustment action and the quality score of the image before the adjustment action as the reward value, and applies a negative penalty when the image is overexposed or underexposed. S34. A deep Q-network algorithm is adopted, with the state vector of the state space as input and the state-action value corresponding to each adjustment action in the action space as output. Through an ε-greedy strategy, the adjustment action is randomly selected with probability ε, and the adjustment action with the highest state-action value among the currently learned strategies is selected with probability 1-ε, balancing random exploration and strategy utilization. It interacts with UAV imaging to collect an experience sample consisting of the current state, the executed adjustment action, the reward value calculated according to the reward function, and the next state entered after executing the adjustment action, and stores the experience sample in the experience replay buffer. Batch experience samples are randomly sampled from the experience replay buffer, the temporal difference error is calculated, the parameters of the deep Q-network are updated by gradient descent, and iterative training is performed until convergence to obtain the trained reinforcement learning decision model.

[0038] In the Deep Q-Network algorithm, the State-Action Value (SAV) is an evaluation value output by the Deep Q-Network, taking the state vector and adjustment action as input, to measure the expected cumulative reward that can be obtained by performing the adjustment action in the current state. The Experience Replay Buffer is a data cache used to store the experience samples during training, and batches of experience samples are randomly sampled from it to break the temporal correlation between training data. The Temporal Difference Error is the difference between the Deep Q-Network's estimate of the current State-Action Value and the target estimate calculated based on the reward value and the next State-Action Value, and is used to drive the gradient descent update of the Deep Q-Network parameters.

[0039] In one possible implementation, a state space for the reinforcement learning decision model is defined, consisting of three components: the current exposure parameters, the current polarization angle, and the quality score output by the image quality assessment model for the currently acquired image. The current exposure parameters are normalized to the reciprocal of the shutter speed; for example, at a shutter speed of 1 / 500s, the exposure parameter value is 500 / 2000 = 0.25. The current polarization angle is normalized by dividing the actual angle value by 90°, with a value range of [0,1]. The quality score is a continuous value between 0 and 1 output by the image quality assessment model. These three components are concatenated into a three-dimensional state vector s = [E,θ,Q], where E represents the normalized exposure parameters, θ represents the normalized polarization angle, and Q represents the quality score. This state vector fully describes the current imaging conditions and image quality status, providing sufficient decision-making basis for the decision model.

[0040] The action space is defined as a set containing five discrete adjustment actions, and the actions and their meanings are shown in the table below: 0. Increase the exposure value and decrease the shutter speed by one stop, for example, from 1 / 1000s to 1 / 500s; 1. Decrease the exposure value and increase the shutter speed by one stop, for example, from 1 / 500s to 1 / 1000s; 2. Rotate the polarizer clockwise by a preset step size, such as 5°, to increase the polarization angle. 3. Rotate the polarizer in the opposite direction by a preset step size, such as 5°, to reduce the polarization angle. 4. Keep the current parameters unchanged, and do not make any adjustments to the current exposure parameters and polarization angle.

[0041] Define the reward function r, which is calculated as: r = Q new - Q old -λ·P; where Q new Q is used to score the quality of the image obtained after the adjustment action. old The quality score of the image before the adjustment action is performed; P is the overexposure or underexposure penalty, and λ is the penalty weight coefficient with a value of 0.1.

[0042] The method for determining overexposure or underexposure is to calculate a histogram of pixel grayscale values ​​for the current image and count the percentage P of pixels with grayscale values ​​in the range [0,10]. u The percentage of pixels with grayscale values ​​in the range [245, 255], P o If P o If the preset threshold is exceeded, in this embodiment, it is set to 15%, then the image is determined to be overexposed, and the penalty term P is set to 1; if P uIf the preset threshold is exceeded, in this embodiment, it is set to 15%, then the image is determined to be underexposed, and the penalty term P is set to 1; if neither exceeds the threshold, the penalty term P is set to 0.

[0043] The reward function is designed so that when the adjustment action improves the image quality score, the reward value is positive, which motivates the model to learn the adjustment in that direction; when the adjustment action causes the quality score to decrease, the reward value is negative, which inhibits the model from performing the adjustment in that direction again; when the image is overexposed or underexposed, even if the quality score is improved, the reward value will be reduced due to the existence of the penalty term, prompting the model to prioritize adjusting the image to the normal exposure range.

[0044] A deep Q-network (DQN) algorithm was used to train the reinforcement learning decision model. The DQN structure consists of an input layer that receives a three-dimensional state vector, followed by three fully connected layers with 64, 64, and 5 neurons respectively. The first two fully connected layers are followed by a ReLU activation function. The output layer outputs five real numbers, corresponding to the state-action values ​​of five regulatory actions. The state-action value is an evaluation value output by the DQN, taking the state vector and regulatory action as input, to measure the expected cumulative reward obtained by performing the regulatory action in the current state. A higher value indicates that the action is more beneficial in the long run.

[0045] The parameters of the deep Q-network are randomly initialized; the maximum capacity of the experience replay buffer is set to 10,000 experience samples; the initial exploration probability ε of the ε-greedy policy is set to 1.0, and gradually decays to 0.05 during training. In each training round, the camera begins acquiring images with random initial exposure parameters and polarization angle. The acquired images are input into the trained image quality assessment model to obtain the current quality score, and the current state vector s is constructed by combining the current exposure parameters and polarization angle.

[0046] Generate a random number between 0 and 1. If the random number is less than the current ε value, randomly select one of the five adjustment actions as the adjustment action to be executed, i.e., random exploration; otherwise, input the current state vector s into the deep Q network, calculate the state-action value corresponding to each action, and select the action with the largest state-action value as the adjustment action to be executed.

[0047] The selected adjustment action is executed. After adjustment, the image is captured again. The new image is input into the image quality evaluation model to obtain a new quality score. The reward value r of this adjustment is calculated according to the defined reward function. At the same time, the next state vector s' is constructed based on the new exposure parameters, polarization angle and quality score.

[0048] The experience samples (s, a, r, s') collected during this interaction are stored in the experience replay buffer, where s is the current state, a is the number of the executed adjustment action, r is the reward value, and s' is the next state entered after executing the adjustment action. When the number of experience samples stored in the experience replay buffer exceeds its maximum capacity, the oldest stored sample is automatically deleted.

[0049] Randomly sample 64 empirical samples from the empirical playback buffer. For each sampled empirical sample, calculate the timing difference error using the following formula: TD error = r + γ·max {a'} Q(s', a') - Q(s, a); Among them, TD error The time series difference error is represented by γ, which is a discount factor with a value of 0.95. {a'} Q(s', a') The deep Q-network maximizes the state-action value of all actions in the next state s'. Q(s, a) is the current estimate of the state-action value of the deep Q-network for performing action a in the current state s. The temporal difference error reflects the gap between the current estimate and the target estimate calculated based on the actual reward and subsequent states. The mean square value of the temporal difference error is used as the loss function, and the parameters of the deep Q-network are updated using gradient descent with a learning rate of 0.0005.

[0050] Repeat the above steps, with each training round containing 50 imaging parameter adjustment steps. After each training round, multiply the ε value by a decay factor of 0.995 to gradually reduce the exploration probability. When the average reward value no longer increases after 100 consecutive training rounds, the training is considered converged, and the trained reinforcement learning decision model is obtained. The trained reinforcement learning decision model can take the current state vector as input and output the state-action value of each adjustment action. By selecting the action with the highest value, it can achieve adaptive optimization decisions on exposure parameters and polarization angle under complex lighting conditions.

[0051] This invention defines a three-dimensional state space containing current exposure parameters, current polarization angle, and image quality score, and an action space containing five discrete adjustment actions: increasing exposure value, decreasing exposure value, rotating the polarizer forward, rotating the polarizer backward, and keeping the current parameters unchanged. It also designs a reward function combining changes in quality score with overexposure and underexposure penalties, and employs a deep Q-network algorithm and an ε-greedy strategy for interactive training. This addresses the problems in existing technologies, such as polarization angle dependence on manual experience setting, separation of image quality evaluation and imaging parameter adjustment, and lack of a closed-loop autonomous decision-making mechanism centered on quality feedback. The trained reinforcement learning decision model can automatically select the optimal adjustment action based on real-time lighting conditions, improving the autonomy and accuracy of imaging parameter adjustment under complex lighting conditions, reducing reliance on manual experience, and ensuring that the model fully explores parameter combinations under various lighting conditions through a balanced training mechanism of random exploration and strategy utilization. This enhances the model's adaptability to changing lighting environments and provides an intelligent decision-making method for UAV port inspection that quickly converges to the optimal imaging parameter combination.

[0052] S4. When the UAV is conducting inspections, images are acquired using initial imaging parameters and input into the image quality evaluation model to generate an initial quality score. S5, the initial quality score and initial imaging parameters are combined to form a state vector, which is then input into the reinforcement learning decision model to obtain the imaging parameter adjustment action; S6, adjust the imaging parameters of the UAV according to the imaging parameter adjustment action, acquire the image according to the adjusted imaging parameters, and input it into the image quality evaluation model to generate a corrected quality score; S7 iterates through S4 to S6 until the quality score reaches the preset score threshold, and the image with the quality score reaching the preset score threshold is used as the output image.

[0053] In one possible implementation, a drone equipped with a high-resolution visible light camera and a rotatable polarizer flies to an altitude of approximately 3 to 5 meters above the front tie rod node area of ​​a port quay crane to take close-up photographs of the metal structure surface in this area. This area experiences both strong specular reflection from direct sunlight and localized shadowing, and the crack width is approximately 0.15 mm to 0.3 mm, typical of microcracks, making it difficult to image clearly with fixed imaging parameters. After reaching the target shooting position, the drone captures the first frame image using preset initial imaging parameters. These initial imaging parameters are chosen from intermediate values, such as a shutter speed of 1 / 800 s and a polarization angle of 45°. The acquired image is scaled to 224 × 224 pixels and normalized before being input into a trained image quality assessment model. The image quality assessment model calculates a quality score, denoted as Q, through forward propagation. i Under the current lighting conditions, Qi The score is 0.45, which is lower than the preset scoring threshold of 0.85, indicating that the contrast and detail clarity of the cracked area in the image do not meet the requirements and the imaging parameters need to be adjusted.

[0054] The obtained initial quality score and initial imaging parameters, namely the normalized exposure parameter E and the normalized polarization angle θ, are used to form a three-dimensional state vector s = [0.40, 0.50, 0.45]. This state vector is then input into a trained reinforcement learning decision model. The deep Q-network of the reinforcement learning decision model performs forward propagation calculations on this state vector, outputting the state-action values ​​corresponding to five adjustment actions. For example: Action 0: Increase exposure value, Q value = 0.12; Action 1: Reduce the exposure value; Q value = 0.08. Action 2: Rotate the polarizer in the forward direction, Q value = 0.35; Action 3: Reverse rotation of the polarizer, Q value = -0.05; Action 4: Keep the current parameters unchanged, Q value = 0.0.

[0055] Among the actions, action 2 has the highest state-action value, indicating that increasing the polarization angle is most beneficial for improving image quality in the current highly reflective scene. Therefore, the reinforcement learning decision model outputs action 2 as the imaging parameter adjustment action for this instance. The imaging system on the UAV receives the instruction of action 2 and rotates the polarizer clockwise by a preset step of 5°, adjusting the polarization angle from 45° to 50°. The exposure parameters remain unchanged at 1 / 800s. After the adjustment, the camera captures another frame. The newly captured image is input into the image quality evaluation model to obtain the corrected quality score Q. new Assuming that after adjusting the polarization angle, the specular reflection component of the metal surface is suppressed, the contrast between the crack area and the background is improved, and the quality score Q is corrected. new =0.62.

[0056] Since the corrected quality score is still below the preset score threshold of 0.85, iterative execution of steps S4 to S6 is required. Using the current exposure parameters E=0.40, the current polarization angle θ=0.56, and the corrected quality score of 0.62, a new state vector s' = [0.40, 0.56, 0.62] is formed and input into the reinforcement learning decision model again to obtain the next adjustment action. Assuming that after the first iteration, the current lighting conditions still require further enhancement of crack contrast, the reinforcement learning decision model outputs action 0 based on the updated state vector, adjusting the shutter speed from 1 / 800s to 1 / 640s. After executing this action, the image is captured again and evaluated, and the quality score improves to 0.73.

[0057] The above process is iterated continuously. In each iteration, the reinforcement learning decision model selects the optimal adjustment action based on the latest state vector. After the camera executes the action, it re-captures and evaluates the image. Assuming that after four iterations, the imaging parameters are adjusted to a shutter speed of 1 / 500s and a polarization angle of 55°, the image quality evaluation model outputs a quality score of 0.87, exceeding the preset score threshold of 0.85, at which point the iteration terminates. The image with this quality score reaching the preset threshold is used as the final output image. In this image, the edges of the microcracks are clearly discernible, and the contrast meets the requirements for subsequent pixel-level crack segmentation and quantization.

[0058] This invention deploys a trained image quality evaluation model and a reinforcement learning decision model in the online inspection process of UAVs. It acquires images with initial imaging parameters and generates an initial quality score. The initial quality score and the initial imaging parameters are combined to form a state vector, which is then input into the reinforcement learning decision model to obtain imaging parameter adjustment actions. After executing the adjustment actions, images are acquired again and a corrected quality score is generated. Iterative closed-loop control is performed with the quality score reaching a preset score threshold as the termination condition. This solves the problems of existing technologies, such as the separation of image quality evaluation and imaging parameter adjustment, the reliance on manual experience for trial and error in imaging parameter adjustment, and the lack of an automated iterative convergence mechanism driven by quality feedback. It achieves complete closed-loop autonomous optimization of imaging parameters, improves the automation and efficiency of UAV port inspection imaging parameter adjustment under complex lighting conditions, and significantly shortens the number of shots and time required to obtain high-quality images that meet the requirements for crack detection. Iterative execution of S4 to S6 also includes: The maximum number of iterations is preset to N; After each execution of S6 to generate a corrected quality score, the current iteration number is compared with the maximum iteration number N; If the corrected quality score still does not reach the preset score threshold when the current iteration number reaches the maximum iteration number N, then the iteration stops, and the image with the highest quality score output by the image quality evaluation model is selected as the output image from all images obtained in previous iterations.

[0059] During the iterative execution of S4 to S6, the process also includes making a reasonable judgment and adjustment on the preset scoring threshold, including: Record the quality score output by the image quality assessment model in each iteration to form a quality score sequence; When the number of iterations reaches the preset monitoring window length M, calculate the mean and variance of the quality scores corresponding to the most recent M iterations; If the mean does not show an upward trend for K consecutive monitoring windows and the variance is lower than the preset fluctuation threshold, it is determined that the current imaging parameter adjustment has converged to a stable state. After determining that convergence has reached a stable state, if the maximum value of the quality score in the current iteration is still lower than the preset score threshold, it is determined that the preset score threshold is set too high, and the preset score threshold is automatically adjusted to the sum of the maximum value of the quality score in the current iteration and the preset tolerance value. Continue executing S7 using the adjusted preset scoring threshold.

[0060] In one possible implementation, a drone conducts close-range inspections of the high-altitude weld area at the connection between the main beam and the column of a port quay crane. This area is in shadow, and the weld surface is covered with rust, resulting in extremely poor lighting conditions. The preset scoring threshold is set to 0.85, the preset maximum number of iterations N is set to 20, the monitoring window length M is set to 5, the number of consecutive monitoring windows K required for convergence determination is set to 3, the preset fluctuation threshold is set to 0.005, and the preset tolerance value is set to 0.03.

[0061] During the iterative execution of steps S4 to S6, after each completion of step S6 and the generation of a corrected quality score, the system automatically compares the current number of iterations with the preset maximum number of iterations N=20. In this embodiment, under the combined influence of extreme backlighting and rust coverage, even after 20 iterations, the highest quality score is only 0.68, consistently failing to reach the preset score threshold of 0.85. When the 20th iteration is completed and the system detects that the current number of iterations equals the preset maximum number of iterations N=20, the iteration is forcibly stopped. From the images acquired in all 20 iterations, the quality score output by the image quality evaluation model for each frame is retrieved. The image acquired in the 15th iteration has the highest quality score of 0.72. Although the crack area in this frame does not fully achieve ideal contrast, its edge sharpness and texture details are the best across all iterations. The system selects this frame as the final output image for subsequent crack segmentation and quantitative analysis.

[0062] In another inspection scenario, a drone photographed the area of ​​the tie rod node of the quay crane. The preset scoring threshold was also set to 0.85, the monitoring window length M=5, the number of consecutive monitoring windows K=3, the fluctuation threshold=0.005, and the tolerance value=0.03. After the iteration began, the quality score output by the image quality assessment model in each iteration was recorded, forming a quality score sequence. When the iteration reached the 5th iteration, i.e., the preset monitoring window length M=5 was reached for the first time, the mean and variance of the quality scores corresponding to the most recent 5 iterations were calculated. The mean was 0.59, and the variance was calculated to be approximately 0.013. Since there was only data from one monitoring window at this point, it was not yet possible to determine the trend of consecutive windows, so the iteration continued.

[0063] After each new iteration, the mean and variance of the most recent five quality scores are recalculated using a sliding window approach. By the 15th iteration, data from 11 monitoring windows have been accumulated. Backtracking analysis of the most recent three monitoring windows shows that, starting from the 12th iteration, the mean values ​​were 0.796, 0.796, 0.796, and 0.798 respectively, showing no significant upward trend for four consecutive monitoring windows (mean change less than 0.01). Simultaneously, the variance of each monitoring window was approximately 0.00005, far below the preset fluctuation threshold of 0.005, indicating that the imaging parameter adjustments have converged to a stable state, and further iterations would be unlikely to improve image quality further.

[0064] After determining that convergence has reached a stable state, the maximum quality score in the current 15 iterations is retrieved, and it is found to be 0.80. This maximum value of 0.80 is still lower than the preset score threshold of 0.85, satisfying the criterion that the maximum quality score in the current iterations is still lower than the preset score threshold. Based on this, it is determined that the preset score threshold is set too high, and the preset score threshold is automatically adjusted to the sum of the current maximum value and the preset tolerance value, i.e., 0.80 + 0.03 = 0.83.

[0065] After adjustment, the iteration termination judgment of S7 is continued with a new preset scoring threshold of 0.83. Since the quality score of the existing image is still lower than the new threshold of 0.83, the iteration continues. After further fine-tuning, the quality score reaches 0.84 in the 17th iteration, exceeding the adjusted threshold of 0.83, and the iteration terminates, with this frame image being used as the output image.

[0066] The two mechanisms described above operate in tandem during the iterative execution of S7. After each iteration, it first checks whether the preset scoring threshold has been reached, while simultaneously checking whether the number of iterations has reached the maximum number of iterations N, and periodically performs a reasonableness judgment on the preset scoring threshold. If a satisfactory image is successfully output after threshold adjustment within the maximum number of iterations, this image is used as the final output; if the image still fails to meet the standard due to poor imaging conditions even after threshold adjustment, the historical best image is output by the backup mechanism when the maximum number of iterations is reached. These two mechanisms together ensure the robust operation of the system under various lighting conditions.

[0067] A crack type discrimination model based on a lightweight convolutional neural network is constructed. The model takes a single frame of a metal surface image as input and outputs a first probability that the crack belongs to external paint cracking and a second probability that it belongs to internal metal cracking. Metal surface image samples containing both external paint cracking and internal metal cracking are collected. Each image sample is labeled with a crack type, and data augmentation is used to expand the sample size. The crack type discrimination model is then trained in a supervised manner based on the labeled image samples to learn the mapping relationship from crack images to crack types. The output image from step S7 is input into the trained crack type discrimination model to obtain the first and second probabilities. If the first probability is greater than the second probability and exceeds a preset classification confidence threshold, the current crack is determined to be external paint cracking. If the second probability is greater than the first probability and exceeds the preset classification confidence threshold, the current crack is determined to be internal metal cracking. If neither the first nor the second probability exceeds the preset classification confidence threshold, the crack type is determined to be uncertain, and a prompt message is generated to trigger manual review.

[0068] In one possible implementation, the crack type discrimination model uses a lightweight convolutional neural network, MobileNetV2, as the backbone network. Following the backbone network are a global average pooling layer and two fully connected layers. The final layer uses a Softmax activation function to output the probability distributions for the two categories. When collecting external paint crack image samples, areas of crazing or linear cracking caused by temperature stress in the coating of port equipment are selected. These cracks typically have irregular serrated edges, visible primer or exposed metal substrate inside, and paint flakes around the cracks. When collecting internal metal crack image samples, real metal cracks caused by fatigue loads in port equipment are selected. These cracks typically have thin, straight lines or slightly curved shapes, sharp edges, reflective metallic characteristics inside, and relatively intact paint coatings on both sides of the crack. Each category has at least 800 samples, covering different lighting conditions, shooting angles, and crack widths. The data augmentation includes random rotation, random scaling, random cropping, brightness jitter, and contrast adjustment to simulate various imaging changes that may be encountered during UAV inspections and enhance the model's generalization ability.

[0069] Supervised training employs the cross-entropy loss function and the Adam optimizer. The initial learning rate is set to 0.0001, and the batch size is set to 32. During training, the classification accuracy is monitored on the validation set. Training stops when the validation accuracy no longer improves after 10 consecutive epochs, resulting in a trained crack type discrimination model. The preset classification confidence threshold is set to 0.75. When the first probability ≥ 0.75 and the first probability is greater than the second probability, the external paint cracking result is output; when the second probability ≥ 0.75 and the second probability is greater than the first probability, the internal metal cracking result is output; when both are below 0.75, the output type is uncertain, and a prompt suggesting manual review is recommended.

[0070] In this embodiment, the UAV inspects the weld area of ​​the main beam of the port quay crane. After adaptive imaging adjustments in steps S4 to S7, an output image with a clear crack contrast and a quality score of 0.88 is obtained. This image is input into the trained crack type discrimination model. After forward propagation calculation, the model outputs a first probability (external paint cracking) of 0.92 and a second probability (internal metal cracking) of 0.08. Since the first probability of 0.92 exceeds the preset classification confidence threshold of 0.75, and the first probability is significantly greater than the second probability, the system determines that the crack is external paint cracking. The system stores this determination result along with the image in the inspection report and generates a suggestion: the paint coating in this area is aging and cracking; it is recommended to arrange coating repair, and there is no need to repair the metal substrate by welding at this time.

[0071] In another possible implementation, a drone inspects the front tie rod node of the quay crane, outputting an image quality score of 0.91. The crack type discrimination model outputs a first probability of 0.15 and a second probability of 0.83. Since the second probability of 0.83 exceeds the preset classification confidence threshold of 0.75, the system determines that the crack is an internal metal crack. The system immediately generates an alarm message, indicating the presence of a metal fatigue crack at this location, and recommends prioritizing shutdown maintenance and weld reinforcement.

[0072] This invention solves the problem of the system getting stuck in an infinite loop or failing to output any effective images when iteration fails to converge under extremely poor lighting conditions by presetting a maximum number of iterations and automatically outputting the best historical image when the number of iterations reaches the upper limit. This improves the robustness and practicality under various lighting conditions. By recording the quality score sequence, calculating the mean and variance with a sliding monitoring window, and determining that the adjustment has converged to a stable state when there is no upward trend in multiple consecutive monitoring windows and the variance is lower than a preset fluctuation threshold, and automatically lowering the preset score threshold when the maximum quality score is still lower than the preset threshold after convergence, this invention solves the problem that the system cannot meet the termination condition even when it has reached the actual imaging limit due to the initial threshold being set too high. This avoids invalid iterations and waste of computing resources, and improves the system's adaptability to differences in lighting conditions and its operating efficiency.

[0073] This invention, based on high-quality images obtained through adaptive imaging adjustment, further constructs a crack type discrimination model based on a lightweight convolutional neural network. Supervised training is performed using two types of samples: external paint cracks and internal metal cracks. A classification confidence threshold is set for automatic discrimination, and low confidence triggers manual review. This solves the problem of insufficient maintenance decision-making information caused by existing UAV inspection systems that can only detect the presence of cracks but cannot distinguish their nature. It enhances the ability to move from crack detection to crack characterization, providing differentiated handling suggestions for port equipment maintenance personnel and improving the engineering guidance value of inspection reports.

[0074] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of the present invention.

Claims

1. An imaging adaptive adjustment method for UAV inspection of port equipment, characterized in that, include: S1, Construct an image quality evaluation model based on a lightweight convolutional neural network; S2, acquire image samples of the metal surface under different exposure parameters and polarization angles, calculate the gradient magnitude and information entropy of the image samples, and train the image quality assessment model based on the gradient magnitude and information entropy so that the image quality assessment model learns the mapping relationship from image to quality score; S3, Construct a reinforcement learning decision model, and train the reinforcement learning decision model using a reinforcement learning algorithm, so that the reinforcement learning decision model learns the imaging parameter adjustment actions to improve the quality score; S4. When the UAV is conducting inspections, images are acquired using initial imaging parameters and input into the image quality evaluation model to generate an initial quality score. S5, the initial quality score and initial imaging parameters are combined to form a state vector, which is then input into the reinforcement learning decision model to obtain the imaging parameter adjustment action; S6, adjust the imaging parameters of the UAV according to the imaging parameter adjustment action, acquire the image according to the adjusted imaging parameters, and input it into the image quality evaluation model to generate a corrected quality score; S7 iterates through S4 to S6 until the quality score reaches the preset score threshold, and the image with the quality score reaching the preset score threshold is used as the output image.

2. The imaging adaptive adjustment method for UAV inspection of port equipment according to claim 1, characterized in that, The image quality evaluation model takes a single frame of metal surface image as input and outputs a quality score to characterize the contrast and detail clarity of the crack area.

3. The imaging adaptive adjustment method for UAV inspection of port equipment according to claim 1, characterized in that, The lightweight convolutional neural network uses MobileNetV3 as its backbone network. After removing the fully connected layers, it replaces them with global average pooling layers and two fully connected layers, and outputs a quality score with a value between 0 and 1.

4. The imaging adaptive adjustment method for UAV inspection of port equipment according to claim 1, characterized in that, Image samples of metal surfaces under different exposure parameters and polarization angles are acquired. The gradient magnitude and information entropy of the image samples are calculated. The image quality assessment model is trained based on the gradient magnitude and information entropy to enable the image quality assessment model to learn the mapping relationship from image to quality score, including: S21, perform grayscale processing and Gaussian filtering to denoise the image samples to obtain the preprocessed image; S22, calculate the average gradient magnitude and the information entropy of the grayscale histogram for each preprocessed image, normalize the average gradient magnitude and information entropy to the [0,1] interval respectively, and perform weighted summation according to preset weights to generate a comprehensive quality score, which serves as the supervision label for the image samples; S23, input the image sample into the lightweight convolutional neural network to obtain the prediction quality score output by the lightweight convolutional neural network; S24, using the mean squared error between the predicted quality score and the supervision label as the loss function, the gradient of the loss function with respect to the parameters of the lightweight convolutional neural network is calculated through backpropagation, and the parameters of the lightweight convolutional neural network are updated along the gradient direction using stochastic gradient descent. The training is iterated until the loss function converges, and the trained image quality evaluation model is obtained.

5. The imaging adaptive adjustment method for UAV inspection of port equipment according to claim 1, characterized in that, The construction of a reinforcement learning decision model and training of the reinforcement learning decision model using a reinforcement learning algorithm, so that the reinforcement learning decision model learns imaging parameter adjustment actions to improve quality scores, includes: S31, Define a state space, which includes the current exposure parameters, the current polarization angle, and the quality score output by the image quality evaluation model for the current image; S32, Define the action space, which is a discrete set of actions, including at least: increasing the exposure value, decreasing the exposure value, rotating the polarizer in the forward direction to increase the polarization angle, rotating the polarizer in the reverse direction to decrease the polarization angle, and maintaining the current imaging parameters unchanged; S33, define a reward function that uses the difference between the quality score of the image obtained after the adjustment action and the quality score of the image before the adjustment action as the reward value, and applies a negative penalty when the image is overexposed or underexposed. S34. A deep Q-network algorithm is adopted, with the state vector of the state space as input and the state-action value corresponding to each adjustment action in the action space as output. Through an ε-greedy strategy, the adjustment action is randomly selected with probability ε, and the adjustment action with the highest state-action value among the currently learned strategies is selected with probability 1-ε, balancing random exploration and strategy utilization. It interacts with UAV imaging to collect an experience sample consisting of the current state, the executed adjustment action, the reward value calculated according to the reward function, and the next state entered after executing the adjustment action, and stores the experience sample in the experience replay buffer. Batch experience samples are randomly sampled from the experience replay buffer, the temporal difference error is calculated, the parameters of the deep Q-network are updated by gradient descent, and iterative training is performed until convergence to obtain the trained reinforcement learning decision model.

6. The imaging adaptive adjustment method for UAV inspection of port equipment according to claim 1, characterized in that, The iterative execution of S4 to S6 also includes: The maximum number of iterations is preset to N; After each execution of S6 to generate a corrected quality score, the current iteration number is compared with the maximum iteration number N; If the corrected quality score still does not reach the preset score threshold when the current iteration number reaches the maximum iteration number N, then the iteration stops, and the image with the highest quality score output by the image quality evaluation model is selected as the output image from all images obtained in previous iterations.

7. The imaging adaptive adjustment method for UAV inspection of port equipment according to claim 1, characterized in that, The process of iteratively executing S4 to S6 also includes making a reasonable judgment and adjustment on the preset scoring threshold, including: Record the quality score output by the image quality assessment model in each iteration to form a quality score sequence; When the number of iterations reaches the preset monitoring window length M, calculate the mean and variance of the quality scores corresponding to the most recent M iterations; If the mean does not show an upward trend for K consecutive monitoring windows and the variance is lower than the preset fluctuation threshold, it is determined that the current imaging parameter adjustment has converged to a stable state. After determining that convergence has reached a stable state, if the maximum value of the quality score in the current iteration is still lower than the preset score threshold, it is determined that the preset score threshold is set too high, and the preset score threshold is automatically adjusted to the sum of the maximum value of the quality score in the current iteration and the preset tolerance value. Continue executing S7 using the adjusted preset scoring threshold.

8. The imaging adaptive adjustment method for UAV inspection of port equipment according to claim 3, characterized in that, The gradient magnitude is the average rate of change of pixel grayscale values ​​calculated by applying the Sobel operator to the preprocessed image, which is used to characterize the edge sharpness of the image; the information entropy is the entropy value calculated by applying the grayscale histogram of the preprocessed image, which is used to characterize the richness of the image texture information.

9. The imaging adaptive adjustment method for UAV inspection of port equipment according to claim 5, characterized in that, The state-action value in the deep Q-network algorithm is an evaluation value output by the deep Q-network, which takes the state vector and adjustment action as input and measures the expected cumulative reward that can be obtained by performing the adjustment action in the current state. The experience replay buffer is a data cache used to store the experience samples during training, and the temporal correlation between training data is broken by randomly sampling batches of experience samples from it. The temporal difference error is the difference between the deep Q network's estimate of the current state-action value and the target estimate calculated based on the reward value and the next state-action value, and is used to drive the gradient descent update of the deep Q network parameters.