Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.pad.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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.pad.face
Commits
c11fc771
Commit
c11fc771
authored
4 years ago
by
Anjith GEORGE
Browse files
Options
Downloads
Patches
Plain Diff
For the SCalability experiments
parent
02d2e827
No related branches found
No related tags found
No related merge requests found
Pipeline
#44628
failed
4 years ago
Stage: build
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
bob/pad/face/config/grid.py
+1
-1
1 addition, 1 deletion
bob/pad/face/config/grid.py
bob/pad/face/database/hqwmca_warp.py
+2
-0
2 additions, 0 deletions
bob/pad/face/database/hqwmca_warp.py
bob/pad/face/preprocessor/FaceCropAlign.py
+62
-1
62 additions, 1 deletion
bob/pad/face/preprocessor/FaceCropAlign.py
with
65 additions
and
2 deletions
bob/pad/face/config/grid.py
+
1
−
1
View file @
c11fc771
#!/usr/bin/env python
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# vim: set fileencoding=utf-8 :
from
bob.bio.base.grid
import
Grid
from
bob.bio.base
_legacy
.grid
import
Grid
# Configuration to run on computation cluster:
# Configuration to run on computation cluster:
idiap
=
Grid
(
idiap
=
Grid
(
...
...
This diff is collapsed.
Click to expand it.
bob/pad/face/database/hqwmca_warp.py
+
2
−
0
View file @
c11fc771
...
@@ -239,6 +239,8 @@ class HQWMCAPadDatabase_warp(PadDatabase):
...
@@ -239,6 +239,8 @@ class HQWMCAPadDatabase_warp(PadDatabase):
file_path
=
os
.
path
.
join
(
self
.
annotations_dir
,
ff
.
path
+
"
.json
"
)
file_path
=
os
.
path
.
join
(
self
.
annotations_dir
,
ff
.
path
+
"
.json
"
)
print
(
'
Annotation path
'
,
file_path
)
if
not
os
.
path
.
isfile
(
file_path
):
# no file with annotations
if
not
os
.
path
.
isfile
(
file_path
):
# no file with annotations
# original values of the arguments of f:
# original values of the arguments of f:
...
...
This diff is collapsed.
Click to expand it.
bob/pad/face/preprocessor/FaceCropAlign.py
+
62
−
1
View file @
c11fc771
...
@@ -28,6 +28,67 @@ logger = logging.getLogger("bob.pad.face")
...
@@ -28,6 +28,67 @@ logger = logging.getLogger("bob.pad.face")
# ==============================================================================
# ==============================================================================
def
depth_auto_norm_image
(
data
,
annotations
,
n_sigma
=
3.0
,
norm_method
=
'
MAD
'
,
FD
=
500
):
"""
Normalizes a single channel image to range 0-255, using the data distribution
Expects single channel images
**method: Gaussian , MAD, MINMAX
**n_sigma: The range which is normalized
"""
# print('annotation',annotations)
face
=
data
[
annotations
[
'
topleft
'
][
0
]:
annotations
[
'
bottomright
'
][
0
],
annotations
[
'
topleft
'
][
1
]:
annotations
[
'
bottomright
'
][
1
]]
face
=
face
.
astype
(
'
float
'
)
data
=
data
.
astype
(
'
float
'
)
assert
(
len
(
data
.
shape
)
==
2
)
face_c
=
np
.
ma
.
array
(
face
).
compressed
()
# Avoiding zeros from flat field in thermal and holes in depth
face_c
=
face_c
[
face_c
>
1.0
]
if
norm_method
==
'
STD
'
:
mu
=
np
.
mean
(
face_c
)
std
=
np
.
std
(
face_c
)
data_n
=
((
data
-
mu
+
n_sigma
*
std
)
/
(
2.0
*
n_sigma
*
std
))
*
255.0
if
norm_method
==
'
MAD
'
:
med
=
np
.
median
(
face_c
)
mad
=
np
.
median
(
np
.
abs
(
face_c
-
med
))
data_n
=
((
data
-
med
+
n_sigma
*
mad
)
/
(
2.0
*
n_sigma
*
mad
))
*
255.0
if
norm_method
==
'
MINMAX
'
:
t_min
=
np
.
min
(
face_c
)
t_max
=
np
.
max
(
face_c
)
data_n
=
((
data
-
t_min
)
/
(
t_max
-
t_min
))
*
255.0
# Clamping to 0-255
data_n
=
np
.
maximum
(
data_n
,
0
)
data_n
=
np
.
minimum
(
data_n
,
255
)
data_n
=
data_n
.
astype
(
'
uint8
'
)
return
data_n
def
auto_norm_image
(
data
,
annotations
,
n_sigma
=
3.0
,
norm_method
=
'
MAD
'
):
def
auto_norm_image
(
data
,
annotations
,
n_sigma
=
3.0
,
norm_method
=
'
MAD
'
):
"""
"""
Normalizes a single channel image to range 0-255, using the data distribution
Normalizes a single channel image to range 0-255, using the data distribution
...
@@ -581,7 +642,7 @@ class FaceCropAlign(Preprocessor):
...
@@ -581,7 +642,7 @@ class FaceCropAlign(Preprocessor):
print
(
'
INSIDE FACECROP ALIGN
'
,
annotations
.
keys
(),
annotations
)
#
print('INSIDE FACECROP ALIGN',annotations.keys(), annotations)
if
self
.
normalization_function
is
not
None
:
if
self
.
normalization_function
is
not
None
:
image
=
self
.
normalization_function
(
image
,
annotations
,
**
self
.
normalization_function_kwargs
)
image
=
self
.
normalization_function
(
image
,
annotations
,
**
self
.
normalization_function_kwargs
)
...
...
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