This model is designed to support smart poultry farming by enabling early detection of diseases through image-based feces analysis.
-
Base: EfficientNetV2S (pretrained on ImageNet, frozen then fine-tuned)
-
Head:
GlobalAveragePooling2D
Dense(128) + BatchNorm + ReLU + Dropout(0.3)
Dense(4, activation='softmax')
-
Optimizer: Adam
-
Loss: Categorical Crossentropy
-
Metric: Accuracy
-
Dataset:
- Source: Jayavrinda et al., 2023
- 4 classes, resized to 224x224 pixels
- Train/Val/Test sampling (3k/400/400 per class)
-
EarlyStopping was used to monitor validation accuracy
-
Accuracy on validation set: ~90%+ (see notebook for full results)
1from tensorflow.keras.models import load_model
2import tensorflow as tf
3from PIL import Image
4import numpy as np
5
6model = load_model("path/to/your_model.h5")
7
8def preprocess(image_path):
9 img = Image.open(image_path).resize((224, 224))
10 img_array = np.array(img) / 255.0
11 return np.expand_dims(img_array, axis=0)
12
13pred = model.predict(preprocess("feces.jpg"))
14class_names = ["Coccidiosis", "Healthy", "Newcastle", "Salmonella"]
15print("Prediction:", class_names[np.argmax(pred)])