1.image classification by the pre-trianed ResNet50 model
import keras
import cv2
import numpy as np
def img_classification_demo():
model= keras.applications.ResNet50(weights='imagenet')
src=cv2.imread("/home/amax/Downloads/index.jpeg")
img=cv2.resize(src,(224,224))
img=np.expand_dims(img,0)
proba=model.predict(img)
result=keras.applications.resnet50.decode_predictions(proba)
print result
cv2.putText(src,result[0][0][1],(50,50),cv2.FONT_HERSHEY_PLAIN,2.0,(0,0,255),2,8)
cv2.imshow("input",src)
cv2.waitKey(0)
cv2.destoryAllWindows()
if __name__=="__main__":
img_classification_demo()