English image_classifier_vit_base_beans_demo_v5 ViTForImageClassification from Miss

Description

Pretrained VIT model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP.image_classifier_vit_base_beans_demo_v5 is a English model originally trained by Miss.

Predicted Entities

lion, tulip, keyboard, cra, bus, dolphin, plate, beaver, skyscraper, tiger, bear, trout, porcupine, sea, shrew, squirrel, snail, leopard, palm_tree, turtle, orchid, skunk, hamster, oak_tree, lizard, bridge, sunflower, pickup_truck, orange, man, mouse, cup, whale, seal, television, snake, crocodile, cockroach, bed, otter, caterpillar, woman, rocket, butterfly, bicycle, spider, motorcycle, lawn_mower, wolf, raccoon, can, cloud, clock, worm, tank, ray, house, girl, dinosaur, willow_tree, maple_tree, kangaroo, cattle, bee, chair, aquarium_fish, shark, baby, tractor, sweet_pepper, plain, lamp, boy, telephone, mushroom, couch, apple, wardrobe, train, pine_tree, pear, road, mountain, castle, bowl, lobster, elephant, beetle, possum, forest, flatfish, poppy, fox, streetcar, chimpanzee, bottle, rose, rabbit, table, camel

Download Copy S3 URI

How to use


image_assembler = ImageAssembler() \
    .setInputCol("image") \
    .setOutputCol("image_assembler")

imageClassifier = ViTForImageClassification \
    .pretrained("image_classifier_vit_base_beans_demo_v5", "en")\
    .setInputCols("image_assembler") \
    .setOutputCol("class")

pipeline = Pipeline(stages=[
    image_assembler,
    imageClassifier,
])

pipelineModel = pipeline.fit(imageDF)

pipelineDF = pipelineModel.transform(imageDF)

val imageAssembler = new ImageAssembler()
.setInputCol("image")
.setOutputCol("image_assembler")

val imageClassifier = ViTForImageClassification
.pretrained("image_classifier_vit_base_beans_demo_v5", "en")
.setInputCols("image_assembler")
.setOutputCol("class")

val pipeline = new Pipeline().setStages(Array(imageAssembler, imageClassifier))

val pipelineModel = pipeline.fit(imageDF)

val pipelineDF = pipelineModel.transform(imageDF)

import nlu
import requests
response = requests.get('https://raw.githubusercontent.com/JohnSnowLabs/spark-nlp/master/docs/assets/images/hen.JPEG')
with open('hen.JPEG', 'wb') as f:
    f.write(response.content)
nlu.load("en.classify_image.base_beans_demo_v5").predict("hen.JPEG")

Model Information

Model Name: image_classifier_vit_base_beans_demo_v5
Compatibility: Spark NLP 4.1.0+
License: Open Source
Edition: Official
Input Labels: [image_assembler]
Output Labels: [class]
Language: en
Size: 322.2 MB