Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.rppg.base
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bob
bob.rppg.base
Commits
35ecdead
Commit
35ecdead
authored
6 years ago
by
Guillaume HEUSCH
Browse files
Options
Downloads
Patches
Plain Diff
[ssr] python 2 and 3 compatibility, bob logger
parent
8e0ce2fc
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/rppg/ssr/script/spatial_subspace_rotation.py
+20
-42
20 additions, 42 deletions
bob/rppg/ssr/script/spatial_subspace_rotation.py
with
20 additions
and
42 deletions
bob/rppg/ssr/script/spatial_subspace_rotation.py
+
20
−
42
View file @
35ecdead
#!/usr/bin/env python
#!/usr/bin/env python
# encoding: utf-8
# encoding: utf-8
# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/
"""
Pulse extraction using 2SR algorithm (%(version)s)
# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>,
#
# This file is part of bob.rpgg.base.
#
# bob.rppg.base is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# bob.rppg.base is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>.
'''
Pulse extraction for database videos (%(version)s)
Usage:
Usage:
%(prog)s (cohface | hci) [--protocol=<string>] [--subset=<string> ...]
%(prog)s (cohface | hci) [--protocol=<string>] [--subset=<string> ...]
...
@@ -70,16 +53,15 @@ Examples:
...
@@ -70,16 +53,15 @@ Examples:
See
'
%(prog)s --help
'
for more information.
See
'
%(prog)s --help
'
for more information.
'''
"""
from
__future__
import
print_function
import
os
import
os
import
sys
import
sys
import
pkg_resources
import
pkg_resources
import
logging
from
bob.core.log
import
setup
__logging_format__
=
'
[%(levelname)s] %(message)s
'
logger
=
setup
(
"
bob.rppg.base
"
)
logging
.
basicConfig
(
format
=
__logging_format__
)
logger
=
logging
.
getLogger
(
"
ssr_logger
"
)
from
docopt
import
docopt
from
docopt
import
docopt
...
@@ -104,19 +86,12 @@ def main(user_input=None):
...
@@ -104,19 +86,12 @@ def main(user_input=None):
arguments
=
sys
.
argv
[
1
:]
arguments
=
sys
.
argv
[
1
:]
prog
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
prog
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
completions
=
dict
(
completions
=
dict
(
prog
=
prog
,
version
=
version
,)
prog
=
prog
,
args
=
docopt
(
__doc__
%
completions
,
argv
=
arguments
,
version
=
'
Signal extractor for videos (%s)
'
%
version
,)
version
=
version
,
)
args
=
docopt
(
__doc__
%
completions
,
argv
=
arguments
,
version
=
'
Spatial subspace rotation for videos (%s)
'
%
version
,
)
# if the user wants more verbosity, lowers the logging level
# if the user wants more verbosity, lowers the logging level
if
args
[
'
--verbose
'
]
==
1
:
logging
.
getLogger
(
"
ssr_logger
"
).
setLevel
(
logging
.
INFO
)
from
bob.core.log
import
set_verbosity_level
elif
args
[
'
--verbose
'
]
>=
2
:
logging
.
getLogger
(
"
ssr_logger
"
).
setLevel
(
logging
.
DEBUG
)
set_verbosity_level
(
logger
,
args
[
'
--verbose
'
]
)
# chooses the database driver to use
# chooses the database driver to use
if
args
[
'
cohface
'
]:
if
args
[
'
cohface
'
]:
...
@@ -154,19 +129,22 @@ def main(user_input=None):
...
@@ -154,19 +129,22 @@ def main(user_input=None):
sys
.
exit
()
sys
.
exit
()
objects
=
db
.
objects
(
args
[
'
--protocol
'
],
args
[
'
--subset
'
])
objects
=
db
.
objects
(
args
[
'
--protocol
'
],
args
[
'
--subset
'
])
# tells the number of grid objects, and exit
if
args
[
'
--gridcount
'
]:
print
len
(
objects
)
sys
.
exit
()
# if we are on a grid environment, just find what I have to process.
# if we are on a grid environment, just find what I have to process.
if
os
.
environ
.
has_key
(
'
SGE_TASK_ID
'
):
sge
=
False
try
:
sge
=
os
.
environ
.
has_key
(
'
SGE_TASK_ID
'
)
# python2
except
AttributeError
:
sge
=
'
SGE_TASK_ID
'
in
os
.
environ
# python3
if
sge
:
pos
=
int
(
os
.
environ
[
'
SGE_TASK_ID
'
])
-
1
pos
=
int
(
os
.
environ
[
'
SGE_TASK_ID
'
])
-
1
if
pos
>=
len
(
objects
):
if
pos
>=
len
(
objects
):
raise
RuntimeError
,
"
Grid request for job %d on a setup with %d jobs
"
%
\
raise
RuntimeError
(
"
Grid request for job {} on a setup with {} jobs
"
.
format
(
pos
,
len
(
objects
)))
(
pos
,
len
(
objects
))
objects
=
[
objects
[
pos
]]
objects
=
[
objects
[
pos
]]
if
args
[
'
--gridcount
'
]:
print
(
len
(
objects
))
# does the actual work
# does the actual work
for
obj
in
objects
:
for
obj
in
objects
:
...
...
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