Research Article

An Improved Ship Classification Method Based on YOLOv7 Model with Attention Mechanism

Algorithm 1

Training of YOLOv7-RCBAM.
Input: Training set and ground truths
Output: Trained model
Initialization: Learning rate , batch size , and set each parameter value epoch, weights.
For to do
 //YOLOv7-RCBAM
 Preprocess by mosaic: = ImagePreprocessing()
 Extract feature information in backbone: Features = backbone()
 Fuse features by feature fusion module: Fused = FeatureFusion(features)
 Attention module extract feature: Attention = RCBAM(fused)
Objectness, anchor_shape, feature_cls, feature_loc = YOLOHead(attention)
 //Calculate loss and gradient descent
 Calculate gradients: Weight = backpropagation()
End: save weights of model