Documentation
¶
Overview ¶
Package visualrecognition provides types and functions for IBM Watson Visual Recognition API
Index ¶
- type Age
- type Class
- type ClassScore
- type ClassifiedImage
- type ClassifiedResult
- type Classifier
- type ClassifierListResponse
- type ClassifyParams
- type ClassifyResponse
- type Client
- func (c *Client) ClassifyImages(ctx context.Context, source *xzip.Archiver, params *ClassifyParams) (*ClassifyResponse, error)
- func (c *Client) ClassifyURL(ctx context.Context, url string, params *ClassifyParams) (*ClassifyResponse, error)
- func (c *Client) CreateClassifier(ctx context.Context, name string, positives map[string]*xzip.Archiver, ...) (*Classifier, error)
- func (c *Client) DeleteClassifier(ctx context.Context, id string) (bool, error)
- func (c *Client) DetectFacesOnImages(ctx context.Context, source *xzip.Archiver) (*FaceDetectResponse, error)
- func (c *Client) DetectFacesOnURL(ctx context.Context, url string) (*FaceDetectResponse, error)
- func (c *Client) GetClassifier(ctx context.Context, id string) (*Classifier, error)
- func (c *Client) ListClassifiers(ctx context.Context, verbose bool) (*ClassifierListResponse, error)
- func (c *Client) UpdateClassifier(ctx context.Context, id string, positives map[string]*xzip.Archiver, ...) (*Classifier, error)
- type ErrorResponse
- type Face
- type FaceDetectResponse
- type FaceImage
- type FaceLocation
- type Gender
- type Identity
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Class ¶
type Class struct {
Class string `json:"class"`
}
Class is a class of classifiers on Watson.
type ClassScore ¶
type ClassifiedImage ¶
type ClassifiedImage struct { Classifiers []*ClassifiedResult `json:"classifiers,omitempty"` Image string `json:"image"` }
type ClassifiedResult ¶
type ClassifiedResult struct { Classes []*ClassScore `json:"classes"` ClassifierID string `json:"classifier_id"` Name string `json:"name"` }
type Classifier ¶
type Classifier struct { ClassifierID string `json:"classifier_id"` Name string `json:"name"` Owner string `json:"owner"` Status Status `json:"status"` Created time.Time `json:"created"` Explanation string `json:"explanation"` Classes []*Class `json:"classes"` }
Classifier represents a classifier on Watson
type ClassifierListResponse ¶
type ClassifierListResponse struct {
Classifiers []*Classifier `json:"classifiers"`
}
ClassifierListResponse is a object returned by ListClassifiers function.
type ClassifyParams ¶
type ClassifyResponse ¶
type ClassifyResponse struct { Images []*ClassifiedImage `json:"images,omitempty"` ImageProcessed int `json:"image_processed"` }
ClassifyResponse is a object returned by Datect* functions
type Client ¶
type Client struct { APIKey string Version string Endpoint string // contains filtered or unexported fields }
Client is an API client to access IBM Watson Visual Recognition API
func (*Client) ClassifyImages ¶
func (c *Client) ClassifyImages(ctx context.Context, source *xzip.Archiver, params *ClassifyParams) (*ClassifyResponse, error)
ClassifyImages make a POST request to /v3/classify endpoint with the `images_file` parameter.
func (*Client) ClassifyURL ¶
func (c *Client) ClassifyURL(ctx context.Context, url string, params *ClassifyParams) (*ClassifyResponse, error)
ClassifyURL make a GET request to /v3/classify endpoint with the `url` parameter.
func (*Client) CreateClassifier ¶
func (c *Client) CreateClassifier(ctx context.Context, name string, positives map[string]*xzip.Archiver, negative *xzip.Archiver) (*Classifier, error)
CreateClassifier makes a POST request to '/v3/classifiers' endpoint with the *_positive_examples files. the source map should be a map from class name to *xzip.Archiver so that `{class}_positive_examples` are registered. A class name "negative" is registered as "negative_examples"
func (*Client) DeleteClassifier ¶
DeleteClassifier makes a DELETE request to '/v3/classifiers/{id}` endpoint.
func (*Client) DetectFacesOnImages ¶
func (c *Client) DetectFacesOnImages(ctx context.Context, source *xzip.Archiver) (*FaceDetectResponse, error)
DetectFacesOnImages makes a POST request to `/v3/detect_faces“ with a zipped image file given by sources.
func (*Client) DetectFacesOnURL ¶
DetectFacesOnURL make a GET request to `/v3/detect_faces“ with the `url` parameter.
func (*Client) GetClassifier ¶
GetClassifier makes a GET request to '/v3/classifiers/{id}“ endpoint.
func (*Client) ListClassifiers ¶
func (c *Client) ListClassifiers(ctx context.Context, verbose bool) (*ClassifierListResponse, error)
ListClassifiers makes a GET request to '/v3/classifiers' endpoint
func (*Client) UpdateClassifier ¶
func (c *Client) UpdateClassifier(ctx context.Context, id string, positives map[string]*xzip.Archiver, negative *xzip.Archiver) (*Classifier, error)
UpdateClassifier makes a POST request to '/v3/classifiers/{classifier_id}' endpoint with the *_positive_examples files. the source map should be a map from class name to *xzip.Archiver so that `{class}_positive_examples` are registered. A class name "negative" is registered as "negative_examples"
type ErrorResponse ¶
func (*ErrorResponse) Error ¶
func (er *ErrorResponse) Error() string
type Face ¶
type Face struct { Age *Age `json:"age,omitempty"` FaceLocation *FaceLocation `json:"face_location,omitempty"` Gender *Gender `json:"gender,omitempty"` Identity *Identity `json:"identity,omitempty"` }
Face is face info detected by watson.
type FaceDetectResponse ¶
type FaceDetectResponse struct { Images []*FaceImage `json:"images,omitempty"` ImageProcessed int `json:"image_processed"` }
FaceDetectResponse is a object returned by Datect* functions.
type FaceImage ¶
type FaceImage struct { Faces []*Face `json:"faces,omitempty"` Image string `json:"image,omitempty"` SourceURL string `json:"source_url,omitempty"` ResolvedURL string `json:"resolved_url,omitempty"` }
FaceImage is detected faces info on a image.
type FaceLocation ¶
type FaceLocation struct { Width int64 `json:"width"` Height int64 `json:"height"` Left int64 `json:"left"` Top int64 `json:"top"` }
FaceLocation is a detected location of a face.