microsoft / Cognitive-CustomVision-Windows

Custom Vision Client Library and Sample for Windows
MIT License
67 stars 60 forks source link

TrainProject returns BadRequest when there are not enough images or tags #10

Closed malantin closed 4 years ago

malantin commented 6 years ago

The TrainProject method fails with the exception message "BadRequest" when there are not enough images (<5) or tags (<2). The exception should provide a meaningful message like the one you get on the portal.

Source:

"Microsoft.Cognitive.CustomVision.Training"

StackTrace:

at Microsoft.Cognitive.CustomVision.TrainingApi.d46.MoveNext() in C:\projects\IRIS\Iris.SDK\CustomVisionSDK\Cognitive-CustomVision-Windows\ClientLibrary\Microsoft.Cognitive.CustomVision.Training\Generated\TrainingApi.cs:line 3363 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Cognitive.CustomVision.TrainingApiExtensions.d61.MoveNext() in C:\projects\IRIS\Iris.SDK\CustomVisionSDK\Cognitive-CustomVision-Windows\ClientLibrary\Microsoft.Cognitive.CustomVision.Training\Generated\TrainingApiExtensions.cs:line 1366 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Cognitive.CustomVision.TrainingApiExtensions.TrainProject(ITrainingApi operations, Guid projectId) in C:\projects\IRIS\Iris.SDK\CustomVisionSDK\Cognitive-CustomVision-Windows\ClientLibrary\Microsoft.Cognitive.CustomVision.Training\Generated\TrainingApiExtensions.cs:line 1349 at CustomVision.Sample.Program.Main(String[] args) in C:\Users\xxxxxx\Source\Repos\Cognitive-CustomVision-Windows\Samples\CustomerVision.Samples\Program.cs:line 75

markdwood commented 6 years ago

In particular, the message code returned from the server should be propagated back up to the caller, e.g., given the response

{"Code":"BadRequestTrainingValidationFailed","Message":"Not enough images per tag for training"}

it would be helpful if the Message value became the associated message detail for the exception.

shonohs commented 4 years ago

This repository is deprecated