Skip to content

The very first open-source dataset for chicken re-identification πŸ”

License

Notifications You must be signed in to change notification settings

DariaKern/Chicks4FreeID

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

72 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Chicks4FreeID

The very first publicly available chicken re-identification dataset is available on πŸ€— Hugging Face: huggingface.co/datasets/dariakern/Chicks4FreeID

πŸ€— Usage

pip install datasets

Load the data:

from datasets import load_dataset
train_ds = load_dataset("dariakern/Chicks4FreeID", split="train")
train_ds[0]

Output:

{'crop': <PIL.PngImagePlugin.PngImageFile image mode=RGB size=2630x2630 at 0x7AA95E7D1720>,
'identity': 43}

Tip

Find more information on how to work with πŸ€— huggingface.co/docs/datasets

πŸ“Š Baseline

To establish a baseline on the dataset, we explore 3 approaches

  1. We evaluate the SotA model in animal re-identification: MegaDescriptor-L-384, a feature extractor, pre-trained on many species and identities.

    timm.create_model("hf-hub:BVRA/MegaDescriptor-L-384", pretrained=True)

  2. We train MegaDescriptor-L-384's underlying architecture; a Swin-Transformer, in the same way it has been used to build the MegaDescriptor-L-384, but now on our own dataset.

    timm.create_model('swin_large_patch4_window12_384')

  3. We train a Vision Transformer (ViT-B/16) as a fully supervised baseline, and focus on embeddings by replacing the classifier head with a linear layer.

    from torchvision.models import vit_b_16

Evaluation settings are based on:

Metrics are from torchmetrics

  • mAP: MulticlassAveragePrecision(average="macro")
  • top1: MulticlassAccuracy(top_k=1)
  • top5: MulticlassAccuracy(top_k=5)

Below are the metrics for the test set. Standard deviations are based on 3 runs:

Setting Evaluation mAP top-1 top-5
MegaDescriptor-L-384 (frozen) k-NN 0.649 Β± 0.044 0.709 Β± 0.026 0.924 Β± 0.027
MegaDescriptor-L-384 (frozen) Linear 0.935 Β± 0.005 0.883 Β± 0.009 0.985 Β± 0.003
Swin-L-384 k-NN 0.837 Β± 0.062 0.881 Β± 0.041 0.983 Β± 0.010
Swin-L-384 Linear 0.963 Β± 0.022 0.922 Β± 0.042 0.987 Β± 0.012
ViT-B/16 k-NN 0.893 Β± 0.010 0.923 Β± 0.005 0.985 Β± 0.019
ViT-B/16 Linear 0.976 Β± 0.007 0.928 Β± 0.002 0.990 Β± 0.012

The most interesting observation in this table is that, even though the MegaDescriptor-L-384 feature extractor has never seen our dataset, its embeddings are still relatively helpful in identifiying the chickens, even when compared to the fully supervised approaches.

πŸ§‘β€πŸ’» Replicate the baseline

git clone https://github.com/DariaKern/Chicks4FreeID
cd Chicks4FreeID
pip install requirements.txt
python run_baseline.py

You can pass different options, depending on your hardware configuration

python run_baseline.py --devices=4 --batch-size-per-device=128 

For a full list of arguments type

python run_baseline.py --help

In a sepearte shell, open tensorboard to view progress and results

tensorboard --logdir baseline_logs

Note

Differnt low-level accelerator implementations (TPU, MPS, CUDA) yield different results. The original hardware config for the reported results is based on the MPS implementation accessible on a 64GB Apple M3 Max chip (2023) πŸ’» - it is recommened to run the baseline script with at least 64GB of VRAM / Shared RAM. On this device, one run takes around 9:30h

⏳ Timeline

πŸ“ Papers and systems citing the Chicks4FreeID dataset

coming soon ...

πŸ–‹οΈ Citation

@misc{kern2024Chicks4FreeID,
      title={Chicks4freeID: A Benchmark Dataset for Chicken Re-Identification}, 
      author={Daria Kern and Tobias Schiele and Ulrich Klauck and Winfred Ingabire},
      year={2024},
      doi={https://doi.org/10.57967/hf/2345},
      note={in preparation for NeurIPS 2024 Datasets and Benchmarks Track}
}

Releases

No releases published

Packages

No packages published

Languages