def load_data(self): """Fetches a set of videos from an LMDB database. Args: batch_size - number of videos to load into memory video_shape - 3 tuple (frames, height, width) for videos """ TT, HH, WW = self.video_shape X = np.empty((self.batch_size,3) + self.video_shape,dtype=self.dtype) y = np.empty((self.batch_size,),dtype=self.dtype) crossed_epoch = False for n in xrange(self.batch_size): try: key,value = next(self.iterator) except StopIteration: self.cursor.first() # reset to beginning self.iterator = iter(self.cursor) crossed_epoch = True self.epoch += 1 key,value = next(self.iterator) datum = Datum4D.fromstring(value) X[n] = datum.array y[n] = datum.label return X, y, crossed_epoch
def create_datum(clip,label): """ Creates a Datum structure from a 4D clip and label. """ datum = Datum4D.array_to_datum(clip,label) return datum
def create_datum(clip, label): """ Creates a Datum structure from a 4D clip and label. """ datum = Datum4D.array_to_datum(clip, label) return datum