watson_developer_cloud.visual_recognition_v3 module¶
The v3 Visual Recognition service (https://www.ibm.com/watson/developercloud/visual-recognition.html)
- 
class 
VisualRecognitionV3(version, url=’https://gateway-a.watsonplatform.net/visual-recognition/api’, **kwargs)[source]¶ Bases:
watson_developer_cloud.watson_developer_cloud_service.WatsonDeveloperCloudServiceClient for the Visual Recognition service
- 
default_url= ‘https://gateway-a.watsonplatform.net/visual-recognition/api’¶ 
- 
latest_version= ‘2016-05-20’¶ 
- 
get_classifier(classifier_id)[source]¶ Retrieves information about a specific classifier. :param classifier_id: The classifier id
- 
delete_classifier(classifier_id)[source]¶ Deletes a custom classifier with the specified classifier id. :param classifier_id: The classifier id
- 
list_classifiers(verbose=False)[source]¶ Returns a list of user-created and built-in classifiers. (May change in the future to only user-created.) :param verbose: Specifies whether to return more information about each classifier, such as the author
- 
create_classifier(name, **kwargs)[source]¶ Train a new classifier from example images which are uploaded. :param name: The desired short name of the new classifier. :param <NAME>_positive_examples: zip files of images that depict the subject of the new classifier. :param negative_examples: A zip file of images that do not depict the subject of the new classifier. :return:
- 
update_classifier(classifier_id, **kwargs)[source]¶ Updates an existing classifier by adding images to existing or new classes. :param classifier_id: The id of the classifier to update. :param <NAME>_positive_examples: zip files of images that depict the subject of the class. :param negative_examples: A zip file of images that do not depict the subject of any of the classes. :return:
- 
classify(images_file=None, images_url=None, classifier_ids=None, owners=None, threshold=None)[source]¶ Returns a list of classification scores for one or more input images. :param images_file: An image file or zip file of image files to analyze. :param images_url: The url for an image file or zip file of images to analyze. :param classifier_ids: The ids of classifiers to consider. When absent, considers all classifiers. :return:
- 
detect_faces(images_file=None, images_url=None)[source]¶ Returns a list of faces detected. This includes identities for famous people. :param images_file: An image file or zip file of image files to analyze. :param images_url: The url for an image file or zip file of images to analyze. :return:
- 
recognize_text(images_file=None, images_url=None)[source]¶ Returns a list of recognized text :param images_file: An image file or zip file of image files to analyze. :param images_url: The url for an image file or zip file of images to analyze. :return:
- 
create_collection(name)[source]¶ Create a new collection of images to search. You can create a maximum of 5 collections.
Parameters: name – The name of the new collection. The name can be a maximum of 128 UTF8 characters, with no spaces. :return:
- 
get_collection(collection_id)[source]¶ Retrieve collection details :param collection_id: a valid collection id :return:
- 
delete_collection(collection_id)[source]¶ Delete a user created collection :param collection_id: a valid collection id :return:
- 
add_image(collection_id, image_file, metadata=None)[source]¶ Add an image to a collection :param collection_id: a valid collection id :param image_file: a file object of an image :param metadata: metadata describing the image, must be convertable to JSON :return:
- 
list_images(collection_id)[source]¶ list images in a given collection :param collection_id: valid collection id :return:
- 
get_image(collection_id, image_id)[source]¶ Get an image from a collection :param collection_id: valid collection id :param image_id: valid image id :return:
- 
delete_image(collection_id, image_id)[source]¶ delete the specified image :param collection_id: valid collection id :param image_id: valid image id :return:
- 
set_image_metadata(collection_id, image_id, metadata)[source]¶ sets/overwrites the image metadata :param collection_id: valid collection id :param image_id: valid image id :param metadata: key/value hash to set for the metadata :return:
- 
get_image_metadata(collection_id, image_id)[source]¶ Return image metadata :param collection_id: valid collection id :param image_id: valid image id :return:
- 
delete_image_metadata(collection_id, image_id)[source]¶ Delete image metadata :param collection_id: valid collection id :param image_id: valid image id :return:
- 
find_similar(collection_id, image_file, limit=10)[source]¶ find similar images :param collection_id: valid collection id :param image_file: image file to use for searching :param limit: number of returned results (default is 10) :return: {
- “similar_images”:[
 - {
 “image_id”:”dresses_1257263”, “created”:”2016-09-04T21:49:16.908Z”, “metadata”:{
“weight”:10, “cut”:”a line”, “color”:”red”}, “score”:”0.79”
}
],
“image_file”:”red_dress.jpg”, “images_processed”: 1
}
-