Downloads · 30 days
0
0% of all-time downloads
jiujiuche/binocular
binocular is a image classification model from jiujiuche. Use it when you need a label for an image. The card lists the license as mit.
<img src="https://raw.githubusercontent.com/JiuJiuChe/Binocular/main/Binocular/assets/binacular.png" width="100" alt="Binocular"
Downloads · 30 days
0
0% of all-time downloads
All-time downloads
1
Public
Repo size
352 MB
Likes
0
Public
Click a slice to open those files.
.pth352 MB · 100%
From the Hugging Face model README
This project provides a pretrained, species-level bird classifier for North American birds, built on the NABirds dataset. It uses a powerful DINOv2 Vision Transformer (ViT) backbone with a linear probe, allowing for accurate and efficient classification.
The model can be easily loaded and used for inference directly from the Hugging Face Hub.
Install the package directly from PyPI:
pip install binocular-birds
After installation, you can use the predict_hf command-line tool to run inference on an image. The tool will automatically download the pretrained model from the Hugging Face Hub.
predict_hf --image "path/to/your/bird_image.jpg"
You can also use the InferenceModel in your own Python scripts:
from Binocular.models.inference import InferenceModel
from PIL import Image
# This will download the model from the hub automatically
model = InferenceModel.from_pretrained(
repo_id="jiujiuche/binocular",
filename="artifacts/dinov2_vitb14_nabirds.pth"
)
# Open an image
img = Image.open("path/to/your/bird_image.jpg")
# Get predictions
predictions = model.predict(img, top_k=5)
# Print the results
for species, confidence in predictions:
print(f"{species}: {confidence:.2%}")
This model is intended for classifying bird species in images. It can be used for:
The full pipeline for training the model from scratch is available in the GitHub repository.
Binocular/datasets/nabirds/ directory within the cloned repository.The training process is managed through a main script that uses configuration files to define the training parameters.
# Example for training on an M2 Mac
python Binocular/scripts/train.py --config Binocular/configs/m2_dev.yaml
Training configurations for different hardware can be found in the Binocular/configs/ directory.
If you use this model in your research, please consider citing the original DINOv2 and NABirds papers, as well as this repository.
@misc{Binocular,
author = {JiuJiuChe},
title = {Binocular: A NABirds Species Classifier},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/JiuJiuChe/Binocular}}
}