Closed stupworker closed 1 year ago
The mask doesn't have a color. You're using something like matplotlib which is providing the default yellow (1) and purple (0) cmap. The mask is only a single binary channel, with 1 being where something is. If you want black and white, just do this:
mask[mask == 1] =255
plt.imsave(arr=mask, fname="mask.jpg")
The mask doesn't have a color. You're using something like matplotlib which is providing the default yellow (1) and purple (0) cmap. The mask is only a single binary channel, with 1 being where something is. If you want black and white, just do this:
mask[mask == 1] =255 plt.imsave(arr=mask, fname="mask.jpg")
Excuse me, where should i put the code in? I put them after function save_mask_data(output_dir, masks, boxes_filt, pred_phrases) in grounded_sam_demo.py, but it does not work...
The mask doesn't have a color. You're using something like matplotlib which is providing the default yellow (1) and purple (0) cmap. The mask is only a single binary channel, with 1 being where something is. If you want black and white, just do this:
mask[mask == 1] =255 plt.imsave(arr=mask, fname="mask.jpg")
Excuse me, where should i put the code in? I put them after function save_mask_data(output_dir, masks, boxes_filt, pred_phrases) in grounded_sam_demo.py, but it does not work...
You can use this repo: https://github.com/Nomination-NRB/SAM-webui
Here is my outcome. I want to get a white and black jpg, what can i do? Thanks!!!!