Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jaiwei98/MobileNetV4-pytorch

An unofficial implementation of MobileNetV4 in Pytorch
https://github.com/jaiwei98/MobileNetV4-pytorch

mnv4 mobilenet mobilenetv4 universalinvertedbottlenet

Last synced: 2 months ago
JSON representation

An unofficial implementation of MobileNetV4 in Pytorch

Awesome Lists containing this project

README

        

# 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.
- MobileNetV4ConvSmall (MNv4-Conv-S)
- MobileNetV4ConvMedium (MNv4-Conv-M)
- MobileNetV4ConvLarge (MNv4-Conv-L)
- MobileNetV4HybridMedium (MNv4-Hybrid-M)
- MobileNetV4HybridLarge (MNv4-Hybrid-L)

## Table of Content
- [How to init model](#mobilenetv4)
- [TODO](#todo)
- [Notes](#notes)

## MobileNetV4
This section mainly showed how to import MobileNetV4

```python
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
- [x] Support 'MobileNetV4HybridMedium' and 'MobileNetV4HybridLarge'
- [ ] Release pretrained weight (welcome any contributors to submit PR 😉)

## Notes
Note that there are few parts which not excatly the same as implementation in tensorflow
- The "fused_ib" block
- The global average pooling layers at the end of model

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

## Citations
```bibtex
@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}
}
```