Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.bio.video
Commits
d8e54955
Commit
d8e54955
authored
Mar 12, 2018
by
Amir MOHAMMADI
Browse files
use six to check for string types
parent
05317b9c
Changes
5
Hide whitespace changes
Inline
Side-by-side
bob/bio/video/algorithm/Wrapper.py
View file @
d8e54955
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
import
six
import
bob.bio.base
import
bob.io.base
...
...
@@ -36,7 +37,7 @@ class Wrapper (bob.bio.base.algorithm.Algorithm):
compressed_io
=
False
):
# load algorithm configuration
if
isinstance
(
algorithm
,
s
tr
):
if
isinstance
(
algorithm
,
s
ix
.
string_types
):
self
.
algorithm
=
bob
.
bio
.
base
.
load_resource
(
algorithm
,
"algorithm"
)
elif
isinstance
(
algorithm
,
bob
.
bio
.
base
.
algorithm
.
Algorithm
):
self
.
algorithm
=
algorithm
...
...
bob/bio/video/annotator/Wrapper.py
View file @
d8e54955
import
six
from
collections
import
OrderedDict
from
bob.bio.face.annotator
import
Base
from
bob.ip.facedetect
import
bounding_box_from_annotation
from
bob.bio.base
import
load_resource
from
bob.bio.face.annotator
import
min_face_size_validator
from
..
import
utils
from
.
import
normalize_annotations
class
Wrapper
(
Base
):
...
...
@@ -37,7 +38,7 @@ class Wrapper(Base):
self
.
max_age
=
max_age
# load annotator configuration
if
isinstance
(
annotator
,
s
tr
):
if
isinstance
(
annotator
,
s
ix
.
string_types
):
self
.
annotator
=
load_resource
(
annotator
,
"annotator"
)
def
annotate
(
self
,
frames
,
**
kwargs
):
...
...
bob/bio/video/extractor/Wrapper.py
View file @
d8e54955
...
...
@@ -4,6 +4,7 @@
import
bob.bio.base
import
bob.io.base
import
os
import
six
from
..
import
utils
...
...
@@ -36,7 +37,7 @@ class Wrapper (bob.bio.base.extractor.Extractor):
compressed_io
=
False
):
# load extractor configuration
if
isinstance
(
extractor
,
s
tr
):
if
isinstance
(
extractor
,
s
ix
.
string_types
):
self
.
extractor
=
bob
.
bio
.
base
.
load_resource
(
extractor
,
"extractor"
)
elif
isinstance
(
extractor
,
bob
.
bio
.
base
.
extractor
.
Extractor
):
self
.
extractor
=
extractor
...
...
bob/bio/video/preprocessor/Wrapper.py
View file @
d8e54955
...
...
@@ -3,6 +3,7 @@
import
bob.bio.base
import
bob.io.base
import
six
from
..
import
utils
...
...
@@ -65,7 +66,7 @@ class Wrapper(bob.bio.base.preprocessor.Preprocessor):
read_original_data
=
_read_video_data
# load preprocessor configuration
if
isinstance
(
preprocessor
,
s
tr
):
if
isinstance
(
preprocessor
,
s
ix
.
string_types
):
self
.
preprocessor
=
bob
.
bio
.
base
.
load_resource
(
preprocessor
,
"preprocessor"
)
elif
isinstance
(
preprocessor
,
bob
.
bio
.
base
.
preprocessor
.
Preprocessor
):
self
.
preprocessor
=
preprocessor
...
...
@@ -181,4 +182,4 @@ class Wrapper(bob.bio.base.preprocessor.Preprocessor):
if
self
.
compressed_io
:
return
utils
.
save_compressed
(
frames
,
filename
,
self
.
preprocessor
.
write_data
)
else
:
frames
.
save
(
bob
.
io
.
base
.
HDF5File
(
filename
,
'w'
),
self
.
preprocessor
.
write_data
)
\ No newline at end of file
frames
.
save
(
bob
.
io
.
base
.
HDF5File
(
filename
,
'w'
),
self
.
preprocessor
.
write_data
)
bob/bio/video/utils/FrameSelector.py
View file @
d8e54955
...
...
@@ -7,6 +7,7 @@ import bob.io.image
import
bob.io.video
import
numpy
import
os
import
six
import
logging
logger
=
logging
.
getLogger
(
"bob.bio.video"
)
...
...
@@ -49,7 +50,7 @@ class FrameSelector:
When giving ``str`` or ``[str]`` data, the given ``load_function`` is used to read the data from file.
"""
# if given a string, first load the video
if
isinstance
(
data
,
s
tr
):
if
isinstance
(
data
,
s
ix
.
string_types
):
logger
.
debug
(
"Loading video file '%s'"
,
data
)
data
=
load_function
(
data
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment