|
36 | 36 | import com.ibm.watson.visual_recognition.v4.model.GetCollectionOptions; |
37 | 37 | import com.ibm.watson.visual_recognition.v4.model.GetImageDetailsOptions; |
38 | 38 | import com.ibm.watson.visual_recognition.v4.model.GetJpegImageOptions; |
| 39 | +import com.ibm.watson.visual_recognition.v4.model.GetTrainingUsageOptions; |
39 | 40 | import com.ibm.watson.visual_recognition.v4.model.ImageDetails; |
40 | 41 | import com.ibm.watson.visual_recognition.v4.model.ImageDetailsList; |
41 | 42 | import com.ibm.watson.visual_recognition.v4.model.ImageSummaryList; |
42 | 43 | import com.ibm.watson.visual_recognition.v4.model.ListCollectionsOptions; |
43 | 44 | import com.ibm.watson.visual_recognition.v4.model.ListImagesOptions; |
44 | 45 | import com.ibm.watson.visual_recognition.v4.model.TrainOptions; |
45 | 46 | import com.ibm.watson.visual_recognition.v4.model.TrainingDataObjects; |
| 47 | +import com.ibm.watson.visual_recognition.v4.model.TrainingEvents; |
46 | 48 | import com.ibm.watson.visual_recognition.v4.model.UpdateCollectionOptions; |
47 | 49 | import java.io.InputStream; |
48 | 50 | import java.util.Map; |
|
53 | 55 | * Provide images to the IBM Watson™ Visual Recognition service for analysis. The service detects objects based on |
54 | 56 | * a set of images with training data. |
55 | 57 | * |
56 | | - * **Beta:** The Visual Recognition v4 API and Object Detection model are beta features. For more information about beta |
57 | | - * features, see the [Release |
58 | | - * notes](https://cloud.ibm.com/docs/services/visual-recognition?topic=visual-recognition-release-notes#beta). |
59 | | - * {: important}. |
60 | | - * |
61 | 58 | * @version v4 |
62 | 59 | * @see <a href= |
63 | 60 | * "https://cloud.ibm.com/docs/services/visual-recognition?topic=visual-recognition-object-detection-overview"> |
@@ -560,6 +557,50 @@ public ServiceCall<TrainingDataObjects> addImageTrainingData( |
560 | 557 | return createServiceCall(builder.build(), responseConverter); |
561 | 558 | } |
562 | 559 |
|
| 560 | + /** |
| 561 | + * Get training usage. |
| 562 | + * |
| 563 | + * Information about the completed training events. You can use this information to determine how close you are to the |
| 564 | + * training limits for the month. |
| 565 | + * |
| 566 | + * @param getTrainingUsageOptions the {@link GetTrainingUsageOptions} containing the options for the call |
| 567 | + * @return a {@link ServiceCall} with a response type of {@link TrainingEvents} |
| 568 | + */ |
| 569 | + public ServiceCall<TrainingEvents> getTrainingUsage(GetTrainingUsageOptions getTrainingUsageOptions) { |
| 570 | + String[] pathSegments = { "v4/training_usage" }; |
| 571 | + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); |
| 572 | + builder.query("version", versionDate); |
| 573 | + Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("watson_vision_combined", "v4", "getTrainingUsage"); |
| 574 | + for (Entry<String, String> header : sdkHeaders.entrySet()) { |
| 575 | + builder.header(header.getKey(), header.getValue()); |
| 576 | + } |
| 577 | + builder.header("Accept", "application/json"); |
| 578 | + if (getTrainingUsageOptions != null) { |
| 579 | + if (getTrainingUsageOptions.startTime() != null) { |
| 580 | + builder.query("start_time", String.valueOf(getTrainingUsageOptions.startTime())); |
| 581 | + } |
| 582 | + if (getTrainingUsageOptions.endTime() != null) { |
| 583 | + builder.query("end_time", String.valueOf(getTrainingUsageOptions.endTime())); |
| 584 | + } |
| 585 | + } |
| 586 | + ResponseConverter<TrainingEvents> responseConverter = ResponseConverterUtils.getValue( |
| 587 | + new com.google.gson.reflect.TypeToken<TrainingEvents>() { |
| 588 | + }.getType()); |
| 589 | + return createServiceCall(builder.build(), responseConverter); |
| 590 | + } |
| 591 | + |
| 592 | + /** |
| 593 | + * Get training usage. |
| 594 | + * |
| 595 | + * Information about the completed training events. You can use this information to determine how close you are to the |
| 596 | + * training limits for the month. |
| 597 | + * |
| 598 | + * @return a {@link ServiceCall} with a response type of {@link TrainingEvents} |
| 599 | + */ |
| 600 | + public ServiceCall<TrainingEvents> getTrainingUsage() { |
| 601 | + return getTrainingUsage(null); |
| 602 | + } |
| 603 | + |
563 | 604 | /** |
564 | 605 | * Delete labeled data. |
565 | 606 | * |
|
0 commit comments