Hi,
The error arises from the cc.PixelIdxList which is here a empty cell array. cc.PicelIdxList is an empty cell array due to the reason that the binay image(pred_alpha_thresh & target_alpha_thresh) sent into the bwconncomp function is a completely black image(all zeros) which has no connected components.
Cross check the pred_alpha_thresh and target_alpha_thresh values and ensure the output is not all zeros.
The following code would show you the case.
img = zeros([256, 256]);
cc = bwconncomp(img,4);
cc.PixelIdxList