syncdoth / face_mask_inpaint

GAN-based project of removing facial masks from face images.
1 stars 0 forks source link

How to get "binary_map"? #9

Open sja9527 opened 2 years ago

sja9527 commented 2 years ago

Hi , How to get "binary_map"? In the project of 'masktheface', I can not find the method to get it, Can you offer me the way to get it? Thanks a lot!

syncdoth commented 2 years ago

Hi, we don't have a documentation for that yet, but you would have to modify the MaskTheFace Utility.

Take a look at https://github.com/aqeelanwar/MaskTheFace/blob/caf4d6ca2328f6f97c5f1947db4f03b3197fb62a/mask_the_face.py#L172

then add a line similar to https://github.com/aqeelanwar/MaskTheFace/blob/caf4d6ca2328f6f97c5f1947db4f03b3197fb62a/mask_the_face.py#L188

something like np.save(mask_binary, path).

sja9527 commented 2 years ago

Hi, we don't have a documentation for that yet, but you would have to modify the MaskTheFace Utility.

Take a look at https://github.com/aqeelanwar/MaskTheFace/blob/caf4d6ca2328f6f97c5f1947db4f03b3197fb62a/mask_the_face.py#L172

then add a line similar to https://github.com/aqeelanwar/MaskTheFace/blob/caf4d6ca2328f6f97c5f1947db4f03b3197fb62a/mask_the_face.py#L188

something like np.save(mask_binary, path).

Thank you very much! I will try to modify it! If possible, Can you offer me your modified code?

syncdoth commented 2 years ago

Unfortunately, this was a course project (and you know how course projects tend to be very fuzzy :() and I do not have the code for it right now. My collaborator @oms0803 might be able to provide the code?

sja9527 commented 2 years ago

Unfortunately, this was a course project (and you know how course projects tend to be very fuzzy :() and I do not have the code for it right now. My collaborator @oms0803 might be able to provide the code?

Thank you so much! Can you offer me some help? @oms0803

oms0803 commented 2 years ago

@sja9527 Hi, recalling now, I am realising it might not be the best way to get the binary map but here's what I did.

  1. In aux_functions.py ln 358, there is mask_inv variable; edit the variables and returns so that mask_inv is returned in ln 136 of mask_the_face.py.
  2. Do such operation; np.abs(255-np.array(mask_inv)) and then use np.save to save the array into npy file.
sja9527 commented 2 years ago

@sja9527 Hi, recalling now, I am realising it might not be the best way to get the binary map but here's what I did.

  1. In aux_functions.py ln 358, there is mask_inv variable; edit the variables and returns so that mask_inv is returned in ln 136 of mask_the_face.py.
  2. Do such operation; np.abs(255-np.array(mask_inv)) and then use np.save to save the array into npy file.

Ok ,Thanks so much ! However, right now, I can not save the whole document in tmy folder, I always get just the final one in my project. For instance, 3 documet included in my folder like A、B、C, I just can save the bianry_mask of C