Giter Site home page Giter Site logo

mobile-image-matting's Introduction

Deep Mobile Matting

This is a lightweight image matting model in PyTorch.

Features

  1. MobileNetV2 as backbone.
  2. DeepLabv3 heads.
  3. Small model (size: 23.5MB, FLOPs: 11.39GB, total params: 7.62 millions)

Performance

  • The Composition-1k testing dataset.
  • Evaluate with whole image.
  • SAD normalized by 1000.
  • Input image is normalized with mean=[0.485, 0.456, 0.406] and std=[0.229, 0.224, 0.225].
  • Both erode and dialte to generate trimap.
Models SAD MSE Download
paper-stage0 59.6 0.019
paper-stage1 54.6 0.017
paper-stage3 50.4 0.014
my-stage0 127.4 0.068 Link

Dependencies

  • Python 3.6.8
  • PyTorch 1.3

Dataset

Adobe Deep Image Matting Dataset

Follow the instruction to contact author for the dataset.

MSCOCO

Go to MSCOCO to download:

PASCAL VOC

Go to PASCAL VOC to download:

Usage

Data Pre-processing

Extract training images:

$ python pre_process.py
# python data_gen.py

Train

$ python train.py

If you want to visualize during training, run in your terminal:

$ tensorboard --logdir runs

Experimental results

The Composition-1k testing dataset

  1. Test:
$ python test.py

It prints out average SAD and MSE errors when finished.

Demo

Download pre-trained Deep Image Matting Link then run:

$ python demo.py
Image/Trimap Output/GT New BG/Compose
image image image
image image image
image image image
image image image
image image image
image image image
image image image
image image image
image image image
image image image
image image image
image image image
image image image
image image image
image image image
image image image
image image image
image image image
image image image
image image image

mobile-image-matting's People

Contributors

foamliu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mobile-image-matting's Issues

Could you please provide the pre-trained model for demo?

Hi,
Thanks for you work!
I found that there is no pre-process.py file. And the pre-trained model does also not exist. As a result, I can not run the demo.
Could you please release your trained model weights file as well as other necessary files (if there are) for demo?
Thanks in advance.

Da

404 error on the Checkpoint link

Which is the correct link for the smaller BEST_checkpoint.tar file for mobile matting?

  1. In the Demo section of ReadMe, it gives the following link for the pretrained model, but it gives a 404 error

https://github.com/foamliu/Deep-Mobile-Matting/releases/download/v1.0/BEST_checkpoint.tar

  1. In the Performance section of ReadMe, it gives following link in the table against my-stage0

https://github.com/foamliu/Deep-Image-Matting-v2/releases/download/v1.0/BEST_checkpoint.tar

But the above points to the large checkpoint file from the main "Deep-Image-Matting-v2" project.

Trying to evaluate on this second link give following error

AttributeError: Can't get attribute 'DIMModel' on <module 'models' from '/content/gdrive/My Drive/MobileImageMatting/Mobile-Image-Matting/models/__init__.py'>

Create Google Colab notebook for better understanding

I am trying to implement this approach in my project. I doubt that do I need two input images one with a background with the subject and one is the background I need to replace with.

if you will make a Google Colab Notebook as an example it will be very helpful to implement.

Integrating Mobile_Image_Matting into Android Project

Hi,
Thanks for you work!
its looking awesome output.
I want to integrate your demo into android project. Is it possible to integrate model into android Project? If it possible, then How can i integrate this model into android project?
Can you please give some suggestions?
Thanks in advance.

run the demo.py failed

I was download the BEST_checkpoint.tar, and run the demo.py, but something wrong:

Traceback (most recent call last):
File "demo.py", line 69, in
checkpoint = torch.load(checkpoint)
File "/home/search/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/serialization.py", line 426, in load
return _load(f, map_location, pickle_module, **pickle_load_args)
File "/home/search/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/serialization.py", line 613, in _load
result = unpickler.load()
AttributeError: Can't get attribute 'DIMModel' on <module 'models' from '/data1/search/Mobile-Image-Matting/models/init.py'>

and I can't found any "DIMModel" in the repo?

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.