ZHKKKe / MODNet

A Trimap-Free Portrait Matting Solution in Real Time [AAAI 2022]
Apache License 2.0
3.76k stars 629 forks source link

Add a different backbone other than Mobilenetv2? #186

Open tarunn2799 opened 2 years ago

tarunn2799 commented 2 years ago

Hey, great work on MODNet! I'm looking to try out modnet with a HRNet backbone for better results. Would you happen to already have the model function for HRNet that I can use instead of Mobilenetv2? If not, How do I go about adding this?

mylifeasazucchini commented 2 years ago

While you wait for the author to reply, I would suggest you to try Pytorch Image Models Library! (pip install timm)

The following link provides a super cool demo of how you can use different backbones (currently only CNN based) and get multi-scale features like the author used in his implementation :)

https://rwightman.github.io/pytorch-image-models/feature_extraction/#:~:text=Size(%5B2%2C%201024%5D)-,Multi%2Dscale%20Feature%20Maps%20(Feature%20Pyramid),-Object%20detection%2C%20segmentation

ZHKKKe commented 2 years ago

Hi, @tarunn2799, thanks for your attention. Sorry that we did not use HRNet as the backbone, but we have tried EfficientNet and obtained better results. If you want to change the backbone, you have to retrain the model. You may try the library shared by @mylifeasazucchini to replace the following code that define the backbone: https://github.com/ZHKKKe/MODNet/blob/b3b6964a58562c2220b0d6a0608689722f927abd/src/models/modnet.py#L216

vodatvan01 commented 3 months ago

Why not consider using the MobileNetV3 network as the backbone in the MODNet model instead of MobileNetV2?