-
Notifications
You must be signed in to change notification settings - Fork 27
/
predictWithMyModel.py
131 lines (110 loc) · 16.8 KB
/
predictWithMyModel.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import timeit
import numpy as np
import base64
from io import BytesIO
import logging
from keras.models import load_model
from keras.preprocessing import image
from keras import backend as K
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
if K.image_data_format() == 'channels_first':
input_shape = (3, 224, 224)
else:
input_shape = (224, 224, 3)
## 定义log
logger = logging.getLogger(__name__)
# 返回一个编译好的模型
# 与之前那个相同
print("开始加载模型:")
logger.info("开始加载模型")
starttime = timeit.default_timer()
model = load_model('data/modelFile/my_model02.h5')
endtime = timeit.default_timer()
print("模型加载完成,用时为:", endtime - starttime)
logger.info("模型加载完成,用时为:%s", endtime - starttime)
def predictWithImagePath(img_path):
"""
根据输入图像path,来分析图像,并作出分类。
:param img_path:图像路径
:return:图像的类别
"""
# 加载图像
img = image.load_img(img_path, target_size = input_shape)
# 图像预处理
x = image.img_to_array(img) / 255.0 # 与训练一致
x = np.expand_dims(x, axis=0)
# 对图像进行分类
preds = model.predict(x) # Predicted: [[1.0000000e+00 1.4072199e-33 1.0080164e-22 3.4663230e-32]]
print('Predicted:', preds) # 输出预测概率
predicted_class_indices = np.argmax(preds,axis=1)
print('predicted_class_indices:', predicted_class_indices) # 输出预测类别的int
labels = {'neutral': 0, 'political': 1, 'porn': 2, 'terrorism': 3}
labels = dict((v, k) for k, v in labels.items())
predicted_class = labels[predicted_class_indices[0]]
# predictions = [labels[k] for k in predicted_class_indices]
print("predicted_class :", predicted_class)
return predicted_class, preds[0][predicted_class_indices[0]]
def predictWithImageBase64(imageBase64String):
"""
根据输入图像Base64,来分析图像,并作出分类。
:param ImageBase64:图像Base64编码
:return:图像的类别
"""
try:
# 加载图像 base64
imageBase64String = imageBase64String.split(',')
if (len(imageBase64String) > 1):
imageBase64String = imageBase64String[1]
else:
imageBase64String = imageBase64String[0]
imageBinaryData = base64.b64decode(imageBase64String) # 解码base64
imageData = BytesIO(imageBinaryData) # 在内存中读取
img = image.load_img(imageData, target_size = input_shape)# 读取图片,并压缩至指定大小
# 图像预处理
x = image.img_to_array(img) / 255.0 # 与训练一致
x = np.expand_dims(x, axis=0)
except:
return "98", "失败,解析 imageBase64String 参数的过程失败。",0,0
# 对图像进行分类
try:
preds = model.predict(x) # Predicted: [[1.0000000e+00 1.4072199e-33 1.0080164e-22 3.4663230e-32]]
except:
return "98", "失败,模型运行失败。",0,0
print('Predicted:', preds) # 输出预测概率
logger.info('Predicted:%s', preds)
predicted_class_indices = np.argmax(preds,axis=1)
print('predicted_class_indices:', predicted_class_indices) # 输出预测类别的int
logger.info('predicted_class_indices:%s', predicted_class_indices)
labels = {'neutral': 0, 'political': 1, 'porn': 2, 'terrorism': 3}
labels = dict((v, k) for k, v in labels.items())
predicted_class = labels[predicted_class_indices[0]]
# predictions = [labels[k] for k in predicted_class_indices]
print("predicted_class :", predicted_class)
logger.info('predicted_class:%s', predicted_class)
return "00", "成功",predicted_class,preds[0][predicted_class_indices[0]]
if __name__ == '__main__':
img_path_list = [
"data/validation/neutral/[www.google.com][1989].jpg", # neutral
"data/validation/neutral/[www.google.com][12706].jpg", # neutral
"data/validation/neutral/[www.google.com][396].jpg", # neutral
"data/validation/neutral/[www.google.com][18507].jpg", # neutral
"data/validation/political/[www.google.com][49474].jpg", # political
"data/validation/political/[www.google.com][96367].jpg", # political
"data/validation/porn/184860_06big.jpg", # porn
"data/validation/porn/[www.google.com][23921].jpg", # porn
"data/validation/terrorism/[www.google.com][76135].jpg", # terrorism
"data/validation/terrorism/[www.google.com][46334].jpg", # terrorism
]
print("开始预测:")
for i in img_path_list:
starttime = timeit.default_timer()
print(predictWithImagePath(i))
endtime = timeit.default_timer()
print("单次调用模型预测时间为:", endtime - starttime)
# 使用base64 处理
base64String = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMTEhUUEhQVFRUWGBgaGBgWGR0XGhoXFxUbGhgdGBgYHSggGholHRYXITEiJSkrMC4uGB8zODMtNygtLisBCgoKDg0OGxAQGyslHR0tLSsrLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS03LS0tLTcyN//AABEIAMIBAwMBIgACEQEDEQH/xAAcAAACAgMBAQAAAAAAAAAAAAAABQQGAgMHAQj/xABDEAABAwIEAgYHBQYFBQEBAAABAAIRAyEEEjFBBVEGEyJhcYEyQpGSobHRBxRS0vAVI2JyweEWM1SC8SRDU6KyRBf/xAAZAQEAAwEBAAAAAAAAAAAAAAAAAQIEAwX/xAAoEQACAgICAgIBBAMBAAAAAAAAAQIRAxIhMQRRE0EiFDJCcSNhwQX/2gAMAwEAAhEDEQA/AOGoQhACEIQAhCEAIQhACEIQAhCEAIQhACEIQAhCEAIQhACEIQAhCEAIQhACEIQAhCEAIQhACEIQAhCEAIXq8QAhCEAIQhACEIQAherxACF6hAeIQhACEIQAhCEAIQvUB4hCEAIQhACEIQAhCEAIQhACEIQH2lSw9MR2We636LM4VmzGe6PolP7RdMH4gTC30uIWUNFLJhFMa02+6PosM1L8DfdCxZVB5FYurBt9goJTJTWUj6jfdH0Xpo0/wM90KF98BAMyDcEbjujZan4tqhckvgluw7D6LGTyLR9FoqBoN2t8Mo+ijvxgG4Cw+/HWZ8VdJCzOs6kdabJ/latYwVF3/ab7FsGPk3DfMBbjiQNvYY+AU7IWRzwzD7jL5D6LV+xGTbJH8oUrrGHmF4ajBu6PZ8lKnRY1t4DTGpb7oUyhwWgPVDvIfKFH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TjefQp6+4qmhCbZa2/aPxMaYp3uU/wAixd9onEzrine6z8qqyFFIneXsfv6Z443Nd3us/KsHdLcYf+8fdb+VI0JSItjCvxqu8y6oSfAfRa/2pV/GfYPooaFZNoq0n2T28ZrjSofYPotrekOJGlV3sH0StCnZ+yNV6HDek+LGlZ3sb9Fm3pbjBpXd7G/RJEKNn7Gq9FgZ02x40xDvdb+VbR094j/qXe6z8qrSE2fsar0WX/HvEf8AUu91n5Uf494j/qXe6z8qrSFOz9jWPosh6ecQ/wBS73WflR/jviH+od7rPyqtoTZ+xrH0WL/HGP8A9Q73WflQq6hNn7GsfQIQhVLAhCEAIQhACEIQAhCEAIQhACEIQAhCEAIQhACEIQAhCEAIQhACEIQAhCEAIQhACEIQAhCEAIQhACEIQAhCEAIQhACEIQAhCEAIQhACEIQAhCEAIQhACEIQAhCEAIQhACEIQAhCEAIQhACEIQH/2Q=="
starttime = timeit.default_timer()
print(predictWithImageBase64(base64String))
endtime = timeit.default_timer()
print("单次调用模型预测时间为:", endtime - starttime)