Views
No views yet

pip install binocular-birdspredict_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"InferenceModel in your own Python scripts:1from Binocular.models.inference import InferenceModel
2from PIL import Image
3
4# This will download the model from the hub automatically
5model = InferenceModel.from_pretrained(
6 repo_id="jiujiuche/binocular",
7 filename="artifacts/dinov2_vitb14_nabirds.pth"
8)
9
10# Open an image
11img = Image.open("path/to/your/bird_image.jpg")
12
13# Get predictions
14predictions = model.predict(img, top_k=5)
15
16# Print the results
17for species, confidence in predictions:
18 print(f"{species}: {confidence:.2%}")Binocular/datasets/nabirds/ directory within the cloned repository.1# Example for training on an M2 Mac
2python Binocular/scripts/train.py --config Binocular/configs/m2_dev.yamlBinocular/configs/ directory.1@misc{Binocular,
2 author = {JiuJiuChe},
3 title = {Binocular: A NABirds Species Classifier},
4 year = {2024},
5 publisher = {GitHub},
6 journal = {GitHub repository},
7 howpublished = {\url{https://github.com/JiuJiuChe/Binocular}}
8}