Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.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
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.bio.base
Merge requests
!218
[test_utils] Do not re-download ATNT database
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
[test_utils] Do not re-download ATNT database
use-default-atnt-directory
into
master
Overview
1
Commits
1
Pipelines
1
Changes
1
Merged
Amir MOHAMMADI
requested to merge
use-default-atnt-directory
into
master
4 years ago
Overview
1
Commits
1
Pipelines
1
Changes
1
Expand
if the data is already inside the low-level db package. Fixes
#127 (closed)
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
254553e8
1 commit,
4 years ago
1 file
+
8
−
18
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
bob/bio/base/test/utils.py
+
8
−
18
Options
@@ -8,8 +8,8 @@ import os
import
sys
import
functools
from
nose.plugins.skip
import
SkipTest
from
bob.extension.download
import
download_and_unzip
import
importlib
from
bob.db.atnt.models
import
DEFAULT_DATADIR
as
ATNT_DEFAULT_DIR
# based on: http://stackoverflow.com/questions/6796492/temporarily-redirect-stdout-stderr
class
Quiet
(
object
):
@@ -91,7 +91,7 @@ def db_available(dbname):
atnt_default_directory
=
(
os
.
environ
[
"
ATNT_DATABASE_DIRECTORY
"
]
if
"
ATNT_DATABASE_DIRECTORY
"
in
os
.
environ
else
"
/idiap/group/biometric/databases/orl/
"
else
ATNT_DEFAULT_DIR
)
global
atnt_downloaded_directory
atnt_downloaded_directory
=
None
@@ -102,36 +102,26 @@ def atnt_database_directory():
if
atnt_downloaded_directory
:
return
atnt_downloaded_directory
if
os
.
path
.
exists
(
atnt_default_directory
):
if
os
.
path
.
isdir
(
atnt_default_directory
):
return
atnt_default_directory
# TODO: THIS SHOULD BE A CLASS METHOD OF bob.db.atnt database
source_url
=
[
"
http://bobconda.lab.idiap.ch/public/data/bob/att_faces.zip
"
,
"
http://www.idiap.ch/software/bob/data/bob/att_faces.zip
"
,
]
from
bob.db.atnt.driver
import
download
from
argparse
import
Namespace
import
tempfile
atnt_downloaded_directory
=
tempfile
.
mkdtemp
(
prefix
=
"
atnt_db_
"
)
logger
.
warn
(
"
Downloading the AT&T database from
'
%s
'
to
'
%s
'
...
"
,
source_url
,
"
Downloading the AT&T database to
'
%s
'
...
"
,
atnt_downloaded_directory
,
)
logger
.
warn
(
"
To avoid this, please
download the database manually, extract the data and set the ATNT_DATABASE_DIRECTORY environment variable to this directory
.
"
"
To avoid this, please
run bob_dbmanage.py atnt download
.
"
)
download
(
Namespace
(
output_dir
=
atnt_downloaded_directory
))
# to avoid re-downloading in parallel test execution
os
.
environ
[
"
ATNT_DATABASE_DIRECTORY
"
]
=
atnt_downloaded_directory
if
not
os
.
path
.
exists
(
atnt_downloaded_directory
):
os
.
mkdir
(
atnt_downloaded_directory
)
download_and_unzip
(
source_url
,
os
.
path
.
join
(
atnt_downloaded_directory
,
"
att_faces.zip
"
)
)
return
atnt_downloaded_directory
Loading