iOS SDK
학습한 Roboflow 모델을 iOS 앱에 배포합니다
마지막 업데이트
도움이 되었나요?
도움이 되었나요?
import Roboflow
...
//API 키로 초기화
let rf = RoboflowMobile(apiKey: "API_KEY")
var model: RFModel?
...
//model은 모델의 프로젝트 이름입니다
rf.load(model: "YOUR-MODEL-ID", modelVersion: YOUR-MODEL-VERSION-#) { [self] model, error, modelName, modelType in
if error != nil {
print(error?.localizedDescription as Any)
} else {
model?.configure(threshold: threshold, overlap: overlap, maxObjects: maxObjects
processingMode: .performance or .balanced or .quality, // instance seg
maxNumberPoints: 마스크 처리 포인트의 최대 개수) // instance seg
self.model = model
}
}
...
//model?.detect는 UIImage를 받아 그 위에서 추론을 실행합니다
let img = UIImage(named: "example.jpeg") // 또는 CVPixelBuffer
model?.detect(image: img!) { predictions, error in
if error != nil {
print(error)
} else {
print(predictions)
}
}import Roboflow
...
//API 키로 초기화
let rf = RoboflowMobile(apiKey: "API_KEY")
...
//model은 모델의 프로젝트 이름입니다
let (model, loadingError, modelName, modelType) = await rf.load(model: "YOUR-MODEL-ID", modelVersion: YOUR-MODEL-VERSION-#)
model!.configure(threshold: threshold, overlap: overlap, maxObjects: maxObjects)
...
//model?.detect는 UIImage를 받아 그 위에서 추론을 실행합니다
let img = UIImage(named: "example.jpeg")
let (predictions, predictionError) = await model!.detect(image: img!)
print(predictions)x:Float //객체 중심 x
y:Float //객체 중심 y
width:Float
height:Float
className:String
confidence:Float
color:UIColor
box:CGRect
points:[CGPoint] // 인스턴스 분할 모델만 해당