disable poisson blending

This commit is contained in:
deep pomf 2018-02-12 12:08:02 -05:00
parent 6a9e35820a
commit 4ed26b5d06
2 changed files with 7 additions and 6 deletions

View File

@ -33,8 +33,8 @@ Embarrassingly, because the neural network was trained to decensor horizontally
- TensorFlow 1.5 - TensorFlow 1.5
- Pillow - Pillow
- tqdm - tqdm
- scipy - scipy (only needed if poisson blending is enabled in decensor.py)
- pyamg - pyamg (only needed if poisson blending is enabled in decensor.py)
- matplotlib (only for running test.py) - matplotlib (only for running test.py)
Tested on Ubuntu 16.04. Cannot run on Windows since Tensorflow on Windows is for Python 3. Tested on Ubuntu 16.04. Cannot run on Windows since Tensorflow on Windows is for Python 3.

View File

@ -40,13 +40,13 @@ def decensor():
for file in sorted(files): for file in sorted(files):
file_path = os.path.join(subdir, file) file_path = os.path.join(subdir, file)
if os.path.isfile(file_path) and os.path.splitext(file_path)[1] == ".png": if os.path.isfile(file_path) and os.path.splitext(file_path)[1] == ".png":
print file_path print(file_path)
image = Image.open(file_path).convert('RGB') image = Image.open(file_path).convert('RGB')
image = np.array(image) image = np.array(image)
image = np.array(image / 127.5 - 1) image = np.array(image / 127.5 - 1)
x_decensor.append(image) x_decensor.append(image)
x_decensor = np.array(x_decensor) x_decensor = np.array(x_decensor)
print x_decensor.shape print(x_decensor.shape)
step_num = int(len(x_decensor) / BATCH_SIZE) step_num = int(len(x_decensor) / BATCH_SIZE)
cnt = 0 cnt = 0
@ -60,8 +60,9 @@ def decensor():
img = np.array((img + 1) * 127.5, dtype=np.uint8) img = np.array((img + 1) * 127.5, dtype=np.uint8)
original = x_batch[i] original = x_batch[i]
original = np.array((original + 1) * 127.5, dtype=np.uint8) original = np.array((original + 1) * 127.5, dtype=np.uint8)
output = blend(original, img, mask_batch[0,:,:,0]) #uncomment to enable poisson_blending, but poisson_blending doesn't seem to help
output = Image.fromarray(output.astype('uint8'), 'RGB') #img = blend(original, img, mask_batch[0,:,:,0])
output = Image.fromarray(img.astype('uint8'), 'RGB')
dst = './decensor_output_images/{}.png'.format("{0:06d}".format(cnt)) dst = './decensor_output_images/{}.png'.format("{0:06d}".format(cnt))
output.save(dst) output.save(dst)