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
d0adbeec
There was a problem fetching the pipeline summary.
Commit
d0adbeec
authored
6 years ago
by
Guillaume HEUSCH
Browse files
Options
Downloads
Patches
Plain Diff
[ssr] python 2 and 3 compatibility, bob logger
parent
35ecdead
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/rppg/ssr/script/ssr_from_mask.py
+17
-39
17 additions, 39 deletions
bob/rppg/ssr/script/ssr_from_mask.py
with
17 additions
and
39 deletions
bob/rppg/ssr/script/ssr_from_mask.py
+
17
−
39
View file @
d0adbeec
#!/usr/bin/env python
# encoding: utf-8
# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/
# 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 extractor for database videos (%(version)s)
"""
Pulse extractor using 2SR algorithm (%(version)s)
Usage:
%(prog)s (cohface | hci) [--protocol=<string>] [--subset=<string> ...]
...
...
@@ -68,15 +50,14 @@ Example:
See
'
%(prog)s --help
'
for more information.
"""
from
__future__
import
print_function
import
os
import
sys
import
pkg_resources
import
logging
__logging_format__
=
'
[%(levelname)s] %(message)s
'
logging
.
basicConfig
(
format
=
__logging_format__
)
logger
=
logging
.
getLogger
(
"
extract_log
"
)
from
bob.core.log
import
setup
logger
=
setup
(
"
bob.rppg.base
"
)
from
docopt
import
docopt
...
...
@@ -110,19 +91,12 @@ def main(user_input=None):
arguments
=
sys
.
argv
[
1
:]
prog
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
completions
=
dict
(
prog
=
prog
,
version
=
version
,
)
args
=
docopt
(
__doc__
%
completions
,
argv
=
arguments
,
version
=
'
Signal extractor for videos (%s)
'
%
version
,
)
completions
=
dict
(
prog
=
prog
,
version
=
version
,)
args
=
docopt
(
__doc__
%
completions
,
argv
=
arguments
,
version
=
'
Signal extractor for videos (%s)
'
%
version
,)
# if the user wants more verbosity, lowers the logging level
if
args
[
'
--verbose
'
]
==
1
:
logging
.
getLogger
(
"
extract_log
"
).
setLevel
(
logging
.
INFO
)
elif
args
[
'
--verbose
'
]
>=
2
:
logging
.
getLogger
(
"
extract_log
"
).
setLevel
(
logging
.
DEBUG
)
from
bob.core.log
import
set_verbosity_level
set_verbosity_level
(
logger
,
args
[
'
--verbose
'
]
)
# chooses the database driver to use
if
args
[
'
cohface
'
]:
...
...
@@ -161,16 +135,20 @@ def main(user_input=None):
objects
=
db
.
objects
(
args
[
'
--protocol
'
],
args
[
'
--subset
'
])
# 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
if
pos
>=
len
(
objects
):
raise
RuntimeError
,
"
Grid request for job %d on a setup with %d jobs
"
%
\
(
pos
,
len
(
objects
))
raise
RuntimeError
(
"
Grid request for job {} on a setup with {} jobs
"
.
format
(
pos
,
len
(
objects
)))
objects
=
[
objects
[
pos
]]
if
args
[
'
--gridcount
'
]:
print
len
(
objects
)
sys
.
exit
()
print
(
len
(
objects
))
# the temporal stride
temporal_stride
=
int
(
args
[
'
--stride
'
])
...
...
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