How a robust background removal is implemented?
I found that a deep-learning-based method (e.g., 1) is much more robust than a non-deep-learning-based method (e.g., 2, using OpenCV).

https://www.remove.bg
How do I remove the background from this kind of image?

In the OpenCV example, Canny is used to detect the edges. But this step can be very sensitive to the image. The contour detection may end up with wrong contours. It is also difficult to determine which contours should be kept.
How a robust deep-learning method is implemented? Is any good example code? Thanks.

For that to work you need to use Unet. You can search for that on github.
Unet transofrm is: I->I.
Space of the image will become image (of same or similar size). 

You need to have say 10.000 images with bg removed. People, (long hair people), cats, cars, shoes, T-shirts, etc. 

So you set different backgrounds on all these images as source and prediction should be images with removed background.

You can also do a segmentation model and when you find the foreground you can remove the bg.
