用于python的nodeflux云客户端库。
nodeflux-cloud的Python项目详细描述
用于python的nodeflux云客户端库
此存储库是用于Nodeflux云分析的Python客户端库它实现了nodefluxapis中定义的api。
安装
pip install nodeflux-cloud
示例
# image_analytic.pyfromnodeflux.cloud.clientsimportImageAnalyticClientfromnodeflux.cloud.requestsimportImageAnalyticRequest,AnalyticTypesclient=ImageAnalyticClient()withopen('some-image.jpg','rb')asimage_file:image_content=image_file.read()requests=[ImageAnalyticRequest(image_content,[AnalyticTypes.FACE_DETECTION,AnalyticTypes.FACE_DEMOGRAPHY,AnalyticTypes.FACE_RECOGNITION,],)]response=client.batch_image_analytic(requests)print(response)
设置凭据并运行示例:
$ exportNODEFLUX_ACCESS_KEY={YOUR_ACCESS_KEY} $ exportNODEFLUX_SECRET_KEY={YOUR_SECRET_KEY} $ python image_analytic.py responses { face_detections { bounding_box { top: 0.24583333730697632 left: 0.2984375059604645 height: 0.6583333015441895 width: 0.3749999701976776 } confidence: 0.871170473098755 } face_recognitions { candidates { face_id: 17136476860973057 confidence: 9.6 }} face_demographics { gender: FEMALE gender_confidence: 0.9403232932090759 age: 19}}
更多示例可以在example目录中找到。
参考
图像分析客户端
Method Name | Request Type | Response Type | Description |
---|---|---|---|
batch_image_analytic | List[ImageAnalyticRequest] | BatchImageAnalyticResponse | Run image analytics for a batch of images |
stream_image_analytic | Iterator[ImageAnalyticRequest] | Iterator[ImageAnalyticResponse] | Run image analytics for a stream of images |
图像分析请求
单个图像请求由Nodeflux云进行分析
Field | Type | Description |
---|---|---|
^{ | ^{ | Image to be analyzed in the Nodeflux Cloud. |
^{ | ^{ | A list of analytics to be performed to the image. |
分析类型
nodeflux云支持的分析类型枚举。
Enums | Description |
---|---|
^{ | Detect faces from an image. |
^{ | Predict age and gender from faces in the image. |
^{ | Search for similar faces in the face recognition database. |
^{ | Detect vehicles from an image. |
^{ | Recognize license plate number of vehicles in an image. |
BatchImageAnalyticResponse
对批处理图像分析请求的响应。
Field | Type | Label | Description |
---|---|---|---|
responses | ImageAnalyticResponse | repeated | Individual responses to image analytics requests within the batch. |
图像分析响应
对图像分析请求的响应。
Field | Type | Label | Description |
---|---|---|---|
error | google.rpc.Status | If set, represents the error message for the operation. Note that filled-in image analytics response are guaranteed to be correct, even when ^{ | |
extensions | google.protobuf.Any | repeated | If present, extension analytics has completed successfully. |
face_detections | nodeflux.analytics.v1beta1.FaceDetection | repeated | If present, face detection has completed successfully. |
face_recognitions | nodeflux.analytics.v1beta1.FaceRecognition | repeated | If present, face recognition has completed successfully. |
face_demographics | nodeflux.analytics.v1beta1.FaceDemography | repeated | If present, face demographics has completed successfully. |
vehicle_detections | nodeflux.analytics.v1beta1.VehicleDetection | repeated | If present, vehicle has completed successfully. |
license_plate_recognitions | nodeflux.analytics.v1beta1.LicensePlateRecognition | repeated | If present, license plate recognition has completed successfully. |