Skip to content
Snippets Groups Projects
Commit 1b420252 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Merge branch '25-reading-original-data-from-ijb-a' into 'master'

Resolve "Reading original data from IJB-A"

Closes #25

See merge request !34
parents d6f75c9a f11caa2a
No related branches found
No related tags found
1 merge request!34Resolve "Reading original data from IJB-A"
Pipeline #
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
from .database import FaceBioFile from .database import FaceBioFile
from bob.bio.base.database import BioDatabase, BioFileSet from bob.bio.base.database import BioDatabase, BioFileSet
import os import os
import bob.io.image
class IJBABioFile(FaceBioFile): class IJBABioFile(FaceBioFile):
...@@ -19,9 +20,18 @@ class IJBABioFile(FaceBioFile): ...@@ -19,9 +20,18 @@ class IJBABioFile(FaceBioFile):
super(IJBABioFile, self).__init__(client_id=f.client_id, path=f.path, file_id=f.id) super(IJBABioFile, self).__init__(client_id=f.client_id, path=f.path, file_id=f.id)
self.f = f self.f = f
def make_path(self, directory, extension): def load(self, directory, extension=None, add_client_id=False):
# add file ID to the path, so that a unique path is generated (there might be several identities in each physical file) return bob.io.image.load(self.make_path(directory, self.f.extension, add_client_id))
return str(os.path.join(directory or '', self.path + "-" + str(self.client_id) + (extension or '')))
def make_path(self, directory, extension, add_client_id=True):
if add_client_id:
# add client ID to the path, so that a unique path is generated
# (there might be several identities in each physical file)
path = "%s-%s%s" % (self.path, self.client_id, extension or '')
else:
# do not add the client ID to be able to obtain the original image file
path = "%s%s" % (self.path, extension or '')
return str(os.path.join(directory or '', path))
class IJBABioFileSet(BioFileSet): class IJBABioFileSet(BioFileSet):
...@@ -73,3 +83,6 @@ class IJBABioDatabase(BioDatabase): ...@@ -73,3 +83,6 @@ class IJBABioDatabase(BioDatabase):
def client_id_from_model_id(self, model_id, group='dev'): def client_id_from_model_id(self, model_id, group='dev'):
return self._db.get_client_id_from_model_id(model_id) return self._db.get_client_id_from_model_id(model_id)
def original_file_names(self, files):
return [f.make_path(self.original_directory, f.f.extension, False) for f in files]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment