Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
 - improved .gitignore
 - python2 compatibility
 - removing aligner
  • Loading branch information
deepfakes_tmp committed Dec 22, 2017
1 parent 3ba44f7 commit 9994214
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 98 deletions.
97 changes: 7 additions & 90 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,90 +1,7 @@
## Windows
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk


## macOS
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*



## Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# PyBuilder
target/

# pyenv
.python-version

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

*
!*.py
!*.md
!*.txt
!Dockerfile*
!requirements*
!lib/*.py
2 changes: 1 addition & 1 deletion lib/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, description='default'):
self.output_dir = get_folder(self.arguments.output_dir)
try:
self.input_dir = get_image_paths(self.arguments.input_dir)
except FileNotFoundError:
except:
print('Input directory not found. Please ensure it exists.')
exit(1)

Expand Down
14 changes: 7 additions & 7 deletions lib/faces_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from .model import autoencoder_B
from .model import encoder, decoder_A, decoder_B


def convert_one_image(image, model_dir="models"):

encoder.load_weights(model_dir + "/encoder.h5")
Expand All @@ -27,12 +26,13 @@ def convert_one_image(image, model_dir="models"):
new_face = autoencoder.predict(face / 255.0)[0]
new_face = numpy.clip(new_face * 255, 0, 255).astype(image.dtype)
new_face = cv2.resize(new_face, (160, 160))
result = aligner.align(image.copy(), new_face)
if result is None:
return superpose(image, new_face, crop)
else:
return result

return superpose(image, new_face, crop)
# Aligner is not ready to use yet
# result = aligner.align(image.copy(), new_face)
# if result is None:
# return superpose(image, new_face, crop)
# else:
# return result

def superpose(image, new_face, crop):
new_image = image.copy()
Expand Down

0 comments on commit 9994214

Please sign in to comment.