Skip to content

Port Eval Pipeline from csv backend to MetaDataset backend - #217

Merged
pesser merged 18 commits into
pesser:masterfrom
jhaux:port_evaldatafolder
Jan 10, 2020
Merged

pesser merged 18 commits into
pesser:masterfrom
jhaux:port_evaldatafolder

Conversation

@jhaux

@jhaux jhaux commented Dec 13, 2019

Copy link
Copy Markdown
Collaborator

This is a breaking change, old exported data cannot be loaded after this change and needs to be converted.

The following has changed:

  1. No csv is created but paths are still stored as labels, now with name:loader key.
  2. Labels are in a subfolder model_outputs/labels.
  3. A meta.yaml is created, which contains information if an exception occured

@jhaux

jhaux commented Dec 13, 2019

Copy link
Copy Markdown
Collaborator Author

This closes #201

@pesser pesser left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking forward to have the MetaDataset integrated in the evaluation pipeline!

Comment thread edflow/eval/pipeline.py Outdated
@@ -119,6 +119,7 @@ def eval_op(self, inputs):
from edflow.data.util import adjust_support
from edflow.util import walk, retrieve, pop_keypath
from edflow.data.dataset import DatasetMixin, CsvDataset, ProcessedDataset

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need CsvDataset?

Comment thread edflow/eval/pipeline.py Resolved
Comment thread edflow/eval/pipeline.py
self.logger.info(
"To directly reuse the data simply use the following command:\n"
+ "from edflow.data.believers.meta import MetaDataset\n"
+ f'M = MetaDataset("{os.path.abspath(self.save_root)}"\n)'

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is super helpful!

Comment thread edflow/eval/pipeline.py Outdated

class EvalDataFolder(DatasetMixin):
""" """
class EvalDataFolder(MetaDataset):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be kicked out.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed! Will be done asap

@pesser

pesser commented Dec 17, 2019

Copy link
Copy Markdown
Owner

Currently, the following example

import numpy as np                                                                                        
from edflow import TemplateIterator                                                                       
                                                                                                      
class Iterator(TemplateIterator):                                                                         
    def __init__(self, *args, **kwargs):                                                                  
        super().__init__(*args, **kwargs)                                                                 
                                                                                                      
    def step_op(self, model, **batch):                                                                    
        key = list(batch.keys())[0]                                                                       
        def eval_op():                                                                                    
            return {"labels": {"point": np.zeros(batch[key].shape[0])}}                                   
        return dict(eval_op=eval_op)                                                                      
                                                                                                      

def callback(root, data_in, data_out, config, **kwargs):                                                  
    print(data_out.labels)                                                                                

produces

{'oint': memmap([0., 0., 0., ..., 0., 0., 0.])}

Somewhere, the 'p' is deleted. Please check that this PR fixes it.

Removes old loading functionality. We should probably think about adding
a conversion script of the old style outputs to the new ones.
@jhaux

jhaux commented Dec 20, 2019

Copy link
Copy Markdown
Collaborator Author

...

produces

{'oint': memmap([0., 0., 0., ..., 0., 0., 0.])}

Somewhere, the 'p' is deleted. Please check that this PR fixes it.

I thought this was fixed! 😦 Will take a look at it

@pesser pesser left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes everything much cleaner. one minor change and we can merge

Comment thread edflow/eval/pipeline.py Resolved
@jhaux
jhaux force-pushed the port_evaldatafolder branch from 2c13809 to 3a2c18c Compare January 10, 2020 14:13

@pesser pesser left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

@pesser
pesser merged commit 4cd2225 into pesser:master Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants