The problem is that your approach is very image-specific, and it generally won’t work with images where e.g., your background is much darker than the image itself.
I tried different methods a few years ago and based on my experience, reliable background removal is quite a challenging task. Eventually, you still need to check all output images to make sure things work properly. It’s basically more of an object detection and image segmentation task that once you detected the object, you basically apply a mask.
I would recommend starting with established, non-DL CV tools for that. E.g., using OpenCV or scikit-image. E.g., have a look at http://scikit-image.org/docs/dev/user_guide/tutorial_segmentation.html 1.0k