change pipeline code to take amask as input