Abstract:To address the class imbalance in sweet cherry data, a novel image enhancement method based on sweet cherry generative adversarial network, SCGAN was proposed. The generator incorporated multi-scale residual blocks (MSRB) and the convolutional block attention module (CBAM), enhancing the model’s feature representation and the quality of generated images. These blocks captured features at various scales, and CBAM focused on channel and spatial information, improving image quality. In the discriminator, spectral normalization and the Wasserstein distance with a gradient penalty loss function were applied. This combination controled the discriminator’s power, prevented overfitting, and boosted training stability and speed. Experimental results showed that SCGAN produced higher quality defective sweet cherry images compared with traditional GANs, with Fréchet inception distance (FID) scores of 64.36 and 59.97 for two types of defects. After data augmentation with SCGAN, classification accuracy for VGG19 and MobileNetV3 was increased by 16.44 percentage points and 13.94 percentage points, respectively. The data augmentation method presented held significant potential in addressing data imbalance issues within the agricultural and food sectors. It not only improved the generalization capability of models but also provided a more reliable data foundation for practical applications. Through this approach, it was possible to more effectively tackle long-tail class imbalance issues, which enhanced the accuracy and efficiency of agricultural and food detection systems.