pandaset-devkit
pandaset-devkit copied to clipboard
Unloading fix
Now unloading a sequence does not delete the information about the sequence from the dataset - it just release the loaded data.
@ltriess could you have a look at it? It's related to #76
Ah, and a use case:
Previously, this code gives first iteration over the whole dataset, then no iteration, since the information about the sequences was gone:
for sequence in dataset.sequences(): # Normal iteration
seq = dataset[sequence]
seq.load()
dataset.unload(sequence)
for sequence in dataset.sequences(): # Empty list of sequences
seq = dataset[sequence]
seq.load()
dataset.unload(sequence)
And now it's possible to iterate over the dataset multiple times, without reinitializing dataset variable:
for sequence in dataset.sequences(): # Normal iteration
seq = dataset[sequence]
seq.load()
dataset.unload(sequence)
for sequence in dataset.sequences(): # Normal iteration
seq = dataset[sequence]
seq.load()
dataset.unload(sequence)
Looks like a better fix to me. I think @xpchuan-95 can merge it?
Still it would be better to not have to re-initialize the sequence or to not even need this unloading mechanism at all. But I guess this would require a new loading concept, therefore the solutions provided by this pull request and #76 are sufficient enough for a fix.