## 3 Materials and Methods
### Methods  
#### 3.2.1 Two-Stage Model Configuration  
In the 2-stage approach, segmentation and classification networks were trained independently. In the first stage, six segmentation models were employed: U-Net, Attention U-Net, SegNet, DeepLabV3+, EfficientPS, and MobileNetV2.  
U-Net operates based on an encoder-decoder architecture with skip connections, which effectively preserve high-resolution features [26]. Attention U-Net builds upon U-Net by incorporating attention mechanisms to emphasize relevant regions [27]. SegNet is a lightweight encoder-decoder model that utilizes pooling indices during the decoding process to improve memory efficiency [28]. DeepLabV3+ enhances boundary recognition performance through Atrous Spatial Pyramid Pooling (ASPP), which captures multi-scale features in parallel [29]. EfficientPS is designed for panoptic segmentation and is optimized to handle complex foreground and background information simultaneously [30]. Lastly, MobileNetV2 is a lightweight model based on depthwise separable convolutions, well-suited for mobile and embedded systems [31].  
In the experiments, each segmentation model was used to extract the region of interest (ROI) from beef cross-sectional images. The models produced binary masks to isolate the ROI, and these masks were saved as separate files to be used as input for the second stage.  
As illustrated in Figure 3, the 2-stage model first segments the longissimus muscle region before classification, whereas the 1-stage approach directly predicts the beef grade from the original image. This structural difference significantly affects pipeline complexity and inference speed.  
In the classification stage, three CNN-based architectures--ResNeXt-50, DenseNet-121, and VGG-16--were used to predict beef quality grades based on the segmented images. ResNeXt-50 consists of 16 bottleneck blocks and leverages grouped convolutions to improve parameter efficiency while maintaining strong feature extraction [32]. DenseNet-121 comprises four dense blocks and three transition layers, using densely connected layers that reuse features across the network to enhance learning efficiency [33]. The feature maps are downsampled to a resolution of \(16\times 16\). VGG-16 is a classic and straightforward CNN composed of 13 convolutional layers and 3 fully connected layers. The input image, initially at \(512\times 512\) resolution, is reduced to \(16\times 16\) through five stages of max pooling [34].  
All segmentation and classification models were trained independently under identical data splitting and preprocessing conditions. Input image size was unified to \(512\times 512\) pixels for both stages.  
Figure 3: Comparison of 2-stage and 1-stage beef carcass grading approaches. The 2-stage model first applies a segmentation network (e.g., Attention U-Net) to extract the longissimus muscle region, followed by a classification network (e.g., DenseNet-121) to predict the beef grade. In contrast, the 1-stage model directly predicts the beef grade from the raw image using a single classification network (EfficientViT) without any segmentation preprocessing.  
For inference, the total runtime of the 2-stage model was measured by summing the inference times of both the segmentation and classification networks. Image saving/loading times were excluded to ensure a fair comparison.  
A total of 18 combinations were evaluated by pairing the six segmentation models with the three classification models.