-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
# LineCloser | ||
Unofficial Keras implementation of Joint Gap Detection and Inpainting of Line Drawings. | ||
|
||
## Overview | ||
Joint gap for line-drawings. Model1 uses network from the paper. For stable training, BN was added for all Conv2D. Model2 uses common network for inpaint. Training code will be uploaded soon. | ||
|
||
## Dependencies | ||
* Keras2 (Tensorflow backend) | ||
* OpenCV3 | ||
|
||
## Usage | ||
1. Set up directories. | ||
|
||
2. Download the model from release and put it in the same folder with code. | ||
|
||
3. Run `predict.py` for prediction. | ||
|
||
## Models | ||
Models are licensed under a CC-BY-NC-SA 4.0 international license. | ||
|
||
From **Project HAT** by Hepesu With :heart: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import os | ||
|
||
# Try running on CPU | ||
os.environ['CUDA_VISIBLE_DEVICES'] = '-1' | ||
|
||
import numpy as np | ||
import cv2 | ||
from keras.models import load_model | ||
|
||
R = 2 ** 4 | ||
MODEL_NAME = 'model1.h5' | ||
|
||
model = load_model(MODEL_NAME) | ||
model.summary() | ||
|
||
for root, dirs, files in os.walk('input', topdown=False): | ||
for name in files: | ||
print(os.path.join(root, name)) | ||
|
||
im = cv2.imread(os.path.join(root, name), cv2.IMREAD_GRAYSCALE) | ||
|
||
im_predict = cv2.resize(im, (im.shape[1] // R * R, im.shape[0] // R * R)) | ||
im_predict = np.reshape(im_predict, (1, im_predict.shape[0], im_predict.shape[1], 1)) | ||
im_predict = im_predict.astype(np.float32) / 255. | ||
|
||
result = model.predict(im_predict) | ||
|
||
result = np.squeeze(result) * 255. | ||
im_res = cv2.resize(result, (im.shape[1], im.shape[0])) | ||
|
||
cv2.imwrite(os.path.join('output', name), im_res) |