Created a function that batches a tf-record in order and apply data augmentation
Updated the LFW to tfrecord script to the new feature format.
Mind to review that (just few lines of code)?
Thanks
Merge request reports
Activity
@tiago.pereira what is the difference between this and the generic one that we have?
Here is how you can convert this into a configuration for our main script:
import bob.db.lfw import bob.io.base import bob.io.image import six data_path = 'data_path' output = 'output_file' extension = 'extension' protocol = 'protocol' data_type = 'data-type' def get_pairs(all_pairs, match=True): enroll = [] probe = [] for p in all_pairs: if p.is_match == match: enroll.append(p.enroll_file) probe.append(p.probe_file) return enroll, probe # Loading LFW models database = bob.db.lfw.Database() enroll, probe = get_pairs(database.pairs(protocol=protocol), match=True) client_ids = list(set([f.client_id for f in enroll] + [f.client_id for f in probe])) client_ids = dict(zip(client_ids, range(len(client_ids)))) def file_to_label(f): return client_ids[str(f.client_id)] samples = (val for pair in six.moves.zip(enroll, probe) for val in pair) def reader(f): path = f.make_path(data_path, extension) data = bob.io.image.to_matplotlib( bob.io.base.load(path)).astype(data_type) key = str(f.path).encode('utf-8') label = file_to_label(f) return (data, label, key)
mentioned in commit 2404d630
Thanks @tiago.pereira
Please register or sign in to reply