Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bob.db.hqwmca
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
Show more breadcrumbs
bob
bob.db.hqwmca
Commits
9c12e2c3
Commit
9c12e2c3
authored
4 years ago
by
Anjith GEORGE
Browse files
Options
Downloads
Plain Diff
Merge branch 'bob9' into 'master'
Replace FrameCOntainer See merge request
!5
parents
222a93a8
38727f2e
No related branches found
No related tags found
1 merge request
!5
Replace FrameCOntainer
Pipeline
#51901
passed
3 years ago
Stage: build
Stage: deploy
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bob/db/hqwmca/models.py
+13
-37
13 additions, 37 deletions
bob/db/hqwmca/models.py
conda/meta.yaml
+21
-17
21 additions, 17 deletions
conda/meta.yaml
requirements.txt
+6
-3
6 additions, 3 deletions
requirements.txt
with
40 additions
and
57 deletions
bob/db/hqwmca/models.py
+
13
−
37
View file @
9c12e2c3
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
pkg_resources
import
pkg_resources
import
numpy
import
numpy
as
np
from
sqlalchemy
import
Table
,
Column
,
Integer
,
String
,
Boolean
,
Sequence
,
ForeignKey
from
sqlalchemy
import
Table
,
Column
,
Integer
,
String
,
Boolean
,
Sequence
,
ForeignKey
from
sqlalchemy.orm
import
backref
from
sqlalchemy.orm
import
backref
...
@@ -11,8 +11,10 @@ from sqlalchemy.ext.declarative import declarative_base
...
@@ -11,8 +11,10 @@ from sqlalchemy.ext.declarative import declarative_base
from
bob.db.base
import
File
from
bob.db.base
import
File
from
bob.db.base.sqlalchemy_migration
import
Enum
,
relationship
from
bob.db.base.sqlalchemy_migration
import
Enum
,
relationship
from
bob.bio.video
import
VideoLikeContainer
from
bob.io.stream
import
StreamFile
from
bob.io.stream
import
StreamFile
from
bob.bio.video
import
FrameContainer
import
bob.ip.stereo
# It defines some streams operations (eg warp) that could be needed.
from
.attack_dictionaries
import
idiap_type_id_config
,
idiap_subtype_id_config
,
idiap_pai_id_config
from
.attack_dictionaries
import
idiap_type_id_config
,
idiap_subtype_id_config
,
idiap_pai_id_config
...
@@ -129,57 +131,31 @@ class VideoFile(Base, File):
...
@@ -129,57 +131,31 @@ class VideoFile(Base, File):
-------
-------
dict:
dict:
Dictionary where the key is the stream and
Dictionary where the key is the stream and
value is the data (i.e a
Fram
eContainer).
value is the data (i.e a
VideoLik
eContainer).
"""
"""
def
convert_arrays_to_frame_container
(
data
):
"""
Convert an input into Frame Container. Inputs is an iterable.
.. warning:: This function already exists in ``bob.pad.face`` !
Parameters
----------
data: :py:class:`numpy.ndarray`
Array containing the data, where the first dimension is the frame
Returns
-------
bob.bio.video:FrameContainer
FrameContainer containing the frames data.
"""
frame_container
=
FrameContainer
()
for
idx
,
item
in
enumerate
(
data
):
frame_container
.
add
(
idx
,
item
)
return
frame_container
stream_config_path
=
pkg_resources
.
resource_filename
(
'
bob.io.stream
'
,
'
config/idiap_face_streams.json
'
)
stream_config_path
=
pkg_resources
.
resource_filename
(
'
bob.io.stream
'
,
'
config/idiap_face_streams.json
'
)
camera_config_path
=
pkg_resources
.
resource_filename
(
'
bob.ip.stereo
'
,
'
config/idiap_face_calibration.json
'
)
camera_config_path
=
pkg_resources
.
resource_filename
(
'
bob.ip.stereo
'
,
'
config/idiap_face_calibration.json
'
)
file_path
=
self
.
make_path
(
directory
,
extension
)
file_path
=
self
.
make_path
(
directory
,
extension
)
ret
=
{}
ret
=
{}
assert
isinstance
(
streams
,
dict
)
assert
isinstance
(
streams
,
dict
)
# set source
stream_file
=
StreamFile
(
file_path
,
stream_config_path
)
stream_file
.
set_camera_configs
(
camera_config_path
)
# bob.ip.stereo adds this method to StreamFile
stream_file
=
StreamFile
(
file_path
,
stream_config_path
,
camera_config_path
)
for
name
,
video
in
streams
.
items
():
video
.
set_source
(
stream_file
)
# load and process
for
name
,
video
in
streams
.
items
():
step
=
video
.
shape
[
0
]
//
n_frames
for
name
,
stream
in
streams
.
items
():
stream
.
set_source
(
stream_file
)
step
=
stream
.
shape
[
0
]
//
n_frames
# load data in format <frame, channel, height, width>
# load data in format <frame, channel, height, width>
data
=
video
.
load
(
slice
(
0
,
video
.
shape
[
0
],
step
))
data
=
stream
.
load
(
slice
(
0
,
stream
.
shape
[
0
],
step
))
# remove the empty dimension if there is only one channel
# remove the empty dimension if there is only one channel
if
data
.
shape
[
1
]
==
1
:
if
data
.
shape
[
1
]
==
1
:
data
=
data
[:,
0
,
:,
:]
data
=
data
[:,
0
,
:,
:]
ret
[
name
]
=
convert_arrays_to_frame_container
(
data
)
ret
[
name
]
=
VideoLikeContainer
(
data
,
range
(
data
.
shape
[
0
]))
# Keep a trace of the indices in the original array ?
return
ret
return
ret
...
...
This diff is collapsed.
Click to expand it.
conda/meta.yaml
+
21
−
17
View file @
9c12e2c3
...
@@ -30,26 +30,30 @@ requirements:
...
@@ -30,26 +30,30 @@ requirements:
-
bob.db.base
-
bob.db.base
-
bob.io.base
-
bob.io.base
-
bob.bio.video
-
bob.bio.video
-
future
-
matplotlib
-
numpy
-
scikit-image
-
bob.io.stream
-
bob.io.stream
-
scipy
-
bob.ip.stereo
-
six
-
future
-
sqlalchemy
-
matplotlib {{ matplotlib }}
-
numpy {{ numpy }}
-
scikit-image {{ scikit_image }}
-
scipy {{ scipy }}
-
six {{ six }}
-
sqlalchemy {{ sqlalchemy }}
-
dask {{ dask }}
-
distributed {{ distributed }}
run
:
run
:
-
python
-
{{
pin_compatible('
python
')
}}
-
setuptools
-
{{
pin_compatible('
setuptools
')
}}
-
future
-
future
-
matplotlib
-
{{
pin_compatible('matplotlib')
}}
-
numpy >=1.10
-
{{
pin_compatible('numpy')
}}
-
scikit-image
-
{{
pin_compatible('scikit-image')
}}
-
bob.ip.stereo
-
{{
pin_compatible('scipy')
}}
-
bob.io.stream
-
{{
pin_compatible('sqlalchemy')
}}
-
scipy
-
{{
pin_compatible('six')
}}
-
six
-
{{
pin_compatible('dask')
}}
-
sqlalchemy
-
{{
pin_compatible('distributed')
}}
test
:
test
:
imports
:
imports
:
...
...
This diff is collapsed.
Click to expand it.
requirements.txt
+
6
−
3
View file @
9c12e2c3
setuptools
setuptools
bob.
bio.video
bob.
extension
bob.db.base
bob.db.base
bob.io.base
bob.io.base
bob.
ip.ster
eo
bob.
bio.vid
eo
bob.io.stream
bob.io.stream
bob.ip.stereo
future
future
matplotlib
matplotlib
numpy
>=1.10
numpy
scikit-image
scikit-image
scipy
scipy
six
six
sqlalchemy
sqlalchemy
dask
distributed
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