-
hi thanks for this repository pub fn foo(s: &str) -> Tensor {
let i = image::open(s).unwrap().to_rgb8();
let resized = image::imageops::resize(&i, 112, 112, ::image::imageops::FilterType::Triangle);
tract_ndarray::Array4::from_shape_fn((1, 112, 112, 3), |(_, y, x, c)| {
f32::from(resized[(u32::try_from(x).unwrap(), u32::try_from(y).unwrap())][c]) / 255.0
})
.into()
} im trying to use 112x112 images with tract_tflite::tflite()
.model_for_path("mobilenet_v3_small_100_224.tflite")?
.into_optimized()?
.into_runnable() but i get the error
i think the problem is that I'm trying to use 112x112 images with a 224 mobilenet model. do you by any chance know how to make Mobilenet support 112x112 sized images? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
#1464 might be related |
Beta Was this translation helpful? Give feedback.
-
The input for this specific instance of mobilenet MUST be 224 squared. Period. You can fish around for instance of mobilenet for different input sizes. If you can't find a 112x112 you may need to train one yourself. Alternatively you may upscale your input images to 224x224, (docs.rs/image may help) but I have no idea how it will impact the model performance. |
Beta Was this translation helpful? Give feedback.
The input for this specific instance of mobilenet MUST be 224 squared. Period.
You can fish around for instance of mobilenet for different input sizes. If you can't find a 112x112 you may need to train one yourself.
Alternatively you may upscale your input images to 224x224, (docs.rs/image may help) but I have no idea how it will impact the model performance.