ClassifyImageRequest
A request to classify an image.
Declaration
struct ClassifyImageRequestOverview
This type of request produces a collection of ClassificationObservation objects that describe an image. Access the possible classifications through the supportedIdentifiers property.
if let imageURL = Bundle.main.url(forResource: "ClassificationImage",
withExtension: "jpg") {
do {
let request = ClassifyImageRequest()
let results = try await request.perform(on: imageURL)
for classification in results {
print("Classified \(classification.identifier)")
}
} catch {
print("Encountered an error when performing the request: \(error.localizedDescription)")
}
}Topics
Creating a request
Performing a request
perform(on:orientation:)perform(on:orientation:)perform(on:orientation:)perform(on:orientation:)perform(on:orientation:)perform(on:orientation:)