portrait-segmentation-mediapipe icon indicating copy to clipboard operation
portrait-segmentation-mediapipe copied to clipboard

Training Code for Model on Custom Data

Open NaeemKhan333 opened this issue 4 years ago • 2 comments

@SwatiModi Thanks for such a nice work. I have a question related to the training model . I am working same sort of the problem , so I am using u2net segmentation Model for my solution . But it is really slow when I integrate it with my web-app code to run in the browser. Can you suggest me any way to improve my speed or can you provide your python training and testing script , So I can use it for my problem. Thanks

NaeemKhan333 avatar Feb 18 '21 07:02 NaeemKhan333

Hi @NaeemKhan333, you can refer to the model architecture here, I had used MobileNetV1 as encoder backbone and a custom decoder. Also few things that you could try while building the model

  1. reducing width of the network by reducing input size(I had used 224x224, 160x160 or 192x192 shall also work well), and number of filters in each layer (if you are using keras you can directly adjust this by alpha ref)
  2. reducing the depth of network i.e. using as less layers in network as possible

In the custom decoder I have used constant number of of filters throughout, this will also help with optimizing the inference time Also when deploying the model for web, WASM can be really helpful for speed boost - ref

SwatiModi avatar Feb 21 '21 09:02 SwatiModi

@SwatiModi thank you for sharing this repo. I am also trying to make this kind of project. In my project, I need to segment 8 classes, so I have to train my own dataset. Can you share your traing code?

ilwoonam75 avatar Mar 20 '21 14:03 ilwoonam75