Skip to content

Commit

Permalink
openvino: avoid ov.Tensor when using start_async due to thread safety?
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Dec 31, 2024
1 parent f0db59f commit a41e915
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions plugins/openvino/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/openvino/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@
"devDependencies": {
"@scrypted/sdk": "file:../../sdk"
},
"version": "0.1.149"
"version": "0.1.150"
}
9 changes: 3 additions & 6 deletions plugins/openvino/src/ov/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,11 @@ def prepare():
im = im.reshape((1, 3, self.model_dim, self.model_dim))
im = im.astype(np.float32) / 255.0
im = np.ascontiguousarray(im) # contiguous
input_tensor = ov.Tensor(array=im)
elif self.yolo:
input_tensor = ov.Tensor(
array=np.expand_dims(np.array(input), axis=0).astype(np.float32)
)
im = np.expand_dims(np.array(input), axis=0).astype(np.float32)
else:
input_tensor = ov.Tensor(array=np.expand_dims(np.array(input), axis=0))
return input_tensor
im = np.expand_dims(np.array(input), axis=0)
return im

try:
input_tensor = await asyncio.get_event_loop().run_in_executor(
Expand Down

0 comments on commit a41e915

Please sign in to comment.