dinglufe / segment-anything-cpp-wrapper

MIT License
221 stars 34 forks source link

What should I do if the input size of the modified image is 640x480, and the obtained mask cannot coincide with the original image? #40

Open xiangw369 opened 8 months ago

xiangw369 commented 8 months ago

What should I do if the input size of the modified image is 640x480, and the obtained mask cannot coincide with the original image?

dinglufe commented 8 months ago

The simplest way is to resize the image to the size expected by the model (e.g., 1024x720). But a preferred method is to re-export a preprocessing model for 640x480. Export preprocessing model

dinglufe commented 8 months ago

The simplest way is to resize the image to the size expected by the model (e.g., 1024x720). But a preferred method is to re-export a preprocessing model for 640x480. Export preprocessing model

The second method currently doesn't work. https://github.com/dinglufe/segment-anything-cpp-wrapper/issues/41

IuliuNovac commented 8 months ago

The general issue is that using the longest side 1024 means you have to conduct a bunch of extra computation. So getting a mask is extremely slow.

I need to use image sizes of 128x128, since more it's a waste of compute. Anyone has any ideas?

The only option i see is to retrain the model and have costume encoder size.