I’m not sure how the new code snippet is related to the initial question.
In the first post you’ve said that this code snippet is raising the issue:
fpr, tpr, _ = roc_curve(mask_list, y_score)
per_pixel_rocauc = roc_auc_score(mask_list, y_score)
total_pixel_roc_auc.append(per_pixel_rocauc)
print('%s pixel ROCAUC: %.3f' % ('ROC', per_pixel_rocauc))
fig_pixel_rocauc.plot(fpr, tpr, label='%s ROCAUC: %.3f' % ('ROC', per_pixel_rocauc))

which is most likely calling into scikit-learn methods.
To isolate the issue, check all inputs to these methods, e.g. via:
print(type(mask_list))
print(type(y_score))
fpr, tpr, _ = roc_curve(mask_list, y_score)

if roc_curve raises the error. If not, i.e. if the error is raised in another line of code, check the inputs to this particular method and then check the scikit docs and make sure the inputs have the right type, shape etc.