--- license: apache-2.0 language: - en base_model: - google/siglip2-base-patch16-224 pipeline_tag: image-classification library_name: transformers tags: - dog - classify --- ![bnbxfgbnx.png](/static-proxy?url=https%3A%2F%2Fcdn-uploads.huggingface.co%2Fproduction%2Fuploads%2F65bb837dbfb878f46c77de4c%2FXKT2Um6LdpzG64N1djM7s.png) # **Dog-Breed-120** > **Dog-Breed-120** is an image classification vision-language encoder model fine-tuned from **google/siglip2-base-patch16-224** for a single-label classification task. It is designed to classify dog images into specific breed categories using the **SiglipForImageClassification** architecture. > [!Note] > Accuracy : 86.81 ```py {'eval_loss': 0.49717578291893005, 'eval_model_preparation_time': 0.0042, 'eval_accuracy': 0.8681275679906085, 'eval_runtime': 146.2493, 'eval_samples_per_second': 69.894, 'eval_steps_per_second': 8.739, 'epoch': 7.0} ``` The model categorizes images into the following 121 classes (0-120): - **Class 0:** "affenpinscher" - **Class 1:** "afghan_hound" - **Class 2:** "african_hunting_dog" - **Class 3:** "airedale" - **Class 4:** "american_staffordshire_terrier" - **Class 5:** "appenzeller" - **Class 6:** "australian_terrier" - **Class 7:** "basenji" - **Class 8:** "basset" - **Class 9:** "beagle" - **Class 10:** "bedlington_terrier" - **Class 11:** "bernese_mountain_dog" - **Class 12:** "black-and-tan_coonhound" - **Class 13:** "blenheim_spaniel" - **Class 14:** "bloodhound" - **Class 15:** "bluetick" - **Class 16:** "border_collie" - **Class 17:** "border_terrier" - **Class 18:** "borzoi" - **Class 19:** "boston_bull" - **Class 20:** "bouvier_des_flandres" - **Class 21:** "boxer" - **Class 22:** "brabancon_griffon" - **Class 23:** "briard" - **Class 24:** "brittany_spaniel" - **Class 25:** "bull_mastiff" - **Class 26:** "cairn" - **Class 27:** "cardigan" - **Class 28:** "chesapeake_bay_retriever" - **Class 29:** "chihuahua" - **Class 30:** "chow" - **Class 31:** "clumber" - **Class 32:** "cocker_spaniel" - **Class 33:** "collie" - **Class 34:** "curly-coated_retriever" - **Class 35:** "dandie_dinmont" - **Class 36:** "dhole" - **Class 37:** "dingo" - **Class 38:** "doberman" - **Class 39:** "english_foxhound" - **Class 40:** "english_setter" - **Class 41:** "english_springer" - **Class 42:** "entlebucher" - **Class 43:** "eskimo_dog" - **Class 44:** "flat-coated_retriever" - **Class 45:** "french_bulldog" - **Class 46:** "german_shepherd" - **Class 47:** "german_short-haired_pointer" - **Class 48:** "giant_schnauzer" - **Class 49:** "golden_retriever" - **Class 50:** "gordon_setter" - **Class 51:** "great_dane" - **Class 52:** "great_pyrenees" - **Class 53:** "greater_swiss_mountain_dog" - **Class 54:** "groenendael" - **Class 55:** "ibizan_hound" - **Class 56:** "irish_setter" - **Class 57:** "irish_terrier" - **Class 58:** "irish_water_spaniel" - **Class 59:** "irish_wolfhound" - **Class 60:** "italian_greyhound" - **Class 61:** "japanese_spaniel" - **Class 62:** "keeshond" - **Class 63:** "kelpie" - **Class 64:** "kerry_blue_terrier" - **Class 65:** "komondor" - **Class 66:** "kuvasz" - **Class 67:** "labrador_retriever" - **Class 68:** "lakeland_terrier" - **Class 69:** "leonberg" - **Class 70:** "lhasa" - **Class 71:** "malamute" - **Class 72:** "malinois" - **Class 73:** "maltese_dog" - **Class 74:** "mexican_hairless" - **Class 75:** "miniature_pinscher" - **Class 76:** "miniature_poodle" - **Class 77:** "miniature_schnauzer" - **Class 78:** "newfoundland" - **Class 79:** "norfolk_terrier" - **Class 80:** "norwegian_elkhound" - **Class 81:** "norwich_terrier" - **Class 82:** "old_english_sheepdog" - **Class 83:** "otterhound" - **Class 84:** "papillon" - **Class 85:** "pekinese" - **Class 86:** "pembroke" - **Class 87:** "pomeranian" - **Class 88:** "pug" - **Class 89:** "redbone" - **Class 90:** "rhodesian_ridgeback" - **Class 91:** "rottweiler" - **Class 92:** "saint_bernard" - **Class 93:** "saluki" - **Class 94:** "samoyed" - **Class 95:** "schipperke" - **Class 96:** "scotch_terrier" - **Class 97:** "scottish_deerhound" - **Class 98:** "sealyham_terrier" - **Class 99:** "shetland_sheepdog" - **Class 100:** "shih-tzu" - **Class 101:** "siberian_husky" - **Class 102:** "silky_terrier" - **Class 103:** "soft-coated_wheaten_terrier" - **Class 104:** "staffordshire_bullterrier" - **Class 105:** "standard_poodle" - **Class 106:** "standard_schnauzer" - **Class 107:** "sussex_spaniel" - **Class 108:** "test" - **Class 109:** "tibetan_mastiff" - **Class 110:** "tibetan_terrier" - **Class 111:** "toy_poodle" - **Class 112:** "toy_terrier" - **Class 113:** "vizsla" - **Class 114:** "walker_hound" - **Class 115:** "weimaraner" - **Class 116:** "welsh_springer_spaniel" - **Class 117:** "west_highland_white_terrier" - **Class 118:** "whippet" - **Class 119:** "wire-haired_fox_terrier" - **Class 120:** "yorkshire_terrier" # **Run with Transformers🤗** ```python !pip install -q transformers torch pillow gradio ``` ```python import gradio as gr from transformers import AutoImageProcessor, SiglipForImageClassification from PIL import Image import torch # Load model and processor model_name = "prithivMLmods/Dog-Breed-120" model = SiglipForImageClassification.from_pretrained(model_name) processor = AutoImageProcessor.from_pretrained(model_name) def dog_breed_classification(image): """Predicts the dog breed for an image.""" image = Image.fromarray(image).convert("RGB") inputs = processor(images=image, return_tensors="pt") with torch.no_grad(): outputs = model(**inputs) logits = outputs.logits probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist() labels = { "0": "affenpinscher", "1": "afghan_hound", "2": "african_hunting_dog", "3": "airedale", "4": "american_staffordshire_terrier", "5": "appenzeller", "6": "australian_terrier", "7": "basenji", "8": "basset", "9": "beagle", "10": "bedlington_terrier", "11": "bernese_mountain_dog", "12": "black-and-tan_coonhound", "13": "blenheim_spaniel", "14": "bloodhound", "15": "bluetick", "16": "border_collie", "17": "border_terrier", "18": "borzoi", "19": "boston_bull", "20": "bouvier_des_flandres", "21": "boxer", "22": "brabancon_griffon", "23": "briard", "24": "brittany_spaniel", "25": "bull_mastiff", "26": "cairn", "27": "cardigan", "28": "chesapeake_bay_retriever", "29": "chihuahua", "30": "chow", "31": "clumber", "32": "cocker_spaniel", "33": "collie", "34": "curly-coated_retriever", "35": "dandie_dinmont", "36": "dhole", "37": "dingo", "38": "doberman", "39": "english_foxhound", "40": "english_setter", "41": "english_springer", "42": "entlebucher", "43": "eskimo_dog", "44": "flat-coated_retriever", "45": "french_bulldog", "46": "german_shepherd", "47": "german_short-haired_pointer", "48": "giant_schnauzer", "49": "golden_retriever", "50": "gordon_setter", "51": "great_dane", "52": "great_pyrenees", "53": "greater_swiss_mountain_dog", "54": "groenendael", "55": "ibizan_hound", "56": "irish_setter", "57": "irish_terrier", "58": "irish_water_spaniel", "59": "irish_wolfhound", "60": "italian_greyhound", "61": "japanese_spaniel", "62": "keeshond", "63": "kelpie", "64": "kerry_blue_terrier", "65": "komondor", "66": "kuvasz", "67": "labrador_retriever", "68": "lakeland_terrier", "69": "leonberg", "70": "lhasa", "71": "malamute", "72": "malinois", "73": "maltese_dog", "74": "mexican_hairless", "75": "miniature_pinscher", "76": "miniature_poodle", "77": "miniature_schnauzer", "78": "newfoundland", "79": "norfolk_terrier", "80": "norwegian_elkhound", "81": "norwich_terrier", "82": "old_english_sheepdog", "83": "otterhound", "84": "papillon", "85": "pekinese", "86": "pembroke", "87": "pomeranian", "88": "pug", "89": "redbone", "90": "rhodesian_ridgeback", "91": "rottweiler", "92": "saint_bernard", "93": "saluki", "94": "samoyed", "95": "schipperke", "96": "scotch_terrier", "97": "scottish_deerhound", "98": "sealyham_terrier", "99": "shetland_sheepdog", "100": "shih-tzu", "101": "siberian_husky", "102": "silky_terrier", "103": "soft-coated_wheaten_terrier", "104": "staffordshire_bullterrier", "105": "standard_poodle", "106": "standard_schnauzer", "107": "sussex_spaniel", "108": "test", "109": "tibetan_mastiff", "110": "tibetan_terrier", "111": "toy_poodle", "112": "toy_terrier", "113": "vizsla", "114": "walker_hound", "115": "weimaraner", "116": "welsh_springer_spaniel", "117": "west_highland_white_terrier", "118": "whippet", "119": "wire-haired_fox_terrier", "120": "yorkshire_terrier" } predictions = {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))} return predictions # Create Gradio interface iface = gr.Interface( fn=dog_breed_classification, inputs=gr.Image(type="numpy"), outputs=gr.Label(label="Prediction Scores"), title="Dog Breed Classification", description="Upload an image to classify it into one of the 121 dog breed categories." ) # Launch the app if __name__ == "__main__": iface.launch() ``` # **Intended Use:** The **Dog-Breed-120** model is designed for dog breed image classification. It helps categorize dog images into 121 specific breed categories. Potential use cases include: - **Pet Identification:** Assisting pet owners and veterinarians in identifying dog breeds. - **Animal Research:** Supporting research in canine genetics and behavior studies. - **E-commerce Applications:** Enhancing pet-related product recommendations and searches. - **Educational Purposes:** Aiding in learning and teaching about various dog breeds.