OPHoperHPO / image-background-remove-tool

✂️ Automated high-quality background removal framework for an image using neural networks. ✂️
https://carve.photos
Apache License 2.0
1.39k stars 272 forks source link

How to Train? #86

Closed dazzafact closed 2 years ago

dazzafact commented 2 years ago

Can you tell me how to train Images? For Training i hav already Images with transparent Background.

OPHoperHPO commented 2 years ago

Hi, @biblekiss

To train your segmentation model, you need to prepare a dataset.

The dataset should contain the following types of images:

  1. Original image with background
  2. Alpha channel in .png format

The alpha channel can be extracted from background-removed images using the extract_alpha_channel function in the carvekit.utils.mask_utils module.

Then you need to train your U2Net model and load it to the u2net wrapper class and pass it to the Interface class. See the original U2Net repository for more details on training.

In the next update, it will be possible to train the model very easy using the framework directly.