jaiwei98 / MobileNetV4-pytorch

An unofficial implementation of MobileNetV4 in Pytorch
https://arxiv.org/abs/2404.10518
MIT License
110 stars 9 forks source link
mnv4 mobilenet mobilenetv4 universalinvertedbottlenet

MobileNetV4-pytorch

An unofficial implementation of MobileNetV4 (MNv4) in Pytorch.

There are 5 types of MNv4 as indicated in the MobileNetV4 -- Universal Models for the Mobile Ecosystem, e.g.

Table of Content

MobileNetV4

This section mainly showed how to import MobileNetV4

import torch
from mobilenet.mobilenetv4 import MobileNetV4

# Support ['MobileNetV4ConvSmall', 'MobileNetV4ConvMedium', 'MobileNetV4ConvLarge']
# Also supported ['MobileNetV4HybridMedium', 'MobileNetV4HybridLarge']
model = MobileNetV4("MobileNetV4ConvSmall")

# Check the trainable params
total_params = sum(p.numel() for p in model.parameters())
print(f"Number of parameters: {total_params}")

# Check the model's output shape
print("Check output shape ...")
x = torch.rand(1, 3, 224, 224)
y = model(x)
for i in y:
    print(i.shape)

TODO

Notes

Note that there are few parts which not excatly the same as implementation in tensorflow

Credits

Some function and code are adapted and referenced from official repo tensorflow/models.

Citations

@misc{qin2024mobilenetv4,
      title={MobileNetV4 -- Universal Models for the Mobile Ecosystem}, 
      author={Danfeng Qin and Chas Leichner and Manolis Delakis and Marco Fornoni and Shixin Luo and Fan Yang and Weijun Wang and Colby Banbury and Chengxi Ye and Berkin Akin and Vaibhav Aggarwal and Tenghui Zhu and Daniele Moro and Andrew Howard},
      year={2024},
      eprint={2404.10518},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}