Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.face
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
Package registry
Model registry
Operate
Environments
Terraform modules
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.bio.face
Commits
156262a5
Commit
156262a5
authored
7 years ago
by
Guillaume HEUSCH
Browse files
Options
Downloads
Patches
Plain Diff
[extractor] fixed DRGANLight extractor
parent
2890af32
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/face/extractor/DRGANLight.py
+9
-7
9 additions, 7 deletions
bob/bio/face/extractor/DRGANLight.py
with
9 additions
and
7 deletions
bob/bio/face/extractor/DRGANLight.py
+
9
−
7
View file @
156262a5
...
...
@@ -14,7 +14,7 @@ from torch.autograd import Variable
from
bob.learn.pytorch.architectures
import
DRGAN_encoder
as
drgan_encoder
class
LuanExtractor
(
Extractor
):
class
DRGANLight
(
Extractor
):
"""
**Parameters:**
...
...
@@ -27,7 +27,7 @@ class LuanExtractor(Extractor):
self
.
latent_dim
=
320
self
.
image_size
=
(
3
,
64
,
64
)
self
.
encoder
=
drgan_encoder
(
input_image
.
shape
,
latent_dim
)
self
.
encoder
=
drgan_encoder
(
self
.
image_size
,
self
.
latent_dim
)
# image pre-processing
self
.
to_tensor
=
transforms
.
ToTensor
()
...
...
@@ -53,14 +53,16 @@ class LuanExtractor(Extractor):
input_image
=
self
.
to_tensor
(
input_image
)
input_image
=
self
.
norm
(
input_image
)
input_image
=
input_image
.
unsqueeze
(
0
)
encoded_id
=
encoder
.
forward
(
Variable
(
input_image
))
print
encoded_id
import
sys
sys
.
exit
()
encoded_id
=
self
.
encoder
.
forward
(
Variable
(
input_image
))
encoded_id
=
encoded_id
.
data
.
numpy
()
encoded_id
=
encoded_id
[
0
,
:,
0
,
0
]
#print encoded_id.shape
#import sys
#sys.exit()
return
encoded_id
# re-define the train function to get it non-documented
def
train
(
*
args
,
**
kwargs
):
raise
NotImplementedError
(
"
This function is not implemented and should not be called.
"
)
def
load
(
self
,
extractor_file
):
encoder
.
load_state_dict
(
torch
.
load
(
extractor_file
,
map_location
=
lambda
storage
,
loc
:
storage
))
self
.
encoder
.
load_state_dict
(
torch
.
load
(
extractor_file
,
map_location
=
lambda
storage
,
loc
:
storage
))
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