CSVSampleLoaders as transformers
Made CSVSampleLoaders as scikit-learn transformers
This is a good idea indeed.
I made to classes. The CSVToSampleLoader
converts one line to one sample; and AnnotationsLoader
that aggregates from CSVToSampleLoader
to read annotations using bob.db.base.read_anno...
.
This is delayed.
I'm already porting this stuff on bob.bio.base
. Code is way more cleaner.
ping @amohammadi @ydayer
Closes #30 (closed)
Merge request reports
Activity
- Resolved by Tiago de Freitas Pereira
mentioned in merge request bob.bio.base!233 (merged)
mentioned in merge request bob.bio.face!88 (merged)
mentioned in commit b6aa62d8
67 def transform(self, X): 68 """ 69 Transform one CVS line to ONE :any:`bob.pipelines.DelayedSample` 70 71 Parameters 72 ---------- 73 X: 74 CSV File Object (open file) 75 76 """ 77 X.seek(0) 78 reader = csv.reader(X) 79 header = next(reader) 80 81 self.check_header(header) 82 return [self.convert_row_to_sample(row, header) for row in reader] @tiago.pereira this is not what I had in mind. Maybe I didn't explain this clearly enough. I will get back to you with a more clear design later.
Well,
CSVToSampleLoaders
are working as transformers and you can stack any kind of transformations you want withmake_pipeline
.I have some example on how this can be used here: https://gitlab.idiap.ch/bob/bob.pipelines/-/blob/master/bob/pipelines/tests/test_sample_loaders.py#L24 and https://gitlab.idiap.ch/bob/bob.bio.face/-/blob/master/bob/bio/face/database/meds.py#L63