Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 25 additions & 191 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,84 +1,30 @@
# Django stuff:
# Generated data files
*.npy
*.pkl
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# vscode
.vscode/

# Created by https://www.gitignore.io/api/venv,linux,macos,python,windows,virtualenv,jupyternotebooks
# Edit at https://www.gitignore.io/?templates=venv,linux,macos,python,windows,virtualenv,jupyternotebooks

### JupyterNotebooks ###
# gitignore template for Jupyter Notebooks
# website: http://jupyter.org/

.ipynb_checkpoints
*/.ipynb_checkpoints/*

# IPython
profile_default/
ipython_config.py

# Remove previous ipynb_checkpoints
# git rm -r .ipynb_checkpoints/

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon
# Environment files
.env

# Thumbnails
._*
# Model files
20170512-110547.zip
20170512-110547/

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Database directories
al_database/
database/
database_aligned/

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# Temporary files
temp_embeddings.npy
temp_images/
temp_images_aligned/

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

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
Expand All @@ -92,129 +38,17 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-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

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

### venv ###
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
pyvenv.cfg
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
pip-selfcheck.json

### VirtualEnv ###
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
# IDEs
.vscode/
.idea/
*.swp
*.swo
*~

### Windows ###
# Windows thumbnail cache files
# OS
.DS_Store
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

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

# Windows shortcuts
*.lnk

# End of https://www.gitignore.io/api/venv,linux,macos,python,windows,virtualenv,jupyternotebooks
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ scikit-image>=0.13.1
scikit-learn>=0.19.0
scipy>=1.0.0
setuptools>=38.6.0
tensorflow<2.0.0
tensorflow>=2.16.0
python-dotenv>=0.12.0

#pynder
git+git://github.com/cjekel/pynder
git+https://github.com/cjekel/pynder

#tindetheus
-e .
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"imageio >= 2.2.0",
"scikit-learn >= 0.19.0",
"scikit-image >= 0.13.1",
"tensorflow < 2.0.0",
"tensorflow >= 2.16.0",
"pandas >= 0.21.0",
"future >= 0.16.0",
"joblib >= 0.13.0",
Expand Down
14 changes: 8 additions & 6 deletions tindetheus/export_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
from skimage.transform import resize
import time
import tensorflow as tf
# Disable TensorFlow 2.x behavior for compatibility
tf.compat.v1.disable_eager_execution()
import numpy as np
# import sys
import os
Expand Down Expand Up @@ -108,15 +110,15 @@ def main(model_dir='20170512-110547', data_dir='database_aligned',
os.path.isdir(os.path.join(path_exp, name))]
with tf.Graph().as_default():

with tf.Session() as sess:
with tf.compat.v1.Session() as sess:

# Load the model
facenet.load_model(model_dir)

# Get input and output tensors
images_placeholder = tf.get_default_graph().get_tensor_by_name("input:0") # noqa: E501
embeddings = tf.get_default_graph().get_tensor_by_name("embeddings:0") # noqa: E501
phase_train_placeholder = tf.get_default_graph().get_tensor_by_name("phase_train:0") # noqa: E501
images_placeholder = tf.compat.v1.get_default_graph().get_tensor_by_name("input:0") # noqa: E501
embeddings = tf.compat.v1.get_default_graph().get_tensor_by_name("embeddings:0") # noqa: E501
phase_train_placeholder = tf.compat.v1.get_default_graph().get_tensor_by_name("phase_train:0") # noqa: E501

# Run forward pass to calculate embeddings
nrof_images = len(image_list)
Expand Down Expand Up @@ -177,8 +179,8 @@ def load_and_align_data(image_paths, image_size, margin, gpu_memory_fraction):

print('Creating networks and loading parameters')
with tf.Graph().as_default():
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=gpu_memory_fraction) # noqa: E501
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options,
gpu_options = tf.compat.v1.GPUOptions(per_process_gpu_memory_fraction=gpu_memory_fraction) # noqa: E501
sess = tf.compat.v1.Session(config=tf.compat.v1.ConfigProto(gpu_options=gpu_options,
log_device_placement=False))
with sess.as_default():
pnet, rnet, onet = detect_face.create_mtcnn(sess, None)
Expand Down
Loading