Description
Pretrained VIT model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP.image_classifier_vit_mit_indoor_scenes
is a English model originally trained by vincentclaes.
Predicted Entities
airport_inside
, bowling
, buffet
, movietheater
, clothingstore
, inside_bus
, fastfood_restaurant
, operating_room
, corridor
, cloister
, stairscase
, auditorium
, meeting_room
, livingroom
, videostore
, bathroom
, inside_subway
, bedroom
, casino
, tv_studio
, classroom
, laboratorywet
, nursery
, office
, deli
, prisoncell
, dentaloffice
, restaurant_kitchen
, studiomusic
, locker_room
, restaurant
, laundromat
, dining_room
, subway
, gameroom
, museum
, mall
, garage
, elevator
, jewelleryshop
, kindergarden
, toystore
, concert_hall
, artstudio
, kitchen
, florist
, waitingroom
, grocerystore
, library
, bar
, computerroom
, trainstation
, lobby
, church_inside
, pantry
, closet
, children_room
, hairsalon
, shoeshop
, greenhouse
, bookstore
, bakery
, poolinside
, warehouse
, winecellar
, hospitalroom
, gym
How to use
image_assembler = ImageAssembler() \
.setInputCol("image") \
.setOutputCol("image_assembler")
imageClassifier = ViTForImageClassification \
.pretrained("image_classifier_vit_mit_indoor_scenes", "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_mit_indoor_scenes", "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.mit_indoor_scenes").predict("hen.JPEG")
Model Information
Model Name: | image_classifier_vit_mit_indoor_scenes |
Compatibility: | Spark NLP 4.1.0+ |
License: | Open Source |
Edition: | Official |
Input Labels: | [image_assembler] |
Output Labels: | [class] |
Language: | en |
Size: | 322.1 MB |