예제 #1
0
파일: fetcher.py 프로젝트: wkal/cnn-project
 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
예제 #2
0
def create_datum(clip,label):
    """ Creates a Datum structure from a 4D clip and label. """
    datum = Datum4D.array_to_datum(clip,label)
    return datum
예제 #3
0
def create_datum(clip, label):
    """ Creates a Datum structure from a 4D clip and label. """
    datum = Datum4D.array_to_datum(clip, label)
    return datum