# Evaluating the FLUX.1 Synthetic Data on YOLOv9 for AI-Powered Poultry Farming
## 3 Materials and Methods
### Evaluation Metrics  
After generating over 400 synthetic images, an experiment was conducted to evaluate the impact of synthetic data, produced using the fine-tuned FLUX.1 [dev] model, on the accuracy of the YOLOv9 predictive model. All experiments were conducted using an A100 GPU. During the training process, one of the most important metrics is loss. The YOLOv9 loss function enhances previous architectures for better detection accuracy and training stability. It consists of three key components [57]:  
Figure 5: Synthetic data creation in Replicate with FLUX.1 [dev]. YOLOv9 uses CIoU (Complete Intersection over Union) loss, incorporating distance, aspect ratio, and scale, ensuring faster convergence and precise localization for bounding box regression loss [60]. * Using Binary Cross-Entropy (BCE) loss with sigmoid activation, the model enables multi-label classification per bounding box for classification loss [61]. * Focal loss reduces the impact of easy negatives, focusing on hard-to-classify cases, improving object-background distinction, and it is used as objectness loss [62]. Bounding box regression is a fundamental aspect of object detection, determining how accurately a model predicts object locations within an image in the context of loss function. The Intersection over Union (IoU) metric is widely used to evaluate object detection performance [61]. It measures the overlap between a predicted bounding box \(B_{p}\) and the ground truth bounding box \(B_{g}\), defined as  
\[IoU=\frac{|B_{p}\cap B_{g}|}{|B_{p}\cup B_{g}|} \tag{3}\]  
The (3) can be rewritten as follows:  
\[\text{IoU}=\frac{\text{Area of Overlap}}{\text{Area of Union}} \tag{4}\]  
The loss function is then computed:  
\[\text{L}=1-IoU \tag{5}\]  
While IoU effectively quantifies how well two bounding boxes align, it has several drawbacks when used as a loss function for training object detection models. One limitation is its lack of positional awareness, as IoU considers only the overlap area without accounting for the distance between the predicted and ground truth boxes. Even if \(B_{p}\) and \(B_{g}\) are close but do not overlap, the result will be 0, just as when the bounding boxes are far apart. IoU imposes no aspect ratio constraints, meaning that bounding boxes with significantly different aspect ratios can still have similar IoU values without being properly aligned. Another issue is scale sensitivity, where large bounding boxes may achieve high IoU scores even if they are poorly aligned with smaller objects [61]. Due to these limitations, using IoU alone as a loss function can lead to slow convergence and inaccurate bounding box predictions. To overcome the IoU limitations, several improved loss functions have been proposed. Generalized IoU (GIoU) loss [63] introduces a penalty for non-overlapping boxes by considering the smallest enclosing area. Distance IoU (DIoU) loss enhances GIoU by incorporating a penalty based on the Euclidean distance between box centers [64]. YOLOv9 uses Complete Intersection over Union (CIoU) loss to optimize bounding box predictions by incorporating multiple geometric factors that enhance localization accuracy and model convergence speed. Unlike traditional IoU-based loss functions that rely solely on the overlap ratio between predicted and ground truth bounding boxes, CIoU introduces center distance, aspect ratio consistency, and scale awareness, making it a more effective loss function for object detection.