Image - resolution - tokens

#36
by MarbuelB - opened

Hello,

I would like to understand how this model is treating images. I would like to send images for analysis and would like to know what is the ideal resolution/settings so that the model does not need to resize the image and I get detailed analysis. What are the supported sizes? Any limits? How to serve the model using vLLM for optimal performance?

Here is my understanding... Please, correct me where I'm wrong!

The model splits the image to 28x28 pixels blocks, each is one token. The model does not care (more or less) about the aspect ratio, so one can send an image from a camera in 3:2 aspect ratio with a resolution for example 2520x1680px. This will be exactly 90x60 = 5400 tokens (my tests show about 30% less tokens, not sure why). I serve the model (FP8 quant) with this option for vLLM:
--mm-processor-kwargs '{"min_pixels": 313600, "max_pixels": 7’840’000}'

So from 560x560px to 2800x2800px the images should not be resized by the model. This is to allow wide range of image resolution, up to 100x100 tokens.

Any other things to consider? Happy to hear any comments/advice/correction!

Disclaimer: I am not a maintainer.

The model generates a flexible amount of tokens per image- inputs will not be resized. The patch size is 16x16, and the supported resolution is between 256x256 to 4096x4096.

Sign up or log in to comment