# Zero-Shot Detection of Visual Food Safety Hazards via Knowledge-Enhanced Feature Synthesis
## 4 Experimental Evaluation
### Datasets and Experimental Setup  
#### 4.1.1 Datasets  
To evaluate our method, we constructed a Food Safety Visual Hazards (FSVH) dataset by adapting and combining multiple publicly available sources. We utilized the food categories (hazelnut, potato, and carrot) from MVTEC-AD [47], an industrial anomaly detection dataset containing 5,354 high-resolution images with pixel-precise ground truth annotations for various types of defects. Additionally, we selected 10 categories from Food-101 [48], a large-scale food recognition dataset, and annotate them with food safety hazards using expert knowledge. We further extracted food-related images containing various visual anomalies and foreign objects from the Open Images Dataset V4 [49], a large-scale collection of annotated images. The dataset was enriched with images from publicly available food safety inspection guides [50] and the scientific literature. The final FSVH dataset contained 18,326 images spanning 26 food categories and annotated with 48 visual safety attributes organized into 28 hazard classes. Following standard practice in zero-shot learning [7], we split the hazard classes into seen and unseen sets, with 20 seen classes for training and 8 unseen classes for testing. Table 1 presents the statistics of our FSVH dataset. The dataset exhibits class imbalance, reflecting the natural distribution of food safety hazards in real-world settings. We ensured that each unseen hazard class shared visual attributes with at least one seen class to enable knowledge transfer. Table 2 enumerates all the food categories in our dataset, organized by food type. These categories were selected to represent diverse food groups commonly subject to safety inspection in real-world scenarios. Table 3 details the 48 visual safety attributes used in our framework, organized into four main categories. Each attribute is associated with specific visual patterns that indicate potential safety hazards. The table also shows the frequency of occurrence for key attributes across different food categories, providing insights into attribute-food relationships. \begin{table}
\begin{tabular}{l c c} \hline \hline
**Category** & **Count** & **Description** \\ \hline Food Categories & 26 & Meats, fruits, vegetables, etc. \\ Visual Attributes & 48 & Appearance, decomposition, etc. \\ Hazard Classes & 28 & Mold, foreign objects, etc. \\ Seen Classes & 20 & Used for training \\ Unseen Classes & 8 & Used for testing \\ Total Images & 18,326 & Training Images & 12,854 \\ Testing Images & 5472 & Both seen and unseen hazards \\ Bounding Box Annotations & 32,741 & \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Statistics of the food safety visual hazards (FSVH) dataset. \begin{table}
\begin{tabular}{l c} \hline \hline
**Food Type** & **Categories** \\ \hline Meats & Beef, Pork, Chicken, Fish \\ Dairy Products & Milk, Cheese, Yogurt \\ Fruits & Apples, Oranges, Berries, Bananas \\ Vegetables & Lettuce, Tomatoes, Potatoes, Carrots \\ Bakery Items & Bread, Cakes, Pastries \\ Grains & Rice, Wheat, Corn \\ Processed Foods & Canned Goods, Frozen Meals, Packaged Snacks \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Food categories included in the FSVH dataset. We classify the hazard classes into four main categories based on their characteristics and visual manifestations. Biological Contamination includes mold growth, bacterial colonies, and other microbiological hazards with distinctive visual patterns that represent common threats to food safety. Physical Contamination comprises foreign objects such as plastic fragments, metal shavings, glass pieces, and insect parts that can be introduced during processing, handling, or storage. Chemical Contamination contains visual indicators of chemical residues, discoloration due to improper processing, and other chemically induced anomalies that may indicate contamination with harmful substances.