Description
Pretrained VIT model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP.image_classifier_vit_exper1_mesum5
is a English model originally trained by sudo-s.
Predicted Entities
45
, 98
, 113
, 34
, 67
, 120
, 93
, 142
, 147
, 12
, 66
, 89
, 51
, 124
, 84
, 8
, 73
, 78
, 19
, 100
, 23
, 62
, 135
, 128
, 4
, 121
, 88
, 77
, 40
, 110
, 15
, 11
, 104
, 90
, 9
, 141
, 139
, 132
, 44
, 33
, 117
, 22
, 56
, 55
, 26
, 134
, 50
, 123
, 37
, 68
, 61
, 107
, 13
, 46
, 99
, 24
, 94
, 83
, 35
, 16
, 79
, 5
, 103
, 112
, 72
, 10
, 59
, 144
, 87
, 48
, 21
, 116
, 76
, 138
, 54
, 43
, 148
, 127
, 65
, 71
, 57
, 108
, 32
, 80
, 106
, 137
, 82
, 49
, 6
, 126
, 36
, 1
, 39
, 140
, 17
, 25
, 60
, 14
, 133
, 47
, 122
, 111
, 102
, 31
, 96
, 69
, 95
, 58
, 145
, 64
, 53
, 42
, 75
, 115
, 109
, 0
, 20
, 27
, 70
, 2
, 86
, 38
, 81
, 118
, 92
, 125
, 18
, 101
, 30
, 7
, 143
, 97
, 130
, 114
, 129
, 29
, 41
, 105
, 63
, 3
, 74
, 91
, 52
, 85
, 131
, 28
, 119
, 136
, 146
How to use
image_assembler = ImageAssembler() \
.setInputCol("image") \
.setOutputCol("image_assembler")
imageClassifier = ViTForImageClassification \
.pretrained("image_classifier_vit_exper1_mesum5", "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_exper1_mesum5", "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.exper1_mesum5").predict("hen.JPEG")
Model Information
Model Name: | image_classifier_vit_exper1_mesum5 |
Compatibility: | Spark NLP 4.1.0+ |
License: | Open Source |
Edition: | Official |
Input Labels: | [image_assembler] |
Output Labels: | [class] |
Language: | en |
Size: | 322.3 MB |