Python realizes image recognition car function
The example in this article shares the specific code of python to realize the image recognition of the car for your reference. The specific content is as follows
Ready to work
1、 Log in to the developer console
2、 Install pip install baidu-aip module
- Principle: Read the binary information of the picture, call Baidu Cloud third-party interface, pass the picture binary information to the interface, get the information returned by the interface, and process the output
- Baidu Cloud prepares third-party interfaces, introduction to example applications
- Create an example application
- After the creation is complete, you can see the three required parameters App ID, API Key, Secret Key
Code
from aip import AipImageClassify
"""
APPID AK SK
"""
# Fill in the three parameters obtained in Baidu Yunchuang's instance application below
APP_ID ='1***7'
API_KEY ='U***O'
SECRET_KEY ='****'
client =AipImageClassify(APP_ID, API_KEY, SECRET_KEY)
# Open the picture file and read the binary picture information
def get_file_content(file_path):withopen(file_path,'rb')as f:return f.read()
image =get_file_content('111.jpg')"""
Call vehicle identification
"""
# {" top_num":1}Represents the first of multiple models returned
# Call the carDectect method of the client object
print(client.carDetect(image, options={"top_num":1})["result"][0]["name"])
Show results
The above is the whole content of this article, I hope it will be helpful to your study, and I hope you can support website (zalou.cn).
Articles you may be interested in:
- Python realizes the recognition of similar pictures summary
- Python+Opencv to identify two similar images
- Python an example of image recognition using the SIFT method of the Scipy package tutorial
- Python realize the recognition of handwritten digits Python picture reading and processing
- Python3 one line of code to realize image text recognition example
- Python Image recognition function example implemented by programming
- Python+opencv recognizes circles in pictures
- Example of the realization of the recognition of a single picture of python tensorflow learning
- Realization of static pictures based on python3 OpenCV3 face recognition
- Python to realize the analysis of the method of recognizing image content