public void ObjectBoundsTest() { var inputFile = InputTestFiles.FirstOrDefault(f => string.Equals(f.Name, TestImage)); var request = new GetObjectBoundsRequest(inputFile.Name, folder: TempFolder, storage: this.TestStorage) { storage = TestStorage, folder = TempFolder, threshold = 20, allowedLabels = "dog", includeLabel = true }; using (var command = new ObjectDetectionTestCommand( request, ImagingApi, false, true, TempFolder, TestStorage, null)) { ExecuteTestCommand(command, "objectDetection_objectbounds_test", $"Input image: {inputFile.Name};", inputFile.Name, TempFolder, TestStorage); } }
/// <summary> /// Detect objects on an image from a cloud storage. /// </summary> public void DetectObjectsImageFromStorage() { Console.WriteLine("Detect object on the image from cloud storage"); UploadSampleImageToCloud(); string method = "ssd"; int threshold = 50; bool includeLabel = true; bool includeScore = true; string allowedLabels = "cat"; string blockedLabels = "dog"; string folder = CloudPath; // Input file is saved at the Examples folder in the storage string storage = null; // We are using default Cloud Storage var request = new GetObjectBoundsRequest(SampleImageFileName, method, threshold, includeLabel, includeScore, allowedLabels, blockedLabels, folder, storage); Console.WriteLine($"Call ObjectBoundsRequest with params: method:{method}, threshold:{threshold}, include label: {includeLabel}, includeScore: {includeScore}"); DetectedObjectList detectedObjectList = this.ImagingApi.GetObjectBounds(request); Console.WriteLine("Objects detected: " + detectedObjectList.DetectedObjects.Count); Console.WriteLine(); }
public ObjectDetectionTestCommand( GetObjectBoundsRequest request, ImagingApi imagingApi, bool saveResultToStorage, bool removeResult, string folder, string storage, string resultFileName) { this.request = request; this.imagingApi = imagingApi; this.saveResultToStorage = saveResultToStorage; this.removeResult = removeResult; this.storage = storage; if (saveResultToStorage) { this.outPath = folder + "/" + resultFileName; } }