-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
To facilitate integration in real-time applications, where invoking Predict shouldn't block the calling thread, it'd be great if there was an async version of the method, like:
public IEnumerator PredictAsync(float[] pointCoords, float[] pointLabels, Action<RenderTexture> onComplete)
{
[...]
yield return PredictAsync(point_coords, point_labels, mask_input, has_mask_input, orig_im_size, (result) =>
{
TextureConverter.RenderToTexture(result.Masks, Result, new TextureTransform().SetBroadcastChannels(true));
onComplete?.Invoke(Result);
});
}
with a corresponding PredictAsync for the method returning the DecoderOutput.
Then PredictAsync can be easily called from a coroutine without creating a wrapper class:
StartCoroutine(mobileSAM.PredictAsync(pointCoords, pointLabels, (result) =>
{
if (result != null)
{
// Use result
}
}));
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels