-
Notifications
You must be signed in to change notification settings - Fork 0
/
imagerecog.py
28 lines (21 loc) · 989 Bytes
/
imagerecog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from imageai.Prediction import ImagePrediction
import os
execution_path = os.getcwd()
prediction = ImagePrediction()
prediction.setModelTypeAsInceptionV3()
prediction.setModelPath(os.path.join(execution_path, "inception_v3_weights_tf_dim_ordering_tf_kernels.h5" ))
prediction.loadModel()
predictions, probabilities = prediction.predictImage(os.path.join(execution_path, "house.jpg"), result_count=5 )
for eachPrediction, eachProbability in zip(predictions, probabilities):
print(eachPrediction , " : " , eachProbability)
# The Model here is pretty sure that it is a boathouse by about 93%.
# boathouse : 92.79947876930237
# beacon : 7.10703432559967
# dock : 0.011492978956084698
# church : 0.01087701748474501
# breakwater : 0.006240638322196901
'''
ImageAI
ImageAI, an open source python library built to empower developers to build applications and systems with self-contained Computer Vision capabilities",
"https://github.com/OlafenwaMoses/ImageAI",
'''