# YOLO-PGC: A Tomato Maturity Detection Algorithm Based on Improved YOLOv11
## 3 Methods
### Polarized State Space Strategy  
The PSSD module represents an innovative architectural solution designed to address fundamental challenges in tomato ripeness detection. In particular, this module enhances occlusion handling and complex background discrimination, the feed-forward neural network, and feature fusion, establishing an efficient end-to-end detection framework that significantly enhances model robustness and detection precision.  
The feature decomposition component systematically decomposes input features into global and local representations for effective multiscale information capture. The decomposition process is mathematically expressed as follows:  
\[\text{Decomposed\_features}=\text{Global\_features}+\text{Local\_features} \tag{1}\]  
where Global_features capture macroscopic characteristics (e.g., morphological structure and color distribution), while _Local_features_ encode microscopic details (e.g., ripening-induced color gradients). This hierarchical feature extraction strategy effectively compensates for information loss in occlusion scenarios and enables precise target-background discrimination in complex environments.  
The SS2D module is the core innovation in the PSSD architecture. It is developed based on the Selective State-space Model (SSM) theory. This module constructs a precise feature dynamic modeling system by integrating the state matrix A, temporal adjustment parameters D, dynamic time step adjustment (\(\Delta t\)), and directional selective scanning mechanisms. Initially, the input features undergo linear transformation:  
\[y=\text{W}x+b \tag{2}\]  
where W denotes the projection matrix and \(b\) represents the bias term. The SS2D module enhances features using depth-wise separable convolutions, specifically implementing the core selective scanning function as  
\[\text{Selective\ scan}=f(y). \tag{3}\]  
State updates are governed by  
\[s_{t+1}=\text{As}_{t}+\text{B}x_{t}+\text{C}f(y_{t})+\text{D}\Delta t, \tag{4}\]  
where A, B, C, and D represent the state matrix, feature weighting matrix, scan direction modifier, and temporal weighting parameter, respectively. The state matrix A governs temporal state evolution and inter-feature dependencies, B modulates feature contributions in state updates, C adjusts directional scanning information for enhanced occlusion recovery, and D controls temporal feature update rates.  
The Feed-Forward Network (FFN) includes multiple fully connected layers. These layers use GELU activation functions to carry out nonlinear feature transformation:  
\[\text{Nonlinear\ transformation}=\text{FFN}(x). \tag{5}\]  
Our component demonstrates exceptional modeling capacity for complex gradient features, specifically capturing subtle color transitions during tomato ripening.  
The feature fusion module Concat integrates original and enhanced feature representations:  
\[\text{Final\_features}=\text{Concat}(\text{Original\_features},\text{Enhanced\_features}). \tag{6}\]  
This integration preserves contextual information while enhancing fine-grained feature representation, establishing a robust foundation for precise target detection.