Code Monkey home page Code Monkey logo

pytorch-mobilenet-v3's Introduction

A PyTorch implementation of MobileNetV3

This is a PyTorch implementation of MobileNetV3 architecture as described in the paper Searching for MobileNetV3.

Some details may be different from the original paper, welcome to discuss and help me figure it out.

[NEW] The pretrained model of small version mobilenet-v3 is online.

Training & Accuracy

In progress ...

MobileNetV3 large

Madds Parameters Top1-acc Pretrained Model
Offical 1.0 219 M 5.4 M 75.2% -
Offical 0.75 155 M 4 M 73.3% -
Ours 1.0 - M 5.08 M - -
Ours 0.75 - M 3.69 M - -

MobileNetV3 small

Madds Parameters Top1-acc Pretrained Model
Offical 1.0 66 M 2.9 M 67.4% -
Offical 0.75 44 M 2.4 M 65.4% -
Ours 1.0 68 M 3.11 M 67.218% [google drive]
Ours 0.75 - M 2.47 M - -

Usage

Pretrained models are still training ...

    # pytorch 1.0.1
    # large
    net_large = mobilenetv3(mode='large')
    # small
    net_small = mobilenetv3(mode='small')
    state_dict = torch.load('mobilenetv3_small_67.218.pth.tar')
    net_small.load_state_dict(state_dict)

Data Pre-processing

I used the following code for data pre-processing on ImageNet:

normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                 std=[0.229, 0.224, 0.225])

input_size = 224

train_loader = torch.utils.data.DataLoader(
    datasets.ImageFolder(
    traindir, transforms.Compose([
        transforms.RandomResizedCrop(input_size), 
        transforms.RandomHorizontalFlip(),
        transforms.ToTensor(),
        normalize,
    ])), 
    batch_size=batch_size, shuffle=True,
    num_workers=n_worker, pin_memory=True)

val_loader = torch.utils.data.DataLoader(
    datasets.ImageFolder(valdir, transforms.Compose([
        transforms.Resize(int(input_size/0.875)),
        transforms.CenterCrop(input_size),
        transforms.ToTensor(),
        normalize,
    ])),
    batch_size=batch_size, shuffle=False,
    num_workers=n_worker, pin_memory=True)

pytorch-mobilenet-v3's People

Contributors

kuan-wang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.