Skip to content

Commit

Permalink
Upload
Browse files Browse the repository at this point in the history
  • Loading branch information
hepesu committed Mar 17, 2018
1 parent fef5b6b commit 2ca3e5c
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 0 deletions.
Binary file added figs/3d_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figs/3d_12x.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figs/3d_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figs/curve.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figs/l1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figs/l1_2x.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figs/one_pixel_gap.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figs/overview.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions predict.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import os

# Try running on CPU
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'

import numpy as np
import cv2
from keras.models import load_model

MODEL_NAME = 'model.h5'
model = load_model(MODEL_NAME)

for root, dirs, files in os.walk('data/predict', topdown=False):
for name in files:
print(os.path.join(root, name))

im = cv2.imread(os.path.join(root, name))
im_gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)

im_predict = im_gray.reshape((1, im_gray.shape[0], im_gray.shape[1], 1))
im_predict = (im_predict.astype(np.float32) / 255. - 0.5) * 2

result = model.predict(im_predict)

im_res = result.reshape((result.shape[1], result.shape[2]))
im_res = (im_res * 0.5 + 0.5) * 255

cv2.imwrite(os.path.join('data/result', name), im_res)

0 comments on commit 2ca3e5c

Please sign in to comment.