khoroos_detector_dfine_m
a chick detector for agricultural farms
2 min readupdated
This model is a fine-tuned version of the D-FINE architecture (an object detection family based on HGNetv2) built for precise detection and counting of chicks in farm video footage. Created as part of the Khoroos toolkit for automated analysis of poultry behavior, it outputs bounding box coordinates and confidence scores for each individual in the frame. Trained on the ChickenDet dataset and optimized for poultry house video frames, the solution is available in PyTorch and ONNX formats. It is useful for agricultural researchers and developers of livestock monitoring systems.
Key features
- Detection accuracy: achieves high accuracy (AP 0.832) on independent test data from commercial poultry houses.
- Format flexibility: available in FP32, FP16, and quantized ONNX INT8 versions for rapid deployment on CPUs.
- Size optimization: contains around 19.5 million parameters, striking a balance between speed and quality.
- Ready ecosystem: integrated into the Khoroos toolkit and the standard Transformers library.
What you can do
- Farm video analysis: run automated counting and tracking of chicks on surveillance camera footage using the Khoroos utility.
- Python integration: write a custom script using Transformers for frame-by-frame processing of poultry house images.
- Export and inference: use the ONNX versions of the model to optimize performance on edge devices or servers lacking powerful GPUs.
Example
An example of running bird detection using the Transformers library:
import torch
from PIL import Image
from transformers import DFineForObjectDetection
from torchvision.transforms.functional import pil_to_tensor, resize
model = DFineForObjectDetection.from_pretrained("amirivojdan/khoroos_detector_dfine_m").eval()
image = Image.open("frame.jpg").convert("RGB")
x = resize(pil_to_tensor(image), [640, 640], antialias=True).float()[None] / 255
with torch.no_grad():
out = model(pixel_values=x)
scores = out.logits[0, :, 0].sigmoid()
Read more
DetailsTest metrics: AP 0.832, AP50 0.967, F1 0.941 (at a 0.55 threshold).
Requirements: lightweight model (around 78 MB in FP32 and 40 MB in FP16/INT8), efficient on both GPUs and CPUs.
Limitations: trained on top-down and angled views for broiler farms; small objects are harder to recognize (AP small 0.431).
License: CC BY-NC-SA 4.0 (for non-commercial use only).










Comments