MobileOne: An Improved One millisecond Mobile Backbone

Overview

MobileOne: An Improved One millisecond Mobile Backbone

This software project accompanies the research paper, An Improved One millisecond Mobile Backbone.

Our model achieves Top-1 Accuracy of 75.9% under 1ms.

MobileOne Performance

Model Zoo

ImageNet-1K

Model Top-1 Acc. Latency* Pytorch Checkpoint (url) CoreML Model
MobileOne-S0 71.4 0.79 S0(unfused) mlmodel
MobileOne-S1 75.9 0.89 S1(unfused) mlmodel
MobileOne-S2 77.4 1.18 S2(unfused) mlmodel
MobileOne-S3 78.1 1.53 S3(unfused) mlmodel
MobileOne-S4 79.4 1.86 S4(unfused) mlmodel

*Latency measured on iPhone 12 Pro.

Usage

To use our model, follow the code snippet below,

import torch
from mobileone import mobileone, reparameterize_model

# To Train from scratch/fine-tuning
model = mobileone(variant='s0')
# ... train ...

# Load Pre-trained checkpoint for fine-tuning
checkpoint = torch.load('/path/to/unfused_checkpoint.pth.tar')
model.load_state_dict(checkpoint)
# ... train ...

# For inference
model.eval()      
model_eval = reparameterize_model(model)
# Use model_eval at test-time

To simply evaluate our model, use the fused checkpoint where branches are re-parameterized.

import torch
from mobileone import mobileone

model = mobileone(variant='s0', inference_mode=True)
checkpoint = torch.load('/path/to/checkpoint.pth.tar')
model.load_state_dict(checkpoint)
# ... evaluate/demo ...

ModelBench App

An iOS benchmark app for MobileOne CoreML models. See ModelBench for addition details on building and running the app.

Citation

If our code or models help your work, please cite our paper:

@article{mobileone2022,
  title={An Improved One millisecond Mobile Backbone},
  author={Vasu, Pavan Kumar Anasosalu and Gabriel, James and Zhu, Jeff and Tuzel, Oncel and Ranjan, Anurag},
  journal={arXiv preprint arXiv:2206.04040},
  year={2022}
}
Comments
  • The result of  unreparameterize model and reparameterized model doesn't match.

    The result of unreparameterize model and reparameterized model doesn't match.

    In mobileone.py ,I tried this:

        model = mobileone(variant='s0').cuda()
        checkpoint = torch.load('path to mobileone_s0_unfused.pth.tar')
        model.load_state_dict(checkpoint)
        image1 = torch.rand(1,3,224,224).cuda()
        x0,x1,x2,x3 = model(image1)
        #
        #re-parameter
        model_re = reparameterize_model(model)
        x01,x11,x21,x31 = model_re(image1)
        print(x31/x3)
    

    And the result doesn't match.Is there anything wrong with the way I am using it?

    opened by yellowYuga 0
  • ReProduce the Training Accuracy of MobileOne

    ReProduce the Training Accuracy of MobileOne

    I have reproduced the training accuracy of the paper base on MMClassification 1.x, For all the training configs, logs and checkpoints, please refer to this Page.

    image

    tricks I use are the following:

    • [x] Switch training Recipe
    • [x] RandAug
    • [x] weght-decay cosine scheduler
    • [x] no norm weight-decay
    • [x] Label-smoothing
    opened by Ezra-Yu 0
  • Using a backbone for semantic segmentation

    Using a backbone for semantic segmentation

    I am trying to use MobileOne-S0 as a backbone for semantic segmentation. However, UNFUSED checkpoint is very big. How do I use the S0 model instead of unfused?

    opened by umitkacar 0
  • MobileOne for semantic segmentation

    MobileOne for semantic segmentation

    Hi, Thanks for your work. Is there any plan to share your implementation for semantic segmentation with PascalVOC dataset? Perhaps instructions on how to build the modules or pth checkpoints / onnx models?

    opened by lkdci 0
  • Test data transform

    Test data transform

    Thank you so much for your awesome job!

    I have tested the given models in the ImagNet-1k test dataset by using the test transform of RepVGG, but the resulting accuracy is about 0.1 lower than the result you gave. As following:

    | Model | Mine | Your Result | | :-------------: | :------------------: | :----------------------------: | | s0 | 71.36 | 71.4 | | s1 | 75.76 | 75.9 | | s2 | 77.39 | 77.4 | | s3 | 77.93 | 78.1 | | s4 | 79.30 | 79.4 |

    Is there any difference between your test transform and that of RepVGG?

    Do you have any plans to release the training code?

    opened by Ezra-Yu 1
Owner
Apple
Apple
A very simple way to implement Backbone.js style custom event listeners and triggering in Swift for iOS development.

Swift Custom Events A very simple way to implement Backbone.js style custom event listeners and triggering in Swift for iOS development. This provides

Stephen Haney 98 Dec 25, 2022
TwilioChat_iOS - Twilio iOS SDK Implementaion Chat one-one Chat One-Many (Group)

TwilioChat_iOS - Twilio iOS SDK Implementaion Chat one-one Chat One-Many (Group) - Add Participant - Remove Participant Send Attachment Image Android - iOS Tested iOS - iOS Tested iOS - Android Tested React to Message, Delete a Message Read, Delivered, Sent Delete a Conversation Unread Messages Filter

Zeeshan Haider 2 May 23, 2022
Switchboard - easy and super light weight A/B testing for your mobile iPhone or android app. This mobile A/B testing framework allows you with minimal servers to run large amounts of mobile users.

Switchboard - easy A/B testing for your mobile app What it does Switchboard is a simple way to remote control your mobile application even after you'v

Keepsafe 287 Nov 19, 2022
A simple shake-one-shake, Convenient for us to integrate the shake-one-shake.

MGSwiftShaker Example To run the example project, clone the repo, and run pod install from the Example directory first.

null 3 Nov 21, 2021
This little app aims to help teach me how to implement more then one API in one single application in a reusable and properly structured manner.

LilAPI App News & Weather This little API app combines two of Jordan Singers Lil Software API's into one app. The goal with this app was to learn how

hallux 1 Oct 13, 2021
The one and only open source 4X MMO mid-core strategy game for iOS. Similar to Game of War and Mobile Strike

4X MMO Strategy Game for iOS I have spent 4 years of my life and a significant amount of money into completing this game and I hope you enjoy it. For

shankqr 69 Nov 16, 2022
Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app.

Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using Apple Pay or their credit card.

Shopify 411 Jan 2, 2023
Px-mobile-sdk-demo-app - PerimeterX Mobile SDK - Demo App

About PerimeterX PerimeterX is the leading provider of application security solu

PerimeterX 1 Nov 20, 2022
Mobile-ios-ml - SBB Mobile Machine Learning for iOS devices

ESTA library: Machine Learning for iOS This framework simplifies the integration

Swiss Federal Railways (SBB) 9 Jul 16, 2022
ViewAnimator brings your UI to life with just one line

ViewAnimator is a library for building complex iOS UIView animations in an easy way. It provides one line animations for any view included the ones wh

Marcos Griselli 6.9k Jan 2, 2023
Hue is the all-in-one coloring utility that you'll ever need.

Hue is the all-in-one coloring utility that you'll ever need. Usage Hex You can easily use hex colors with the init(hex:) convenience initializer on U

Christoffer Winterkvist 3.4k Jan 3, 2023
Throttle massive number of inputs in a single drop of one line API.

Icon credits: Lorc, Delapouite & contributors Throttler Throttler is a library that throttles unnecessarily repeated and massive inputs until the last

Jang Seoksoon 73 Nov 16, 2022
JSONHelper - ✌ Convert anything into anything in one operation; JSON data into class instances, hex strings into UIColor/NSColor, y/n strings to booleans, arrays and dictionaries of these; anything you can make sense of!

JSONHelper Convert anything into anything in one operation; hex strings into UIColor/NSColor, JSON strings into class instances, y/n strings to boolea

Baris Sencan 788 Jul 19, 2022
Auto Layout (and manual layout) in one line.

Auto Layout (and manual layout) in one line. Quick Look view.bb.centerX().below(view2).size(100) It’s equivalent to iOS 9 API: view.centerXAnchor.cons

Javier Zhang 74 Oct 19, 2022
A lightweight, one line setup, iOS / OSX network debugging library! 🦊

Netfox provides a quick look on all executed network requests performed by your iOS or OSX app. It grabs all requests - of course yours, requests from

Christos Kasketis 3.4k Dec 28, 2022
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.

LoadingShimmer An easy way to add a shimmering effect to any view with just single line of code. It is useful as an unobtrusive loading indicator. Thi

Jogendra 1.4k Jan 4, 2023
A customisable view for entering arbitrary length pins, codes or passwords in iOS. Supports iOS 12 one time codes.

CBPinEntryView CBPinEntryView is a view written in Swift to allow easy and slick entry of pins, codes or passwords. It allows backspacing, dismissal o

Chris Byatt 183 Dec 5, 2022
CHIOTPField is a set of textfields that can be used for One-time passwords, SMS codes, PIN codes, etc. Mady by @ChiliLabs - https://chililabs.io

CHIOTPField CHIOTPField is a set of textfields that can be used for One-time passwords, SMS codes, PIN codes, etc. All fields support insertion of one

Chili Labs 241 Dec 13, 2022
🔎 All-in-one Quick Look plugin

Glance All-in-one Quick Look plugin Glance provides Quick Look previews for files that macOS doesn't support out of the box. Installation Steps About

Han Cen 257 Dec 27, 2022
A µFramework for showing alerts like the one used when copying from pasteboard or connecting Apple pencil

Drops ?? A µFramework for showing alerts like the one used when copying from pasteboard or connecting Apple pencil. Features iOS 10+ Can be used in Sw

Omar Albeik 709 Dec 29, 2022