When the user needs to process large amount of images but does not require realtime responses, it is recommended to use ProductAI Batch Processing. The advantages are:
No need to call API mutiple times, just upload all the dataset through Console/SDK/API in one operation.
The ProductAI backend leverages batch-optimizing strategy, users will experience a much shorter total process time.
The ProductAI backend resources will be scheduled with an on-demand scheme, let’s save the Earth together.
Supported Services
Be noticed, currently part of the ProductAI services can be scheduled in Batch Processing. Here are the supported services:
// Set API initilizing parameters IProfile profile = new DefaultProfile(); profile.setAccessKeyId(ACCESS_KEY_ID); profile.setSecretKey(SECRET_KEY); profile.setVersion("1"); profile.setGlobalLanguage(LanguageType.Chinese); IWebClient client = new DefaultProductAIClient(profile);
// Fetch supported service list GetSupportServicesRequest request = new GetSupportServicesRequest(); GetSupportServicesResponse response = client.getResponse(request); String[] serviceIds = response.getSupportServiceIds(); // String json=response.getResponseJsonString();
using MalongTech.ProductAI.Core; using MalongTech.ProductAI.API.Entity; using MalongTech.ProductAI.API.Entity.Batch;
IProfile profile = new DefaultProfile { Version="1", AccessKeyId=ACCESS_KEY_ID, SecretKey=SECRET_KEY }; var client = new DefaultProductAIClient(profile);
var request = new GetSupportServicesRequest(); var response = client.GetResponse(request);
// Set API initilizing parameters IProfile profile = new DefaultProfile(); profile.setAccessKeyId(ACCESS_KEY_ID); profile.setSecretKey(SECRET_KEY); profile.setVersion("1"); profile.setGlobalLanguage(LanguageType.Chinese); IWebClient client = new DefaultProductAIClient(profile);
// Create Batch Processing task CreateTaskByFileRequest request = new CreateTaskByFileRequest(SERVICE_ID, new File("batch.csv")); CreateTaskByFileResponse response = client.getResponse(request);
// Get task Id String taskId=response.getTaskInfo().getTaskId();
IProfile profile = new DefaultProfile { Version="1", AccessKeyId=ACCESS_KEY_ID, SecretKey=SECRET_KEY }; var client = new DefaultProductAIClient(profile);
var request = new CreateTaskByFileRequest { ServiceId=SERVICE_ID, CsvFile=new System.IO.FileInfo(@".\batch.csv") };
// Set API initializing parameters IProfile profile = new DefaultProfile(); profile.setAccessKeyId(ACCESS_KEY_ID); profile.setSecretKey(SECRET_KEY); profile.setVersion("1"); profile.setGlobalLanguage(LanguageType.Chinese); IWebClient client = new DefaultProductAIClient(profile);
IProfile profile = new DefaultProfile { Version="1", AccessKeyId=ACCESS_KEY_ID, SecretKey=SECRET_KEY }; var client = new DefaultProductAIClient(profile);
var request = new StartTaskRequest { TaskId=task_id };
// Set API initializing parameters IProfile profile = new DefaultProfile(); profile.setAccessKeyId(ACCESS_KEY_ID); profile.setSecretKey(SECRET_KEY); profile.setVersion("1"); profile.setGlobalLanguage(LanguageType.Chinese); IWebClient client = new DefaultProductAIClient(profile);
// Query status of batch processing task PollTaskStatusRequest request = new PollTaskStatusRequest(task_id); PollTaskStatusResponse response = client.getResponse(request); //String json=response.getResponseJsonString(); TaskDetailInfo taskInfo = response.getTaskInfo();
IProfile profile = new DefaultProfile { Version="1", AccessKeyId=ACCESS_KEY_ID, SecretKey=SECRET_KEY }; var client = new DefaultProductAIClient(profile);
var request = new PollTaskStatusRequest { TaskId=task_id };
// Set API initializing parameters IProfile profile = new DefaultProfile(); profile.setAccessKeyId(ACCESS_KEY_ID); profile.setSecretKey(SECRET_KEY); profile.setVersion("1"); profile.setGlobalLanguage(LanguageType.Chinese); IWebClient client = new DefaultProductAIClient(profile);
IProfile profile = new DefaultProfile { Version="1", AccessKeyId=ACCESS_KEY_ID, SecretKey=SECRET_KEY }; var client = new DefaultProductAIClient(profile);
var request = new CancelTaskRequest { TaskId=task_id };
// Set API initializing parameters IProfile profile = new DefaultProfile(); profile.setAccessKeyId(ACCESS_KEY_ID); profile.setSecretKey(SECRET_KEY); profile.setVersion("1"); profile.setGlobalLanguage(LanguageType.Chinese); IWebClient client = new DefaultProductAIClient(profile);
IProfile profile = new DefaultProfile { Version="1", AccessKeyId=ACCESS_KEY_ID, SecretKey=SECRET_KEY }; var client = new DefaultProductAIClient(profile);
var request = new SearchTaskRequest { StartDate=null, EndDate=DateTime.Now.AddDays(1).Date };
Query with task accepted time (which is the time when prepare function is invoked), query start time. By default, it will return from the first record if this field is not provided
No
Time format %Y-%m-%dT%H:%M:%SZ
end
DateTime
Query with task accepted time (which is the time when prepare function is invoked), query end time. By default it will return records until the last one if this field is not provided