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

Multiple images at input #17

Open
VladVin opened this issue Jul 3, 2021 · 3 comments
Open

Multiple images at input #17

VladVin opened this issue Jul 3, 2021 · 3 comments

Comments

@VladVin
Copy link
Contributor

VladVin commented Jul 3, 2021

There's a need to send multiple images per request item, for example, when we are running a model for image retrieval task which accepts images of a product from different angles of view. The amount of images of the product is arbitrary. So, it looks like we can make a request object with a list of tensors of different sizes

@wselfjes
Copy link
Collaborator

wselfjes commented Jul 4, 2021

Actually, there is a possibility to send multiple views images as an input.
I wrote a simple model that accepts multiple image and return embedding and it is working
https://gist.github.com/wselfjes/379a604f67d662b775021390b36519c1

@wselfjes wselfjes closed this as completed Jul 4, 2021
@VladVin
Copy link
Contributor Author

VladVin commented Jul 6, 2021

Thank you for the sample. Yes, I understand that we can stack images into one tensor, but the problem is in different sizes of images that might come (btw, this was mentioned in the comment above). For example, different photos of the same product.

Currently I see two options:

  1. Resize image to common size which is not good because it assumes the middleware that works with image tensors. Also, this might reduce the quality of a model because usually there's a different preprocessing applied in each model to the original image.
  2. Pass tensors as a meta parameter. This looks like a hack and I think it would be better to support multiple images per item by design

@VladVin VladVin reopened this Jul 6, 2021
@wselfjes
Copy link
Collaborator

wselfjes commented Jul 6, 2021

Another solution is VID2IMG mode. You can build the stateful model that wait for the flag “end” and then performs inference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants