trw.train.sequence_max_samples

Module Contents

Classes

SequenceMaxSamples

Virtual resize of the sequence. The sequence will terminate when a certain number

class trw.train.sequence_max_samples.SequenceMaxSamples(source_split, max_samples)

Bases: trw.train.sequence.Sequence, trw.train.sequence.SequenceIterator

Virtual resize of the sequence. The sequence will terminate when a certain number

of samples produced has been reached. Restart the sequence where it was stopped.

subsample(self, nb_samples)

Sub-sample a sequence to a fixed number of samples.

The purpose is to obtain a smaller sequence, this is particularly useful for the export of augmentations, samples.

Parameters

nb_samples – the number of samples desired in the original sequence

Returns

a subsampled Sequence

subsample_uids(self, uids, uids_name, new_sampler=None)

Sub-sample a sequence to samples with specified UIDs.

Parameters
  • uids (list) – the uids. If new_sampler keeps the ordering, then the samples of the resampled sequence should follow uids ordering

  • uids_name (str) – the name of the UIDs

  • new_sampler (Sampler) – the sampler to be used for the subsampler sequence. If None, re-use the existing

Returns

a subsampled Sequence

__next__(self)
Returns

The next batch of data

__iter__(self)
Returns

An iterator of batches

close(self)

Special method to close and clean the resources of the sequence