Closed Rexsunon closed 4 years ago
Will you post a code snippet so we can try and debug your issue?
Sorry for the late response, here is the code.
const params = {
imageUrl: [
'http://localhost:5000/uploads/IMG_2638.jpg',
'http://localhost:5000/uploads/IMG_2641.jpg',
'http://localhost:5000/uploads/IMG_0489.jpg',
'http://localhost:5000/uploads/IMG_0484.jpg',
'http://localhost:5000/uploads/IMG_0482.jpg',
],
collectionIds: ['collectionIds'],
features: ['objects'],
};
visualRecognition
.analyze(params)
.then((response) => {
console.log(JSON.stringify(response.result, null, 2));
})
.catch((err) => console.log(err));
And error.
error code: 400 Bad Request: Bad Request at RequestWrapper.formatError (C:\Users\user\Documents\AirSmat\smat-ai-service\node_modules\ibm-cloud-sdk-core\lib\request-wrapper.js:216:21) at C:\Users\user\Documents\AirSmat\smat-ai-service\node_modules\ibm-cloud-sdk-core\lib\request-wrapper.js:204:25 at processTicksAndRejections (internal/process/task_queues.js:93:5)
Hm your code looks like it should be fine. There are some requirements for the images in imageUrl
:
Limit each image file to 10 MB.
Minimum width and height is 30 pixels, but the service tends to perform better with images that are at least 300x 300 pixels. Maximum is 5400 pixels for either height or width.
Do your images follow those rules?
Also, are you able to invoke this request with CURL? I'm not sure that this is an issue that can be fixed in the SDK.
I'm not sure about the roles. But it seems to work fine when i tested the images locally by using the image.
Those images are part of the images i used for training on watson studio and it worked also on the studio, when i tested. path. But it throws that error when i use the url
This issue has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Using nodejs Watson SDK for visual recognition, I've been trying to analyze images using the image URL to get analysis from my trained collections. But I keep getting 400 error Bad Request: Bad Request.
Node version: v12.13.0 Watson SDK version: 5.5.0