keras-team / keras-applications

Reference implementations of popular deep learning models.
Other
2k stars 910 forks source link

Custom image size in Mobilenets v1 and v2 #101

Closed ezavarygin closed 5 years ago

ezavarygin commented 5 years ago

At the moment, the MobileNets models try to load the weights which for some input_shape do not exist (one example is illustrated in this issue). This PR is related to this one.

Suggested solution: Weights for the default size of 224 are loaded if rows is different from cols or not in [128, 160, 192, 224] for MobileNet_v1. Weights for the default size of 224 are loaded if rows is different from cols or not in [96, 128, 160, 192, 224] for MobileNet_v2.

taehoonlee commented 5 years ago

Thank you for the PR, @ezavarygin. Could you please add one missing case: undefined?

`input_shape` is undefined or non-square, or `rows` is not in [128, 160, 192, 224].
ezavarygin commented 5 years ago

Done.