Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.ip.tensorflow_extractor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.ip.tensorflow_extractor
Commits
ff0a629f
There was a problem fetching the pipeline summary.
Commit
ff0a629f
authored
7 years ago
by
Amir MOHAMMADI
Browse files
Options
Downloads
Plain Diff
Merge branch 'rcvariables' into 'master'
Renamed the bobrc variables and update the docs Closes
#2
See merge request
!6
parents
81aae6a2
d67d354f
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!6
Renamed the bobrc variables and update the docs
Pipeline
#
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bob/ip/tensorflow_extractor/DrGanMSU.py
+22
-4
22 additions, 4 deletions
bob/ip/tensorflow_extractor/DrGanMSU.py
bob/ip/tensorflow_extractor/FaceNet.py
+21
-4
21 additions, 4 deletions
bob/ip/tensorflow_extractor/FaceNet.py
doc/guide.rst
+15
-0
15 additions, 0 deletions
doc/guide.rst
with
58 additions
and
8 deletions
bob/ip/tensorflow_extractor/DrGanMSU.py
+
22
−
4
View file @
ff0a629f
...
...
@@ -6,6 +6,7 @@ import numpy
import
tensorflow
as
tf
import
os
from
bob.extension
import
rc
from
bob.extension.rc_config
import
_saverc
from
.
import
download_file
import
logging
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -331,7 +332,7 @@ class DrGanMSUExtractor(object):
"""
def
__init__
(
self
,
model_path
=
rc
[
"
drgan_modelpath
"
],
image_size
=
[
96
,
96
,
3
]):
def
__init__
(
self
,
model_path
=
rc
[
"
bob.ip.tensorflow_extractor.
drgan_modelpath
"
],
image_size
=
[
96
,
96
,
3
]):
self
.
image_size
=
image_size
self
.
session
=
tf
.
Session
()
...
...
@@ -363,9 +364,22 @@ class DrGanMSUExtractor(object):
@staticmethod
def
get_modelpath
():
import
pkg_resources
return
pkg_resources
.
resource_filename
(
__name__
,
'
data/DR_GAN_model
'
)
# Priority to the RC path
model_path
=
rc
[
DrGanMSUExtractor
.
get_rcvariable
()]
if
model_path
is
None
:
import
pkg_resources
model_path
=
pkg_resources
.
resource_filename
(
__name__
,
'
data/DR_GAN_model
'
)
return
model_path
@staticmethod
def
get_rcvariable
():
return
"
bob.ip.tensorflow_extractor.drgan_modelpath
"
@staticmethod
def
download_model
():
...
...
@@ -400,6 +414,10 @@ class DrGanMSUExtractor(object):
with
zipfile
.
ZipFile
(
zip_file
)
as
myzip
:
myzip
.
extractall
(
os
.
path
.
dirname
(
DrGanMSUExtractor
.
get_modelpath
()))
logger
.
info
(
"
Saving the path `{0}` in the ~.bobrc file
"
.
format
(
DrGanMSUExtractor
.
get_modelpath
()))
rc
[
DrGanMSUExtractor
.
get_rcvariable
()]
=
DrGanMSUExtractor
.
get_modelpath
()
_saverc
(
rc
)
# delete extra files
os
.
unlink
(
zip_file
)
...
...
This diff is collapsed.
Click to expand it.
bob/ip/tensorflow_extractor/FaceNet.py
+
21
−
4
View file @
ff0a629f
...
...
@@ -8,6 +8,7 @@ from bob.ip.color import gray_to_rgb
from
bob.io.image
import
to_matplotlib
from
.
import
download_file
from
bob.extension
import
rc
from
bob.extension.rc_config
import
_saverc
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -74,7 +75,7 @@ class FaceNet(object):
"""
def
__init__
(
self
,
model_path
=
rc
[
"
facenet_modelpath
"
],
model_path
=
rc
[
"
bob.ip.tensorflow_extractor.
facenet_modelpath
"
],
image_size
=
160
,
**
kwargs
):
super
(
FaceNet
,
self
).
__init__
()
...
...
@@ -140,11 +141,23 @@ class FaceNet(object):
def
__del__
(
self
):
tf
.
reset_default_graph
()
@staticmethod
def
get_rcvariable
():
return
"
bob.ip.tensorflow_extractor.facenet_modelpath
"
@staticmethod
def
get_modelpath
():
import
pkg_resources
return
pkg_resources
.
resource_filename
(
__name__
,
'
data/FaceNet/20170512-110547
'
)
# Priority to the RC path
model_path
=
rc
[
FaceNet
.
get_rcvariable
()]
if
model_path
is
None
:
import
pkg_resources
model_path
=
pkg_resources
.
resource_filename
(
__name__
,
'
data/FaceNet/20170512-110547
'
)
return
model_path
@staticmethod
def
download_model
():
...
...
@@ -182,5 +195,9 @@ class FaceNet(object):
with
zipfile
.
ZipFile
(
zip_file
)
as
myzip
:
myzip
.
extractall
(
os
.
path
.
dirname
(
FaceNet
.
get_modelpath
()))
logger
.
info
(
"
Saving the path `{0}` in the ~.bobrc file
"
.
format
(
FaceNet
.
get_modelpath
()))
rc
[
FaceNet
.
get_rcvariable
()]
=
FaceNet
.
get_modelpath
()
_saverc
(
rc
)
# delete extra files
os
.
unlink
(
zip_file
)
This diff is collapsed.
Click to expand it.
doc/guide.rst
+
15
−
0
View file @
ff0a629f
...
...
@@ -55,6 +55,14 @@ Facenet Model
:ref:`bob.bio.base <bob.bio.base>` wrapper Facenet model.
Check `here for more info <py_api.html#bob.ip.tensorflow_extractor.FaceNet>`_
.. note::
The models will automatically download to the data folder of this package and save it in
``[env-path]./bob/ip/tensorflow_extractor/data/FaceNet``.
If you want want set another path for this model do::
$ bob config set bob.ip.tensorflow_extractor.facenet_modelpath /path/to/mydatabase
DRGan from L.Tran @ MSU:
...
...
@@ -63,6 +71,13 @@ DRGan from L.Tran @ MSU:
:ref:`bob.bio.base <bob.bio.base>` wrapper to the DRGan model trained by L.Tran @ MSU.
Check `here <py_api.html#bob.ip.tensorflow_extractor.DrGanMSUExtractor>`_ for more info
.. note::
The models will automatically download to the data folder of this package and save it in
``[env-path]./bob/ip/tensorflow_extractor/data/DR_GAN_model``.
If you want want set another path for this model do::
$ bob config set bob.ip.tensorflow_extractor.drgan_modelpath /path/to/mydatabase
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment