English image_classifier_vit_CarViT ViTForImageClassification from abdusahmbzuai

Description

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

Predicted Entities

Toyota, Audi, Dodge, Aston Martin, Chevrolet, Mitsubishi, Kia, Honda, Chrysler, Lexus, Land Rover, Rolls-Royce, Porsche, FIAT, Cadillac, Jaguar, smart, Tesla, Maserati, Buick, GMC, Genesis, McLaren, Bentley, BMW, Lincoln, Subaru, Volvo, Lamborghini, Nissan, Alfa Romeo, Jeep, INFINITI, Mazda, Hyundai, Volkswagen, Ram, Ferrari, Acura, Mercedes-Benz, MINI, Ford

Download Copy S3 URI

How to use


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

imageClassifier = ViTForImageClassification \
    .pretrained("image_classifier_vit_CarViT", "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_CarViT", "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.CarViT").predict("hen.JPEG")

Model Information

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