2

How can i use a mobilenet model as a feature-extractor for images with way higher resolution than 224x224? I guess i need to change a certain layer after it's loaded to increase the input size? My current code is this:

const featureExtractor = await tf.loadGraphModel('http://localhost:3000/mobilenet_v3_large_100_224/model.json');

I know that i could resample my images down to 224x224, but i fear important information will be lost.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Martin Cremer
  • 5,191
  • 2
  • 32
  • 38

1 Answers1

2

MobileNet v2 technically starts with a fully convolutional layer with 32 filters. So, yes you can train the model with larger images, however you'd be starting from scratch. The feature-extracted models that seem to be available are mostly trained on datasets of 224x224.

If you believe this will remove important information, you might be right! However, I'd definitely give it a go before I'd call it quits. I'm amazed at how proficient 28x28 datasets are, and this is substantially more data.

You can adjust the depth multiplier to 1.4 and get a substantially larger set of features from your images. If you're concerned about quality, do that. Maybe you can even use a larger model like Inception? Those images are 299x299.

Regardless, it depends on how much time and energy you have to retrain.

Gant Laborde
  • 6,484
  • 1
  • 21
  • 30
  • thanks! would you prefer Inception to Resnet? I'm new to ml. – Martin Cremer Jul 27 '21 at 12:17
  • I would recommend ResNet-152, but it looks like TFHub has an Inception ResNet mix with a 299x299 image. Might be worth checking out! https://tfhub.dev/google/imagenet/inception_resnet_v2/feature_vector/5 – Gant Laborde Jul 27 '21 at 14:53