I'm trying to give the model a custom mask but the doesn't give the expected results even tho the model give a good result with provided mask (using the mask button).
def make_mask(self, pts, mslice,i):
if len(pts)>0:
mask = np.zeros((512,512,3))
for pt in pts:
cv2.line(mask,pt['prev'],pt['curr'],(255,255,255),12)
mask = np.asarray(mask[:,:,0]/255,dtype=np.uint8)
mask = np.expand_dims(mask,axis=2)
mask = np.expand_dims(mask,axis=0)
else:
# loading the mask from matlab file {1=hole}
array2D= scipy.io.loadmat('data.mat')['Holes_Vol']
# resize the 2d matrix
mask = cv2.resize(mslice, (512, 512), interpolation=cv2.INTER_CUBIC)
# convert the matrix to 3 chanels (3D) (RGB)
mask = np.repeat(mask[:, :, np.newaxis]*255, 3, axis=2)
# The below line are taken from the 3 line above else
mask = np.asarray(mask[:,:,0]/255,dtype=np.uint8)
mask = np.expand_dims(mask,axis=2)
mask = np.expand_dims(mask,axis=0)
return mask
I'm trying to give the model a custom mask but the doesn't give the expected results even tho the model give a good result with provided mask (using the mask button).
The code before the modification: https://github.com/run-youngjoo/SC-FEGAN/blob/5a2992eb1c144d36d745e62d231e3c24d3f98961/demo.py#L146-L159
any suggestions?