<p>To use custom image size in MobileNet, download weights form this link: <a href="https://github.com/fchollet/deep-learning-models/releases/tag/v0.6" rel="nofollow noreferrer">https://github.com/fchollet/deep-learning-models/releases/tag/v0.6</a> </p>

<p>But make sure which weights you need because it contains different weights files according to the research paper of <a href="https://arxiv.org/pdf/1704.04861.pdf" rel="nofollow noreferrer">MobileNet</a>, as each model is dependent on the parameters <code>alpha</code> and <code>depth_multiplier</code>. There are four different values for <code>alpha</code>: 0.25, 0.50, 0.75, 1.0. Also, <code>depth_multiplier</code> is 1 according to this implementation of <a href="https://github.com/keras-team/keras-applications/blob/master/keras_applications/mobilenet.py" rel="nofollow noreferrer">mobilenet</a>. I would recommend that you download <a href="https://github.com/fchollet/deep-learning-models/releases/download/v0.6/mobilenet_1_0_224_tf.h5" rel="nofollow noreferrer"><code>mobilenet_1_0_224_tf.h5</code></a>. It has the highest ImageNet accuracy among all according to <a href="https://arxiv.org/pdf/1704.04861.pdf" rel="nofollow noreferrer">research paper Table 7</a>.</p>

<p>After that,</p>

<pre class="lang-py prettyprint-override"><code>from keras.applications.mobilenet import MobileNet

feature_model = MobileNet(include_top=False, weights=None, input_shape=(200, 200, 3), alpha=1.0, depth_multiplier=1)
feature_model.load_weights('mobilenet_1_0_224_tf.h5') # give the path for downloaded weights
</code></pre>

<p>And you're good to go.</p>
MobileNets for a custom image size
<p>I want to use the MobileNet model pre-trained on ImageNet for feature extraction. I am loading the model as follows:</p>

<pre><code>from keras.applications.mobilenet import MobileNet

feature_model = MobileNet(include_top=False, weights='imagenet', input_shape=(200, 200, 3))
</code></pre>

<p>The Keras manual <a href="https://keras.io/applications/#mobilenet" rel="nofollow noreferrer">clearly says</a> that this input shape is valid:</p>

<blockquote>
  <p>input_shape: optional shape tuple, only to be specified if include_top is False (otherwise the input shape has to be (224, 224, 3) (with 'channels_last' data format) or (3, 224, 224) (with 'channels_first' data format). It should have exactly 3 inputs channels, and width and height should be no smaller than 32. E.g. (200, 200, 3) would be one valid value.</p>
</blockquote>

<p>However, I get the following error message:</p>

<blockquote>
  <p>ValueError: If imagenet weights are being loaded, input must have a static square shape (one of (128, 128), (160, 160), (192, 192), or (224, 224)). Input shape provided = (200, 200, 3)</p>
</blockquote>

<p>Why does it require the input shape to match the one it was trained on if I specify <code>include_top=False</code>?</p>

<p>Keras: 2.2.4, TensorFlow: 1.13.1</p>

<p>Update: As @Soroush pointed out, this exception was removed <a href="https://github.com/keras-team/keras-applications/pull/94/commits/9d2664c5df9f2f018637995d6f40ab51d1669b93" rel="nofollow noreferrer">recently</a>. However, the issue was not fully resolved as described <a href="https://github.com/keras-team/keras-applications/issues/92#issuecomment-480958268" rel="nofollow noreferrer">here</a>.</p>

<p>Update2: The problem was resolved by these two pull requests (<a href="https://github.com/keras-team/keras-applications/pull/94" rel="nofollow noreferrer">1</a>, <a href="https://github.com/keras-team/keras-applications/pull/101" rel="nofollow noreferrer">2</a>).</p>