Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve SIT to compose a batch tensor as a model input make up from a packet of different images #27341

Conversation

sivanov-work
Copy link
Contributor

@sivanov-work sivanov-work commented Oct 30, 2024

Details:

  • A new parameter override_model_batch_size was added several PRs ago. The purpose of this parameter was is to take a picture/binary and "stretch" it to fit a batched tensor as an input of a batched model providing that we could run and validate batched models
  • The current PR enhance this idea and allows us to set distinguished images/binaries in a batched tensor input so that we could validate correctness of processing of different lines of batch during our inference invocations. SIT now uses "|" separator to discern different images inside input images array as an command line argument.

The batched images filing algorithm is the following:

  1. If passed images amount is not enough to fill up an entire batch, a last image will be propagated and copied to remnant lines of N-batch.
  2. If passed images array is larger than an batched tensor, then only N images will be used up and the rest of images will be thrown away

Example:

single-image-test --device CPU --network resnet50.xml --mode classification --top_k 5 --il NCHW --ol NC --iml NCHW --oml NC --ip FP16 --op FP16 --override_model_batch_size 3 --input "dog.bmp|00000001.JPEG|00000002.JPEG"

gives us

...
Load input #0 from [dog.bmp,00000001.JPEG,00000002.JPEG] as f16 [N,C,H,W] [3,3,224,224]
Fill up all input batch slices planes up to 3 with image data from the array: [0/3]
Fill input batch slices planes starting from index 1 up to 3 with image data from the array: [1/3]
Fill input batch slices planes starting from index 2 up to 3 with image data from the array: [2/3]

Tickets:

  • E####145303

@github-actions github-actions bot added the category: NPU OpenVINO NPU plugin label Oct 30, 2024
@sivanov-work sivanov-work force-pushed the multiple_image_input_per_batched_input_in_single_image_test branch 2 times, most recently from f447887 to 955f132 Compare October 31, 2024 12:45
@sivanov-work sivanov-work force-pushed the multiple_image_input_per_batched_input_in_single_image_test branch from 02a12ff to 5bd9042 Compare November 4, 2024 15:57
@sivanov-work sivanov-work marked this pull request as ready for review November 5, 2024 14:30
@sivanov-work sivanov-work requested review from a team as code owners November 5, 2024 14:30
Copy link
Contributor

@ArtemySkrebkov ArtemySkrebkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not familiar with batching, but the changes look reasonable.

Copy link
Contributor

@DariaMityagina DariaMityagina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@Maxim-Doronin Maxim-Doronin added this pull request to the merge queue Nov 6, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 6, 2024
@Maxim-Doronin Maxim-Doronin added this pull request to the merge queue Nov 7, 2024
Merged via the queue into openvinotoolkit:master with commit f33a637 Nov 7, 2024
139 checks passed
NishantPrabhuFujitsu pushed a commit to NishantPrabhuFujitsu/openvino that referenced this pull request Nov 26, 2024
… packet of different images (openvinotoolkit#27341)

### Details:
- A new parameter `override_model_batch_size` was added several PRs ago.
The purpose of this parameter was is to take a picture/binary and
"stretch" it to fit a batched tensor as an input of a batched model
providing that we could run and validate batched models
- The current PR enhance this idea and allows us to set distinguished
images/binaries in a batched tensor input so that we could validate
correctness of processing of different lines of batch during our
inference invocations. SIT now uses "|" separator to discern different
images inside input images array as an command line argument.
 
The batched images filing algorithm is the following:
1) If passed images amount is not enough to fill up an entire batch, a
last image will be propagated and copied to remnant lines of N-batch.
2) If passed images array is larger than an batched tensor, then only N
images will be used up and the rest of images will be thrown away

Example:

```
single-image-test --device CPU --network resnet50.xml --mode classification --top_k 5 --il NCHW --ol NC --iml NCHW --oml NC --ip FP16 --op FP16 --override_model_batch_size 3 --input "dog.bmp|00000001.JPEG|00000002.JPEG"
```
gives us

```
...
Load input #0 from [dog.bmp,00000001.JPEG,00000002.JPEG] as f16 [N,C,H,W] [3,3,224,224]
Fill up all input batch slices planes up to 3 with image data from the array: [0/3]
Fill input batch slices planes starting from index 1 up to 3 with image data from the array: [1/3]
Fill input batch slices planes starting from index 2 up to 3 with image data from the array: [2/3]

```

### Tickets:
 - E####145303

---------

Co-authored-by: Maksim Doronin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: NPU OpenVINO NPU plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants