Skip to content

how to compose the train_dataset with two different pipelines #1346

Answered by LeoXing1996
hadesfgh asked this question in How-to
Discussion options

You must be logged in to vote

@hadesfgh , If the transform is randomly applied to each samples, you can use RandomApply transform.

If you want to apply specific transforms to specific samples, you can decide whether you want to perform a data transformation operation based on the file name (or other metainfo). A demo implementation is provided as follow:

class SampleSpecTransform(BaseTransform):
    def __init__(self, filter_key, *args, **kwargs):

        self.filter_key = filter_key  # a filter function to judge the sample
        ...

    def transform(self, results):
        # get some metainfo in some way
        img_path = results['img_path']

        # judge whether apply the transformation
        if self.filt…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@hadesfgh
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by zengyh1900
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
How-to
Labels
None yet
3 participants