Skip to content

Using ffcv for a "pairwise" dataset in stereo vision #53

Answered by andrewilyas
jatentaki asked this question in Q&A
Discussion options

You must be logged in to vote

Ok @jatentaki ! Let me know if this is what you had in mind. The only key principle below is that instead of making a single loader, just make two loaders and for the second pass indices to be a permutation of np.arange(len(dataset)) that properly lines up the pairs. Zipping the two loaders together should then give you the same functionality as your PairedDataset:

import numpy as np
from ffcv.writer import DatasetWriter
from ffcv.fields import NDArrayField
from ffcv.loader import Loader, OrderOption
from ffcv.fields.decoders import NDArrayDecoder
from tempfile import NamedTemporaryFile

# Really simple dataset of 100 examples, each of the form [i, i+1, ... i+9]
class SimpleDataset:
    def 

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by andrewilyas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants