Instructions to use prithivMLmods/Sketch-126-DomainNet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/Sketch-126-DomainNet with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="prithivMLmods/Sketch-126-DomainNet") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForImageClassification processor = AutoProcessor.from_pretrained("prithivMLmods/Sketch-126-DomainNet") model = AutoModelForImageClassification.from_pretrained("prithivMLmods/Sketch-126-DomainNet", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files1 unmodified line234567891011131 unmodified lines1431441451 unmodified linelicense: apache-2.0datasets:- Bruece/domainnet-126-by-class-sketch---```pyClassification Report:131 unmodified linesweighted avg 0.8404 0.8440 0.8352 19317```1 unmodified line2345678910111213141516171819202122131 unmodified lines1541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673681 unmodified linelicense: apache-2.0datasets:- Bruece/domainnet-126-by-class-sketchlanguage:- enbase_model:- google/siglip2-base-patch16-224pipeline_tag: image-classificationlibrary_name: transformerstags:- Sketch-126-DomainNet---# **Sketch-126-DomainNet**> **Sketch-126-DomainNet** 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 sketches into 126 domain categories using the **SiglipForImageClassification** architecture.```pyClassification Report:131 unmodified linesweighted avg 0.8404 0.8440 0.8352 19317```The model categorizes images into the following 126 classes:- **Class 0:** "aircraft_carrier"- **Class 1:** "alarm_clock"- **Class 2:** "ant"- **Class 3:** "anvil"- **Class 4:** "asparagus"- **Class 5:** "axe"- **Class 6:** "banana"- **Class 7:** "basket"- **Class 8:** "bathtub"- **Class 9:** "bear"- **Class 10:** "bee"- **Class 11:** "bird"- **Class 12:** "blackberry"- **Class 13:** "blueberry"- **Class 14:** "bottlecap"- **Class 15:** "broccoli"- **Class 16:** "bus"- **Class 17:** "butterfly"- **Class 18:** "cactus"- **Class 19:** "cake"- **Class 20:** "calculator"- **Class 21:** "camel"- **Class 22:** "camera"- **Class 23:** "candle"- **Class 24:** "cannon"- **Class 25:** "canoe"- **Class 26:** "carrot"- **Class 27:** "castle"- **Class 28:** "cat"- **Class 29:** "ceiling_fan"- **Class 30:** "cell_phone"- **Class 31:** "cello"- **Class 32:** "chair"- **Class 33:** "chandelier"- **Class 34:** "coffee_cup"- **Class 35:** "compass"- **Class 36:** "computer"- **Class 37:** "cow"- **Class 38:** "crab"- **Class 39:** "crocodile"- **Class 40:** "cruise_ship"- **Class 41:** "dog"- **Class 42:** "dolphin"- **Class 43:** "dragon"- **Class 44:** "drums"- **Class 45:** "duck"- **Class 46:** "dumbbell"- **Class 47:** "elephant"- **Class 48:** "eyeglasses"- **Class 49:** "feather"- **Class 50:** "fence"- **Class 51:** "fish"- **Class 52:** "flamingo"- **Class 53:** "flower"- **Class 54:** "foot"- **Class 55:** "fork"- **Class 56:** "frog"- **Class 57:** "giraffe"- **Class 58:** "goatee"- **Class 59:** "grapes"- **Class 60:** "guitar"- **Class 61:** "hammer"- **Class 62:** "helicopter"- **Class 63:** "helmet"- **Class 64:** "horse"- **Class 65:** "kangaroo"- **Class 66:** "lantern"- **Class 67:** "laptop"- **Class 68:** "leaf"- **Class 69:** "lion"- **Class 70:** "lipstick"- **Class 71:** "lobster"- **Class 72:** "microphone"- **Class 73:** "monkey"- **Class 74:** "mosquito"- **Class 75:** "mouse"- **Class 76:** "mug"- **Class 77:** "mushroom"- **Class 78:** "onion"- **Class 79:** "panda"- **Class 80:** "peanut"- **Class 81:** "pear"- **Class 82:** "peas"- **Class 83:** "pencil"- **Class 84:** "penguin"- **Class 85:** "pig"- **Class 86:** "pillow"- **Class 87:** "pineapple"- **Class 88:** "potato"- **Class 89:** "power_outlet"- **Class 90:** "purse"- **Class 91:** "rabbit"- **Class 92:** "raccoon"- **Class 93:** "rhinoceros"- **Class 94:** "rifle"- **Class 95:** "saxophone"- **Class 96:** "screwdriver"- **Class 97:** "sea_turtle"- **Class 98:** "see_saw"- **Class 99:** "sheep"- **Class 100:** "shoe"- **Class 101:** "skateboard"- **Class 102:** "snake"- **Class 103:** "speedboat"- **Class 104:** "spider"- **Class 105:** "squirrel"- **Class 106:** "strawberry"- **Class 107:** "streetlight"- **Class 108:** "string_bean"- **Class 109:** "submarine"- **Class 110:** "swan"- **Class 111:** "table"- **Class 112:** "teapot"- **Class 113:** "teddy-bear"- **Class 114:** "television"- **Class 115:** "the_Eiffel_Tower"- **Class 116:** "the_Great_Wall_of_China"- **Class 117:** "tiger"- **Class 118:** "toe"- **Class 119:** "train"- **Class 120:** "truck"- **Class 121:** "umbrella"- **Class 122:** "vase"- **Class 123:** "watermelon"- **Class 124:** "whale"- **Class 125:** "zebra"# **Run with Transformers🤗**```python!pip install -q transformers torch pillow gradio``````pythonimport gradio as grfrom transformers import AutoImageProcessorfrom transformers import SiglipForImageClassificationfrom transformers.image_utils import load_imagefrom PIL import Imageimport torch# Load model and processormodel_name = "prithivMLmods/Sketch-126-DomainNet"model = SiglipForImageClassification.from_pretrained(model_name)processor = AutoImageProcessor.from_pretrained(model_name)def sketch_classification(image):\"\"\"Predicts the sketch category for an input image.\"\"\n image = Image.fromarray(image).convert(\"RGB\")inputs = processor(images=image, return_tensors=\"pt\")with torch.no_grad():outputs = model(**inputs)logits = outputs.logitsprobs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()labels = {"0": "aircraft_carrier", "1": "alarm_clock", "2": "ant", "3": "anvil", "4": "asparagus","5": "axe", "6": "banana", "7": "basket", "8": "bathtub", "9": "bear","10": "bee", "11": "bird", "12": "blackberry", "13": "blueberry", "14": "bottlecap","15": "broccoli", "16": "bus", "17": "butterfly", "18": "cactus", "19": "cake","20": "calculator", "21": "camel", "22": "camera", "23": "candle", "24": "cannon","25": "canoe", "26": "carrot", "27": "castle", "28": "cat", "29": "ceiling_fan","30": "cell_phone", "31": "cello", "32": "chair", "33": "chandelier", "34": "coffee_cup","35": "compass", "36": "computer", "37": "cow", "38": "crab", "39": "crocodile","40": "cruise_ship", "41": "dog", "42": "dolphin", "43": "dragon", "44": "drums","45": "duck", "46": "dumbbell", "47": "elephant", "48": "eyeglasses", "49": "feather","50": "fence", "51": "fish", "52": "flamingo", "53": "flower", "54": "foot","55": "fork", "56": "frog", "57": "giraffe", "58": "goatee", "59": "grapes","60": "guitar", "61": "hammer", "62": "helicopter", "63": "helmet", "64": "horse","65": "kangaroo", "66": "lantern", "67": "laptop", "68": "leaf", "69": "lion","70": "lipstick", "71": "lobster", "72": "microphone", "73": "monkey", "74": "mosquito","75": "mouse", "76": "mug", "77": "mushroom", "78": "onion", "79": "panda","80": "peanut", "81": "pear", "82": "peas", "83": "pencil", "84": "penguin","85": "pig", "86": "pillow", "87": "pineapple", "88": "potato", "89": "power_outlet","90": "purse", "91": "rabbit", "92": "raccoon", "93": "rhinoceros", "94": "rifle","95": "saxophone", "96": "screwdriver", "97": "sea_turtle", "98": "see_saw", "99": "sheep","100": "shoe", "101": "skateboard", "102": "snake", "103": "speedboat", "104": "spider","105": "squirrel", "106": "strawberry", "107": "streetlight", "108": "string_bean","109": "submarine", "110": "swan", "111": "table", "112": "teapot", "113": "teddy-bear","114": "television", "115": "the_Eiffel_Tower", "116": "the_Great_Wall_of_China","117": "tiger", "118": "toe", "119": "train", "120": "truck", "121": "umbrella","122": "vase", "123": "watermelon", "124": "whale", "125": "zebra"}predictions = {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))}return predictions# Create Gradio interfaceiface = gr.Interface(fn=sketch_classification,inputs=gr.Image(type=\"numpy\"),outputs=gr.Label(label=\"Prediction Scores\"),title=\"Sketch-126-DomainNet Classification\",description=\"Upload a sketch to classify it into one of 126 categories.\")# Launch the appif __name__ == \"__main__\":iface.launch()```---# **Intended Use:**The **Sketch-126-DomainNet** model is designed for sketch image classification. It is capable of categorizing sketches into a wide range of domains—from objects like an "aircraft_carrier" or "alarm_clock" to animals, plants, and everyday items. Potential use cases include:- **Art and Design Applications:** Assisting artists and designers in organizing and retrieving sketches based on content.- **Creative Search Engines:** Enabling sketch-based search for design inspiration.- **Educational Tools:** Helping students and educators in art and design fields with categorization and retrieval of visual resources.- **Computer Vision Research:** Providing a benchmark dataset for sketch recognition and domain adaptation tasks.
README.md+224-1