-1
我可以通過objective-c中的以下示例代碼識別圖像並檢查nsfw,sfw等預測。如何使用Clarifai作物?
// Initialize the Clarifai app with your app's ID and Secret.
ClarifaiApp *app = [[ClarifaiApp alloc] initWithAppID:@""
appSecret:@""];
// Fetch Clarifai's general model.
[app getModelByName:@"general-v1.3" completion:^(ClarifaiModel *model, NSError *error) {
// Create a Clarifai image from a uiimage.
ClarifaiImage *clarifaiImage = [[ClarifaiImage alloc] initWithImage:image];
// Use Clarifai's general model to pedict tags for the given image.
[model predictOnImages:@[clarifaiImage] completion:^(NSArray<ClarifaiOutput *> *outputs, NSError *error) {
if (!error) {
ClarifaiOutput *output = outputs[0];
// Loop through predicted concepts (tags), and display them on the screen.
NSMutableArray *tags = [NSMutableArray array];
for (ClarifaiConcept *concept in output.concepts) {
[tags addObject:concept.conceptName];
}
dispatch_async(dispatch_get_main_queue(), ^{
self.textView.text = [NSString stringWithFormat:@"Tags:\n%@", [tags componentsJoinedByString:@", "]];
});
}
dispatch_async(dispatch_get_main_queue(), ^{
self.button.enabled = YES;
});
}];
}];
爲此,我可以得到模型,從模型我可以預測的圖像。
問:
我怎樣才能使裁切功能? 我沒有辦法達到Clarifai提供的作物功能。
任何想法。
@D Cirne感謝您的回覆 –