OpenVINO API Daisi
This web service is an implementation of Intel OpenVINO API on Daisi Platform which provide optimized deep learning inference.
It provides OpenVINO Models as a service in order to present the capabilities of these models for ML applications.
At this time It contains 8 different deployed models which available on Open Model Zoo for OpenVINO Toolkit.
This implementation in its initial phase and still need alot of work.
Check this demo for more info about the project.
Models
Currently, Deployed OpenVINO Models:
-
Animal Classification
Animal Class:
'cheetah, chetah, Acinonyx jubatus'
-
Road Segmentation
-
Optical Character Detection(OCD)
-
Super Resolution
-
Vehicle Recognition
-
Named Entity Recognition(NER)
source_text = "Intel was founded in Mountain View, California, " \ "in 1968 by Gordon E. Moore, a chemist, and Robert Noyce, " \ "a physicist and co-inventor of the integrated circuit." { 'Extraction': [ {'Entity': 'Intel', 'Type': 'company', 'Score': '0.98'}, { 'Entity': 'Gordon E. Moore, a chemist, and Robert Noyce', 'Type': 'persons', 'Score': '0.83' }, {'Entity': 'Mountain View', 'Type': 'city', 'Score': '0.79'}, {'Entity': 'California', 'Type': 'state', 'Score': '0.98'} ] }
-
Handwritten OCR (Chinese & Japanese)
Recognized Text:
'人有悲欢离合,月有阴睛圆缺,此事古难全。'
-
Interactive Question Answering
sources = ["https://en.wikipedia.org/wiki/OpenVINO"] question = "What does OpenVINO refers to?" { 'Question': 'What does OpenVINO refers to?', 'Answer': 'Open Visual Inference and Neural network Optimization', 'Score': '0.85' }
Update Note
Regarding deploying and running the project on Daisi, unfortunately Daisi platform has been shut down and no longer support running FAAS on the cloud
So I will migrate the project soon to Hugging Face which is more reliable plateform for deploying ML models
How to call it
-First load OpenVINO API Daisi
import pydaisi as pyd openvino_api_v3 = pyd.Daisi("oghli/OpenVINO API v3")
-
Animal Classification Model
Call the
cv_animal_classify
end point, passing theimage_source
to classify it, you can pass image source either fromdata/animal_classify/
directory or from validurl
of the imageimg = "data/animal_classify/test.jpg" result = openvino_api_v3.cv_animal_classify(img).value result
-
Road Segmentation Model
Call the
cv_road_segmentation
end point, passing theimage_source
to segment roads in it, you can pass image source either fromdata/road_segmentation/
directory or from validurl
of the imageimg = "data/road_segmentation/empty_road_mapillary.jpg" result = openvino_api_v3.cv_road_segmentation(img).value
To show the result image import
matplotlib
then useplt.imshow
methodimport matplotlib.pyplot as plt plt.figure(figsize=(15, 5)) plt.imshow(result)
-
Optical Character Detection Model
Call the
cv_ocd
end point, passing theimage_source
to detect text in it, you can pass image source either fromdata/ocr/
directory or from validurl
of the imageimg = "data/ocr/intel_rnb.jpg" result = openvino_api_v3.cv_ocd(img).value plt.figure(figsize=(20, 10)) plt.imshow(result)
-
Super Resolution Model
Call the
cv_superresolution
end point, passing theimage_source
to enhance it, you can pass image source either from a directory path or from validurl
of the imageimg = "https://i.imgur.com/R5ovXDO.jpg" result = openvino_api_v3.cv_superresolution(img).value plt.figure(figsize=(20, 10)) plt.imshow(result[1])
-
Vehicle Recognition Model
Call the
cv_vehicle_rec
end point, passing theimage_source
to recognize Vehicles in it, you can pass image source either from a directory path or from validurl
of the imageimg = "https://i.imgur.com/IvwQdz5.jpg" result = openvino_api_v3.cv_vehicle_rec(img).value plt.figure(figsize=(20, 10)) plt.imshow(result)
-
Named Entity Recognition Model
Call the
analyze_entities
end point, passing thesource_text
to analyze entities in itsource_text = "Intel was founded in Mountain View, California, " \ "in 1968 by Gordon E. Moore, a chemist, and Robert Noyce, " \ "a physicist and co-inventor of the integrated circuit." result = openvino_api_v3.analyze_entities(source_text).value result
-
Handwritten OCR Model
Call the
handwritten_ocr
end point, passing theimage_source
and the selected languagelang
to recognize text in it, you can pass image source either fromdata/handwritten_ocr/
directory or from validurl
of the imageimg = "data/handwritten_ocr/handwritten_chinese_test.jpg" result = openvino_api_v3.handwritten_ocr(img, "ch").value result
Set lang using
"ch"
for chinesse language or"jap"
for japanese languageimg = "data/handwritten_ocr/handwritten_japanese_test.png" result = openvino_api_v3.handwritten_ocr(img, "jap").value result
-
Interactive Question Answering Model
Call the
question_answering
end point, passing thesources
as array and thequestion
to answer it using the provided sources, you can pass sources either as stringtext
or from validurl
for the information resourcesources = ["https://en.wikipedia.org/wiki/OpenVINO"] question = "What does OpenVINO refers to?" result = openvino_api_v3.question_answering(sources, question).value result
sources = ["Computational complexity theory is a branch of the theory of computation in theoretical computer " "science that focuses on classifying computational problems according to their inherent difficulty, " "and relating those classes to each other. A computational problem is understood to be a task that " "is in principle amenable to being solved by a computer, which is equivalent to stating that the " "problem may be solved by mechanical application of mathematical steps, such as an algorithm."] question = "what branch of the theory of computation in theoretical computer science that focuses on classifying computational problems?" result = openvino_api_v3.question_answering(sources, example_question=question).value result
Please support me by starring the repository.
Contributor: Mohamad Oghli.