Supervised learning for image segmentation
I would suggest you use Python with Ski-Image for Image Related operation. For Machine Learning typically for Deep Learning, you should use Keras with theano/Tensorflow backend with GPU capabilities whichever suits you.

In order to generate masked images, you should use data augmentation.Data Augmentation Documentation for Keras