You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val modelHub =
TFModelHub(cacheDirectory = File("cache/pretrainedModels"))
val model = modelHub[TFModels.CV.ResNet50]
model.use {
for (i in 1..8) {
val imageFile = getFileFromResource("datasets/vgg/image$i.jpg")
val recognizedObject = it.predictObject(imageFile = imageFile)
println(recognizedObject)
val top5 = it.predictTopKObjects(imageFile = imageFile, topK = 5)
println(top5.toString())
}
}
Is the predict* function thread safe?
The text was updated successfully, but these errors were encountered:
I suggest thinking that this is not a thread-safe method and the whole model.
We are planning to work on it in the 0.5-0.6 releases and write in docs about thread-safety guarantees.
Also, we could use under the hood different runtimes with different thread-safety in the proposed low-level API and need to protect it against race conditions on the framework level.
zaleslaw
changed the title
Thread safety
The predict method should be thread safe
Oct 4, 2021
Is the predict* function thread safe?
The text was updated successfully, but these errors were encountered: