Supervised learning-based segmentation methods typically require a largenumber of annotated training data to generalize well at test time. In medicalapplications, curating such datasets is not a favourable option becauseacquiring a large number of annotated samples from experts is time-consumingand expensive. Consequently, numerous methods have been proposed in theliterature for learning with limited annotated examples. Unfortunately, theproposed approaches in the literature have not yet yielded significant gainsover random data augmentation for image segmentation, where randomaugmentations themselves do not yield high accuracy. In this work, we propose anovel task-driven data augmentation method for learning with limited labeleddata where the synthetic data generator, is optimized for the segmentationtask. The generator of the proposed method models intensity and shapevariations using two sets of transformations, as additive intensitytransformations and deformation fields. Both transformations are optimizedusing labeled as well as unlabeled examples in a semi-supervised framework. Ourexperiments on three medical datasets, namely cardic, prostate and pancreas,show that the proposed approach significantly outperforms standard augmentationand semi-supervised approaches for image segmentation in the limited annotationsetting. The code is made publicly available athttps://github.com/krishnabits001/task$\_$driven$\_$data$\_$augmentation.