class Azure::CognitiveServices::Customvisiontraining::V2_2::CustomvisiontrainingClient
A service client - single point of access to the REST API.
Attributes
@return [String] The preferred language for the response.
@return [String]
@return [String] the base URI of the service.
@return Credentials needed for the client to connect to Azure
.
@return [String] Supported Cognitive Services endpoints
@return [Boolean] Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
@return [Integer] The retry timeout in seconds for Long Running Operations. Default value is 30.
Public Class Methods
Creates initializes a new instance of the CustomvisiontrainingClient
class. @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. @param options [Array] filters to be applied to the HTTP requests.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 43 def initialize(credentials = nil, options = nil) super(credentials, options) @base_url = '{Endpoint}/customvision/v2.2/Training' fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil? @credentials = credentials @accept_language = 'en-US' @long_running_operation_retry_timeout = 30 @generate_client_request_id = true add_telemetry end
Public Instance Methods
Create a set of image regions.
This API accepts a batch of image regions, and optionally tags, to update existing images with region information. There is a limit of 64 entries in the batch.
@param project_id The project id. @param batch [ImageRegionCreateBatch] Batch of image regions which include a tag and bounding box. Limited to 64. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [ImageRegionCreateSummary] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 741 def create_image_regions(project_id, batch, custom_headers:nil) response = create_image_regions_async(project_id, batch, custom_headers:custom_headers).value! response.body unless response.nil? end
Create a set of image regions.
This API accepts a batch of image regions, and optionally tags, to update existing images with region information. There is a limit of 64 entries in the batch.
@param project_id The project id. @param batch [ImageRegionCreateBatch] Batch of image regions which include a tag and bounding box. Limited to 64. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 780 def create_image_regions_async(project_id, batch, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'batch is nil' if batch.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::ImageRegionCreateBatch.mapper() request_content = self.serialize(request_mapper, batch) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'projects/{projectId}/images/regions' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::ImageRegionCreateSummary.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Create a set of image regions.
This API accepts a batch of image regions, and optionally tags, to update existing images with region information. There is a limit of 64 entries in the batch.
@param project_id The project id. @param batch [ImageRegionCreateBatch] Batch of image regions which include a tag and bounding box. Limited to 64. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 761 def create_image_regions_with_http_info(project_id, batch, custom_headers:nil) create_image_regions_async(project_id, batch, custom_headers:custom_headers).value! end
Add the provided images to the set of training images.
This API accepts body content as multipart/form-data and application/octet-stream. When using multipart multiple image files can be sent at once, with a maximum of 64 files
@param project_id The project id. @param image_data Binary image data. @param tag_ids [Array<String>] The tags ids with which to tag each image. Limited to 20. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [ImageCreateSummary] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1366 def create_images_from_data(project_id, image_data, tag_ids:nil, custom_headers:nil) response = create_images_from_data_async(project_id, image_data, tag_ids:tag_ids, custom_headers:custom_headers).value! response.body unless response.nil? end
Add the provided images to the set of training images.
This API accepts body content as multipart/form-data and application/octet-stream. When using multipart multiple image files can be sent at once, with a maximum of 64 files
@param project_id The project id. @param image_data Binary image data. @param tag_ids [Array<String>] The tags ids with which to tag each image. Limited to 20. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1407 def create_images_from_data_async(project_id, image_data, tag_ids:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'image_data is nil' if image_data.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'multipart/form-data' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? # Set Form Data form_data = {} form_data['imageData'] = image_data.to_s unless image_data.to_s.nil? path_template = 'projects/{projectId}/images' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, query_params: {'tagIds' => tag_ids.nil? ? nil : tag_ids.join(',')}, headers: request_headers.merge(custom_headers || {}), body: URI.encode_www_form(form_data), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::ImageCreateSummary.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Add the provided images to the set of training images.
This API accepts body content as multipart/form-data and application/octet-stream. When using multipart multiple image files can be sent at once, with a maximum of 64 files
@param project_id The project id. @param image_data Binary image data. @param tag_ids [Array<String>] The tags ids with which to tag each image. Limited to 20. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1387 def create_images_from_data_with_http_info(project_id, image_data, tag_ids:nil, custom_headers:nil) create_images_from_data_async(project_id, image_data, tag_ids:tag_ids, custom_headers:custom_headers).value! end
Add the provided batch of images to the set of training images.
This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags.
@param project_id The project id. @param batch [ImageFileCreateBatch] The batch of image files to add. Limited to 64 images and 20 tags per batch. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [ImageCreateSummary] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1568 def create_images_from_files(project_id, batch, custom_headers:nil) response = create_images_from_files_async(project_id, batch, custom_headers:custom_headers).value! response.body unless response.nil? end
Add the provided batch of images to the set of training images.
This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags.
@param project_id The project id. @param batch [ImageFileCreateBatch] The batch of image files to add. Limited to 64 images and 20 tags per batch. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1605 def create_images_from_files_async(project_id, batch, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'batch is nil' if batch.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::ImageFileCreateBatch.mapper() request_content = self.serialize(request_mapper, batch) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'projects/{projectId}/images/files' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::ImageCreateSummary.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Add the provided batch of images to the set of training images.
This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags.
@param project_id The project id. @param batch [ImageFileCreateBatch] The batch of image files to add. Limited to 64 images and 20 tags per batch. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1587 def create_images_from_files_with_http_info(project_id, batch, custom_headers:nil) create_images_from_files_async(project_id, batch, custom_headers:custom_headers).value! end
Add the specified predicted images to the set of training images.
This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags.
@param project_id The project id. @param batch [ImageIdCreateBatch] Image and tag ids. Limited to 64 images and 20 tags per batch. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [ImageCreateSummary] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1792 def create_images_from_predictions(project_id, batch, custom_headers:nil) response = create_images_from_predictions_async(project_id, batch, custom_headers:custom_headers).value! response.body unless response.nil? end
Add the specified predicted images to the set of training images.
This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags.
@param project_id The project id. @param batch [ImageIdCreateBatch] Image and tag ids. Limited to 64 images and 20 tags per batch. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1829 def create_images_from_predictions_async(project_id, batch, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'batch is nil' if batch.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::ImageIdCreateBatch.mapper() request_content = self.serialize(request_mapper, batch) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'projects/{projectId}/images/predictions' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::ImageCreateSummary.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Add the specified predicted images to the set of training images.
This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags.
@param project_id The project id. @param batch [ImageIdCreateBatch] Image and tag ids. Limited to 64 images and 20 tags per batch. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1811 def create_images_from_predictions_with_http_info(project_id, batch, custom_headers:nil) create_images_from_predictions_async(project_id, batch, custom_headers:custom_headers).value! end
Add the provided images urls to the set of training images.
This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags.
@param project_id The project id. @param batch [ImageUrlCreateBatch] Image urls and tag ids. Limited to 64 images and 20 tags per batch. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [ImageCreateSummary] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1680 def create_images_from_urls(project_id, batch, custom_headers:nil) response = create_images_from_urls_async(project_id, batch, custom_headers:custom_headers).value! response.body unless response.nil? end
Add the provided images urls to the set of training images.
This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags.
@param project_id The project id. @param batch [ImageUrlCreateBatch] Image urls and tag ids. Limited to 64 images and 20 tags per batch. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1717 def create_images_from_urls_async(project_id, batch, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'batch is nil' if batch.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::ImageUrlCreateBatch.mapper() request_content = self.serialize(request_mapper, batch) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'projects/{projectId}/images/urls' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::ImageCreateSummary.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Add the provided images urls to the set of training images.
This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags.
@param project_id The project id. @param batch [ImageUrlCreateBatch] Image urls and tag ids. Limited to 64 images and 20 tags per batch. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1699 def create_images_from_urls_with_http_info(project_id, batch, custom_headers:nil) create_images_from_urls_async(project_id, batch, custom_headers:custom_headers).value! end
Create a project.
@param name [String] Name of the project. @param description [String] The description of the project. @param domain_id The id of the domain to use for this project. Defaults to General. @param classification_type [Enum] The type of classifier to create for this project. Possible values include: 'Multiclass', 'Multilabel' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Project] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2903 def create_project(name, description:nil, domain_id:nil, classification_type:nil, custom_headers:nil) response = create_project_async(name, description:description, domain_id:domain_id, classification_type:classification_type, custom_headers:custom_headers).value! response.body unless response.nil? end
Create a project.
@param name [String] Name of the project. @param description [String] The description of the project. @param domain_id The id of the domain to use for this project. Defaults to General. @param classification_type [Enum] The type of classifier to create for this project. Possible values include: 'Multiclass', 'Multilabel' @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2940 def create_project_async(name, description:nil, domain_id:nil, classification_type:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'name is nil' if name.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'name' => name,'description' => description,'domainId' => domain_id,'classificationType' => classification_type}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::Project.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Create a project.
@param name [String] Name of the project. @param description [String] The description of the project. @param domain_id The id of the domain to use for this project. Defaults to General. @param classification_type [Enum] The type of classifier to create for this project. Possible values include: 'Multiclass', 'Multilabel' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2922 def create_project_with_http_info(name, description:nil, domain_id:nil, classification_type:nil, custom_headers:nil) create_project_async(name, description:description, domain_id:domain_id, classification_type:classification_type, custom_headers:custom_headers).value! end
Create a tag for the project.
@param project_id The project id. @param name [String] The tag name. @param description [String] Optional description for the tag. @param type [Enum] Optional type for the tag. Possible values include: 'Regular', 'Negative' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Tag] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4357 def create_tag(project_id, name, description:nil, type:nil, custom_headers:nil) response = create_tag_async(project_id, name, description:description, type:type, custom_headers:custom_headers).value! response.body unless response.nil? end
Create a tag for the project.
@param project_id The project id. @param name [String] The tag name. @param description [String] Optional description for the tag. @param type [Enum] Optional type for the tag. Possible values include: 'Regular', 'Negative' @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4392 def create_tag_async(project_id, name, description:nil, type:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'name is nil' if name.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/tags' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, query_params: {'name' => name,'description' => description,'type' => type}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::Tag.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Create a tag for the project.
@param project_id The project id. @param name [String] The tag name. @param description [String] Optional description for the tag. @param type [Enum] Optional type for the tag. Possible values include: 'Regular', 'Negative' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4375 def create_tag_with_http_info(project_id, name, description:nil, type:nil, custom_headers:nil) create_tag_async(project_id, name, description:description, type:type, custom_headers:custom_headers).value! end
Delete a set of image regions.
@param project_id The project id. @param region_ids [Array<String>] Regions to delete. Limited to 64. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 850 def delete_image_regions(project_id, region_ids, custom_headers:nil) response = delete_image_regions_async(project_id, region_ids, custom_headers:custom_headers).value! nil end
Delete a set of image regions.
@param project_id The project id. @param region_ids [Array<String>] Regions to delete. Limited to 64. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 879 def delete_image_regions_async(project_id, region_ids, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'region_ids is nil' if region_ids.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/images/regions' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, query_params: {'regionIds' => region_ids.nil? ? nil : region_ids.join(',')}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 204 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end
Delete a set of image regions.
@param project_id The project id. @param region_ids [Array<String>] Regions to delete. Limited to 64. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 865 def delete_image_regions_with_http_info(project_id, region_ids, custom_headers:nil) delete_image_regions_async(project_id, region_ids, custom_headers:custom_headers).value! end
Delete images from the set of training images.
@param project_id The project id. @param image_ids [Array<String>] Ids of the images to be deleted. Limited to 256 images per batch. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1478 def delete_images(project_id, image_ids, custom_headers:nil) response = delete_images_async(project_id, image_ids, custom_headers:custom_headers).value! nil end
Delete images from the set of training images.
@param project_id The project id. @param image_ids [Array<String>] Ids of the images to be deleted. Limited to 256 images per batch. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1509 def delete_images_async(project_id, image_ids, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'image_ids is nil' if image_ids.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/images' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, query_params: {'imageIds' => image_ids.nil? ? nil : image_ids.join(',')}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 204 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end
Delete images from the set of training images.
@param project_id The project id. @param image_ids [Array<String>] Ids of the images to be deleted. Limited to 256 images per batch. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1494 def delete_images_with_http_info(project_id, image_ids, custom_headers:nil) delete_images_async(project_id, image_ids, custom_headers:custom_headers).value! end
Delete a specific iteration of a project.
@param project_id The project id. @param iteration_id The iteration id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3467 def delete_iteration(project_id, iteration_id, custom_headers:nil) response = delete_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value! nil end
Delete a specific iteration of a project.
@param project_id The project id. @param iteration_id The iteration id. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3496 def delete_iteration_async(project_id, iteration_id, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'iteration_id is nil' if iteration_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/iterations/{iterationId}' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id,'iterationId' => iteration_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 204 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end
Delete a specific iteration of a project.
@param project_id The project id. @param iteration_id The iteration id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3482 def delete_iteration_with_http_info(project_id, iteration_id, custom_headers:nil) delete_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value! end
Delete a set of predicted images and their associated prediction results.
@param project_id The project id. @param ids [Array<String>] The prediction ids. Limited to 64. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2004 def delete_prediction(project_id, ids, custom_headers:nil) response = delete_prediction_async(project_id, ids, custom_headers:custom_headers).value! nil end
Delete a set of predicted images and their associated prediction results.
@param project_id The project id. @param ids [Array<String>] The prediction ids. Limited to 64. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2033 def delete_prediction_async(project_id, ids, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'ids is nil' if ids.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/predictions' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, query_params: {'ids' => ids.nil? ? nil : ids.join(',')}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 204 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end
Delete a set of predicted images and their associated prediction results.
@param project_id The project id. @param ids [Array<String>] The prediction ids. Limited to 64. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2019 def delete_prediction_with_http_info(project_id, ids, custom_headers:nil) delete_prediction_async(project_id, ids, custom_headers:custom_headers).value! end
Delete a specific project.
@param project_id The project id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3090 def delete_project(project_id, custom_headers:nil) response = delete_project_async(project_id, custom_headers:custom_headers).value! nil end
Delete a specific project.
@param project_id The project id. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3117 def delete_project_async(project_id, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 204 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end
Delete a specific project.
@param project_id The project id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3104 def delete_project_with_http_info(project_id, custom_headers:nil) delete_project_async(project_id, custom_headers:custom_headers).value! end
Delete a tag from the project.
@param project_id The project id. @param tag_id Id of the tag to be deleted. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4058 def delete_tag(project_id, tag_id, custom_headers:nil) response = delete_tag_async(project_id, tag_id, custom_headers:custom_headers).value! nil end
Delete a tag from the project.
@param project_id The project id. @param tag_id Id of the tag to be deleted. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4087 def delete_tag_async(project_id, tag_id, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'tag_id is nil' if tag_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/tags/{tagId}' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id,'tagId' => tag_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 204 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end
Delete a tag from the project.
@param project_id The project id. @param tag_id Id of the tag to be deleted. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4073 def delete_tag_with_http_info(project_id, tag_id, custom_headers:nil) delete_tag_async(project_id, tag_id, custom_headers:custom_headers).value! end
Export a trained iteration.
@param project_id The project id. @param iteration_id The iteration id. @param platform [Enum] The target platform. Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX' @param flavor [Enum] The flavor of the target platform. Possible values include: 'Linux', 'Windows', 'ONNX10', 'ONNX12' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Export] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3856 def export_iteration(project_id, iteration_id, platform, flavor:nil, custom_headers:nil) response = export_iteration_async(project_id, iteration_id, platform, flavor:flavor, custom_headers:custom_headers).value! response.body unless response.nil? end
Export a trained iteration.
@param project_id The project id. @param iteration_id The iteration id. @param platform [Enum] The target platform. Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX' @param flavor [Enum] The flavor of the target platform. Possible values include: 'Linux', 'Windows', 'ONNX10', 'ONNX12' @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3893 def export_iteration_async(project_id, iteration_id, platform, flavor:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'iteration_id is nil' if iteration_id.nil? fail ArgumentError, 'platform is nil' if platform.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/iterations/{iterationId}/export' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id,'iterationId' => iteration_id}, query_params: {'platform' => platform,'flavor' => flavor}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::Export.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Export a trained iteration.
@param project_id The project id. @param iteration_id The iteration id. @param platform [Enum] The target platform. Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX' @param flavor [Enum] The flavor of the target platform. Possible values include: 'Linux', 'Windows', 'ONNX10', 'ONNX12' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3875 def export_iteration_with_http_info(project_id, iteration_id, platform, flavor:nil, custom_headers:nil) export_iteration_async(project_id, iteration_id, platform, flavor:flavor, custom_headers:custom_headers).value! end
Get information about a specific domain.
@param domain_id The id of the domain to get information about. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Domain] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 223 def get_domain(domain_id, custom_headers:nil) response = get_domain_async(domain_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Get information about a specific domain.
@param domain_id The id of the domain to get information about. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 250 def get_domain_async(domain_id, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'domain_id is nil' if domain_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'domains/{domainId}' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'domainId' => domain_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::Domain.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get information about a specific domain.
@param domain_id The id of the domain to get information about. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 237 def get_domain_with_http_info(domain_id, custom_headers:nil) get_domain_async(domain_id, custom_headers:custom_headers).value! end
Get a list of the available domains.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 122 def get_domains(custom_headers:nil) response = get_domains_async(custom_headers:custom_headers).value! response.body unless response.nil? end
Get a list of the available domains.
@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 147 def get_domains_async(custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'domains' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'DomainElementType', type: { name: 'Composite', class_name: 'Domain' } } } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get a list of the available domains.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 135 def get_domains_with_http_info(custom_headers:nil) get_domains_async(custom_headers:custom_headers).value! end
Get the list of exports for a specific iteration.
@param project_id The project id. @param iteration_id The iteration id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3743 def get_exports(project_id, iteration_id, custom_headers:nil) response = get_exports_async(project_id, iteration_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Get the list of exports for a specific iteration.
@param project_id The project id. @param iteration_id The iteration id. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3772 def get_exports_async(project_id, iteration_id, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'iteration_id is nil' if iteration_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/iterations/{iterationId}/export' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id,'iterationId' => iteration_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'ExportElementType', type: { name: 'Composite', class_name: 'Export' } } } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get the list of exports for a specific iteration.
@param project_id The project id. @param iteration_id The iteration id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3758 def get_exports_with_http_info(project_id, iteration_id, custom_headers:nil) get_exports_async(project_id, iteration_id, custom_headers:custom_headers).value! end
Gets the number of images tagged with the provided {tagIds} that have prediction results from training for the provided iteration {iterationId}.
The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids [Array<String>] A list of tags ids to filter the images to count. Defaults to all tags when null. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Number] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2682 def get_image_performance_count(project_id, iteration_id, tag_ids:nil, custom_headers:nil) response = get_image_performance_count_async(project_id, iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets the number of images tagged with the provided {tagIds} that have prediction results from training for the provided iteration {iterationId}.
The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids [Array<String>] A list of tags ids to filter the images to count. Defaults to all tags when null. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2727 def get_image_performance_count_async(project_id, iteration_id, tag_ids:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'iteration_id is nil' if iteration_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/iterations/{iterationId}/performance/images/count' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id,'iterationId' => iteration_id}, query_params: {'tagIds' => tag_ids.nil? ? nil : tag_ids.join(',')}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Number' } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Gets the number of images tagged with the provided {tagIds} that have prediction results from training for the provided iteration {iterationId}.
The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids [Array<String>] A list of tags ids to filter the images to count. Defaults to all tags when null. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2705 def get_image_performance_count_with_http_info(project_id, iteration_id, tag_ids:nil, custom_headers:nil) get_image_performance_count_async(project_id, iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value! end
Get image with its prediction for a given project iteration.
This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch. The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids [Array<String>] A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2532 def get_image_performances(project_id, iteration_id, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil) response = get_image_performances_async(project_id, iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value! response.body unless response.nil? end
Get image with its prediction for a given project iteration.
This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch. The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids [Array<String>] A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2593 def get_image_performances_async(project_id, iteration_id, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'iteration_id is nil' if iteration_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/iterations/{iterationId}/performance/images' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id,'iterationId' => iteration_id}, query_params: {'tagIds' => tag_ids.nil? ? nil : tag_ids.join(','),'orderBy' => order_by,'take' => take,'skip' => skip}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'ImagePerformanceElementType', type: { name: 'Composite', class_name: 'ImagePerformance' } } } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get image with its prediction for a given project iteration.
This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch. The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids [Array<String>] A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2563 def get_image_performances_with_http_info(project_id, iteration_id, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil) get_image_performances_async(project_id, iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value! end
Get region proposals for an image. Returns empty array if no proposals are found.
This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found.
@param project_id The project id. @param image_id The image id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [ImageRegionProposal] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1904 def get_image_region_proposals(project_id, image_id, custom_headers:nil) response = get_image_region_proposals_async(project_id, image_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Get region proposals for an image. Returns empty array if no proposals are found.
This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found.
@param project_id The project id. @param image_id The image id. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1941 def get_image_region_proposals_async(project_id, image_id, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'image_id is nil' if image_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = '{projectId}/images/{imageId}/regionproposals' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id,'imageId' => image_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::ImageRegionProposal.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get region proposals for an image. Returns empty array if no proposals are found.
This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found.
@param project_id The project id. @param image_id The image id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1923 def get_image_region_proposals_with_http_info(project_id, image_id, custom_headers:nil) get_image_region_proposals_async(project_id, image_id, custom_headers:custom_headers).value! end
Get images by id for a given project iteration.
This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the current workspace is used.
@param project_id The project id. @param image_ids [Array<String>] The list of image ids to retrieve. Limited to 256. @param iteration_id The iteration id. Defaults to workspace. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1239 def get_images_by_ids(project_id, image_ids:nil, iteration_id:nil, custom_headers:nil) response = get_images_by_ids_async(project_id, image_ids:image_ids, iteration_id:iteration_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Get images by id for a given project iteration.
This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the current workspace is used.
@param project_id The project id. @param image_ids [Array<String>] The list of image ids to retrieve. Limited to 256. @param iteration_id The iteration id. Defaults to workspace. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1280 def get_images_by_ids_async(project_id, image_ids:nil, iteration_id:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/images/id' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, query_params: {'imageIds' => image_ids.nil? ? nil : image_ids.join(','),'iterationId' => iteration_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'ImageElementType', type: { name: 'Composite', class_name: 'Image' } } } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get images by id for a given project iteration.
This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the current workspace is used.
@param project_id The project id. @param image_ids [Array<String>] The list of image ids to retrieve. Limited to 256. @param iteration_id The iteration id. Defaults to workspace. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1260 def get_images_by_ids_with_http_info(project_id, image_ids:nil, iteration_id:nil, custom_headers:nil) get_images_by_ids_async(project_id, image_ids:image_ids, iteration_id:iteration_id, custom_headers:custom_headers).value! end
Get a specific iteration.
@param project_id The id of the project the iteration belongs to. @param iteration_id The id of the iteration to get. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Iteration] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3375 def get_iteration(project_id, iteration_id, custom_headers:nil) response = get_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Get a specific iteration.
@param project_id The id of the project the iteration belongs to. @param iteration_id The id of the iteration to get. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3404 def get_iteration_async(project_id, iteration_id, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'iteration_id is nil' if iteration_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/iterations/{iterationId}' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id,'iterationId' => iteration_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::Iteration.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get detailed performance information about an iteration.
@param project_id The id of the project the iteration belongs to. @param iteration_id The id of the iteration to get. @param threshold [Float] The threshold used to determine true predictions. @param overlap_threshold [Float] If applicable, the bounding box overlap threshold used to determine true predictions. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [IterationPerformance] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2416 def get_iteration_performance(project_id, iteration_id, threshold:nil, overlap_threshold:nil, custom_headers:nil) response = get_iteration_performance_async(project_id, iteration_id, threshold:threshold, overlap_threshold:overlap_threshold, custom_headers:custom_headers).value! response.body unless response.nil? end
Get detailed performance information about an iteration.
@param project_id The id of the project the iteration belongs to. @param iteration_id The id of the iteration to get. @param threshold [Float] The threshold used to determine true predictions. @param overlap_threshold [Float] If applicable, the bounding box overlap threshold used to determine true predictions. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2451 def get_iteration_performance_async(project_id, iteration_id, threshold:nil, overlap_threshold:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'iteration_id is nil' if iteration_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/iterations/{iterationId}/performance' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id,'iterationId' => iteration_id}, query_params: {'threshold' => threshold,'overlapThreshold' => overlap_threshold}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::IterationPerformance.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get detailed performance information about an iteration.
@param project_id The id of the project the iteration belongs to. @param iteration_id The id of the iteration to get. @param threshold [Float] The threshold used to determine true predictions. @param overlap_threshold [Float] If applicable, the bounding box overlap threshold used to determine true predictions. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2434 def get_iteration_performance_with_http_info(project_id, iteration_id, threshold:nil, overlap_threshold:nil, custom_headers:nil) get_iteration_performance_async(project_id, iteration_id, threshold:threshold, overlap_threshold:overlap_threshold, custom_headers:custom_headers).value! end
Get a specific iteration.
@param project_id The id of the project the iteration belongs to. @param iteration_id The id of the iteration to get. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3390 def get_iteration_with_http_info(project_id, iteration_id, custom_headers:nil) get_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value! end
Get iterations for the project.
@param project_id The project id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3269 def get_iterations(project_id, custom_headers:nil) response = get_iterations_async(project_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Get iterations for the project.
@param project_id The project id. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3296 def get_iterations_async(project_id, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/iterations' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'IterationElementType', type: { name: 'Composite', class_name: 'Iteration' } } } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get iterations for the project.
@param project_id The project id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3283 def get_iterations_with_http_info(project_id, custom_headers:nil) get_iterations_async(project_id, custom_headers:custom_headers).value! end
Get a specific project.
@param project_id The id of the project to get. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Project] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3002 def get_project(project_id, custom_headers:nil) response = get_project_async(project_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Get a specific project.
@param project_id The id of the project to get. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3029 def get_project_async(project_id, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::Project.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get a specific project.
@param project_id The id of the project to get. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3016 def get_project_with_http_info(project_id, custom_headers:nil) get_project_async(project_id, custom_headers:custom_headers).value! end
Get your projects.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2797 def get_projects(custom_headers:nil) response = get_projects_async(custom_headers:custom_headers).value! response.body unless response.nil? end
Get your projects.
@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2822 def get_projects_async(custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'ProjectElementType', type: { name: 'Composite', class_name: 'Project' } } } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get your projects.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2810 def get_projects_with_http_info(custom_headers:nil) get_projects_async(custom_headers:custom_headers).value! end
Get information about a specific tag.
@param project_id The project this tag belongs to. @param tag_id The tag id. @param iteration_id The iteration to retrieve this tag from. Optional, defaults to current training set. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Tag] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3961 def get_tag(project_id, tag_id, iteration_id:nil, custom_headers:nil) response = get_tag_async(project_id, tag_id, iteration_id:iteration_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Get information about a specific tag.
@param project_id The project this tag belongs to. @param tag_id The tag id. @param iteration_id The iteration to retrieve this tag from. Optional, defaults to current training set. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3994 def get_tag_async(project_id, tag_id, iteration_id:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'tag_id is nil' if tag_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/tags/{tagId}' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id,'tagId' => tag_id}, query_params: {'iterationId' => iteration_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::Tag.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get information about a specific tag.
@param project_id The project this tag belongs to. @param tag_id The tag id. @param iteration_id The iteration to retrieve this tag from. Optional, defaults to current training set. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3978 def get_tag_with_http_info(project_id, tag_id, iteration_id:nil, custom_headers:nil) get_tag_async(project_id, tag_id, iteration_id:iteration_id, custom_headers:custom_headers).value! end
Gets the number of images tagged with the provided {tagIds}.
The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids [Array<String>] A list of tags ids to filter the images to count. Defaults to all tags when null. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Number] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 319 def get_tagged_image_count(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil) response = get_tagged_image_count_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets the number of images tagged with the provided {tagIds}.
The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids [Array<String>] A list of tags ids to filter the images to count. Defaults to all tags when null. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 360 def get_tagged_image_count_async(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/images/tagged/count' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, query_params: {'iterationId' => iteration_id,'tagIds' => tag_ids.nil? ? nil : tag_ids.join(',')}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Number' } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Gets the number of images tagged with the provided {tagIds}.
The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids [Array<String>] A list of tags ids to filter the images to count. Defaults to all tags when null. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 340 def get_tagged_image_count_with_http_info(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil) get_tagged_image_count_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value! end
Get tagged images for a given project iteration.
This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch. The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids [Array<String>] A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 950 def get_tagged_images(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil) response = get_tagged_images_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value! response.body unless response.nil? end
Get tagged images for a given project iteration.
This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch. The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids [Array<String>] A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1011 def get_tagged_images_async(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/images/tagged' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, query_params: {'iterationId' => iteration_id,'tagIds' => tag_ids.nil? ? nil : tag_ids.join(','),'orderBy' => order_by,'take' => take,'skip' => skip}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'ImageElementType', type: { name: 'Composite', class_name: 'Image' } } } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get tagged images for a given project iteration.
This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch. The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids [Array<String>] A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 981 def get_tagged_images_with_http_info(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil) get_tagged_images_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value! end
Gets the number of untagged images.
This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the current workspace is used.
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Number] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 435 def get_untagged_image_count(project_id, iteration_id:nil, custom_headers:nil) response = get_untagged_image_count_async(project_id, iteration_id:iteration_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets the number of untagged images.
This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the current workspace is used.
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 472 def get_untagged_image_count_async(project_id, iteration_id:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/images/untagged/count' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, query_params: {'iterationId' => iteration_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Number' } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Gets the number of untagged images.
This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the current workspace is used.
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 454 def get_untagged_image_count_with_http_info(project_id, iteration_id:nil, custom_headers:nil) get_untagged_image_count_async(project_id, iteration_id:iteration_id, custom_headers:custom_headers).value! end
Get untagged images for a given project iteration.
This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch.
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1102 def get_untagged_images(project_id, iteration_id:nil, order_by:nil, take:50, skip:0, custom_headers:nil) response = get_untagged_images_async(project_id, iteration_id:iteration_id, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value! response.body unless response.nil? end
Get untagged images for a given project iteration.
This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch.
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1153 def get_untagged_images_async(project_id, iteration_id:nil, order_by:nil, take:50, skip:0, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/images/untagged' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, query_params: {'iterationId' => iteration_id,'orderBy' => order_by,'take' => take,'skip' => skip}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'ImageElementType', type: { name: 'Composite', class_name: 'Image' } } } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get untagged images for a given project iteration.
This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch.
@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1128 def get_untagged_images_with_http_info(project_id, iteration_id:nil, order_by:nil, take:50, skip:0, custom_headers:nil) get_untagged_images_async(project_id, iteration_id:iteration_id, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value! end
Makes a request and returns the body of the response. @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. @param path [String] the path, relative to {base_url}. @param options [Hash{String=>String}] specifying any request options like :body. @return [Hash{String=>String}] containing the body of the response. Example:
request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}" path = "/path" options = { body: request_content, query_params: {'api-version' => '2016-02-01'} } result = @client.make_request(:put, path, options)
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 72 def make_request(method, path, options = {}) result = make_request_with_http_info(method, path, options) result.body unless result.nil? end
Makes a request asynchronously. @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. @param path [String] the path, relative to {base_url}. @param options [Hash{String=>String}] specifying any request options like :body. @return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 97 def make_request_async(method, path, options = {}) fail ArgumentError, 'method is nil' if method.nil? fail ArgumentError, 'path is nil' if path.nil? request_url = options[:base_url] || @base_url if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?) @request_headers['Content-Type'] = options[:headers]['Content-Type'] end request_headers = @request_headers request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil? options.merge!({headers: request_headers.merge(options[:headers] || {})}) options.merge!({credentials: @credentials}) unless @credentials.nil? super(request_url, method, path, options) end
Makes a request and returns the operation response. @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. @param path [String] the path, relative to {base_url}. @param options [Hash{String=>String}] specifying any request options like :body. @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 84 def make_request_with_http_info(method, path, options = {}) result = make_request_async(method, path, options).value! result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body) result end
Get images that were sent to your prediction endpoint.
@param project_id The project id. @param query [PredictionQueryToken] Parameters used to query the predictions. Limited to combining 2 tags. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [PredictionQueryResult] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2311 def query_predictions(project_id, query, custom_headers:nil) response = query_predictions_async(project_id, query, custom_headers:custom_headers).value! response.body unless response.nil? end
Get images that were sent to your prediction endpoint.
@param project_id The project id. @param query [PredictionQueryToken] Parameters used to query the predictions. Limited to combining 2 tags. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2342 def query_predictions_async(project_id, query, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'query is nil' if query.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::PredictionQueryToken.mapper() request_content = self.serialize(request_mapper, query) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'projects/{projectId}/predictions/query' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::PredictionQueryResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get images that were sent to your prediction endpoint.
@param project_id The project id. @param query [PredictionQueryToken] Parameters used to query the predictions. Limited to combining 2 tags. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2327 def query_predictions_with_http_info(project_id, query, custom_headers:nil) query_predictions_async(project_id, query, custom_headers:custom_headers).value! end
Quick test an image.
@param project_id The project id. @param image_data Binary image data. @param iteration_id Optional. Specifies the id of a particular iteration to evaluate against. The default iteration for the project will be used when not specified. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [ImagePrediction] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2204 def quick_test_image(project_id, image_data, iteration_id:nil, custom_headers:nil) response = quick_test_image_async(project_id, image_data, iteration_id:iteration_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Quick test an image.
@param project_id The project id. @param image_data Binary image data. @param iteration_id Optional. Specifies the id of a particular iteration to evaluate against. The default iteration for the project will be used when not specified. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2239 def quick_test_image_async(project_id, image_data, iteration_id:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'image_data is nil' if image_data.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'multipart/form-data' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? # Set Form Data form_data = {} form_data['imageData'] = image_data.to_s unless image_data.to_s.nil? path_template = 'projects/{projectId}/quicktest/image' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, query_params: {'iterationId' => iteration_id}, headers: request_headers.merge(custom_headers || {}), body: URI.encode_www_form(form_data), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::ImagePrediction.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Quick test an image url.
@param project_id The project to evaluate against. @param image_url [ImageUrl] An {Iris.Web.Api.Models.ImageUrl} that contains the url of the image to be evaluated. @param iteration_id Optional. Specifies the id of a particular iteration to evaluate against. The default iteration for the project will be used when not specified. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [ImagePrediction] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2092 def quick_test_image_url(project_id, image_url, iteration_id:nil, custom_headers:nil) response = quick_test_image_url_async(project_id, image_url, iteration_id:iteration_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Quick test an image url.
@param project_id The project to evaluate against. @param image_url [ImageUrl] An {Iris.Web.Api.Models.ImageUrl} that contains the url of the image to be evaluated. @param iteration_id Optional. Specifies the id of a particular iteration to evaluate against. The default iteration for the project will be used when not specified. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2129 def quick_test_image_url_async(project_id, image_url, iteration_id:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'image_url is nil' if image_url.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::ImageUrl.mapper() request_content = self.serialize(request_mapper, image_url) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'projects/{projectId}/quicktest/url' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, query_params: {'iterationId' => iteration_id}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::ImagePrediction.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Quick test an image url.
@param project_id The project to evaluate against. @param image_url [ImageUrl] An {Iris.Web.Api.Models.ImageUrl} that contains the url of the image to be evaluated. @param iteration_id Optional. Specifies the id of a particular iteration to evaluate against. The default iteration for the project will be used when not specified. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2111 def quick_test_image_url_with_http_info(project_id, image_url, iteration_id:nil, custom_headers:nil) quick_test_image_url_async(project_id, image_url, iteration_id:iteration_id, custom_headers:custom_headers).value! end
Quick test an image.
@param project_id The project id. @param image_data Binary image data. @param iteration_id Optional. Specifies the id of a particular iteration to evaluate against. The default iteration for the project will be used when not specified. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2222 def quick_test_image_with_http_info(project_id, image_data, iteration_id:nil, custom_headers:nil) quick_test_image_async(project_id, image_data, iteration_id:iteration_id, custom_headers:custom_headers).value! end
Queues project for training.
@param project_id The project id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Iteration] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3653 def train_project(project_id, custom_headers:nil) response = train_project_async(project_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Queues project for training.
@param project_id The project id. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3680 def train_project_async(project_id, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'projects/{projectId}/train' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::Iteration.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Queues project for training.
@param project_id The project id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3667 def train_project_with_http_info(project_id, custom_headers:nil) train_project_async(project_id, custom_headers:custom_headers).value! end
Update a specific iteration.
@param project_id Project id. @param iteration_id Iteration id. @param updated_iteration [Iteration] The updated iteration model. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Iteration] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3551 def update_iteration(project_id, iteration_id, updated_iteration, custom_headers:nil) response = update_iteration_async(project_id, iteration_id, updated_iteration, custom_headers:custom_headers).value! response.body unless response.nil? end
Update a specific iteration.
@param project_id Project id. @param iteration_id Iteration id. @param updated_iteration [Iteration] The updated iteration model. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3582 def update_iteration_async(project_id, iteration_id, updated_iteration, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'iteration_id is nil' if iteration_id.nil? fail ArgumentError, 'updated_iteration is nil' if updated_iteration.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::Iteration.mapper() request_content = self.serialize(request_mapper, updated_iteration) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'projects/{projectId}/iterations/{iterationId}' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id,'iterationId' => iteration_id}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:patch, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::Iteration.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Update a specific iteration.
@param project_id Project id. @param iteration_id Iteration id. @param updated_iteration [Iteration] The updated iteration model. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3567 def update_iteration_with_http_info(project_id, iteration_id, updated_iteration, custom_headers:nil) update_iteration_async(project_id, iteration_id, updated_iteration, custom_headers:custom_headers).value! end
Update a specific project.
@param project_id The id of the project to update. @param updated_project [Project] The updated project model. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Project] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3170 def update_project(project_id, updated_project, custom_headers:nil) response = update_project_async(project_id, updated_project, custom_headers:custom_headers).value! response.body unless response.nil? end
Update a specific project.
@param project_id The id of the project to update. @param updated_project [Project] The updated project model. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3199 def update_project_async(project_id, updated_project, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'updated_project is nil' if updated_project.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::Project.mapper() request_content = self.serialize(request_mapper, updated_project) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'projects/{projectId}' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:patch, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::Project.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Update a specific project.
@param project_id The id of the project to update. @param updated_project [Project] The updated project model. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3185 def update_project_with_http_info(project_id, updated_project, custom_headers:nil) update_project_async(project_id, updated_project, custom_headers:custom_headers).value! end
Update a tag.
@param project_id The project id. @param tag_id The id of the target tag. @param updated_tag [Tag] The updated tag model. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Tag] operation results.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4142 def update_tag(project_id, tag_id, updated_tag, custom_headers:nil) response = update_tag_async(project_id, tag_id, updated_tag, custom_headers:custom_headers).value! response.body unless response.nil? end
Update a tag.
@param project_id The project id. @param tag_id The id of the target tag. @param updated_tag [Tag] The updated tag model. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4173 def update_tag_async(project_id, tag_id, updated_tag, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? fail ArgumentError, 'project_id is nil' if project_id.nil? fail ArgumentError, 'tag_id is nil' if tag_id.nil? fail ArgumentError, 'updated_tag is nil' if updated_tag.nil? fail ArgumentError, 'api_key is nil' if api_key.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['Training-Key'] = api_key unless api_key.nil? request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::Tag.mapper() request_content = self.serialize(request_mapper, updated_tag) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'projects/{projectId}/tags/{tagId}' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'projectId' => project_id,'tagId' => tag_id}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:patch, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_2::Models::Tag.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Update a tag.
@param project_id The project id. @param tag_id The id of the target tag. @param updated_tag [Tag] The updated tag model. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4158 def update_tag_with_http_info(project_id, tag_id, updated_tag, custom_headers:nil) update_tag_async(project_id, tag_id, updated_tag, custom_headers:custom_headers).value! end
Private Instance Methods
Adds telemetry information.
# File lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4452 def add_telemetry sdk_information = 'azure_cognitiveservices_customvisiontraining' sdk_information = "#{sdk_information}/0.17.3" add_user_agent_information(sdk_information) end