示例#1
0
# get the model.
model = Extractor()

# Loop through data.
pbar = tqdm(total=len(data.data) * 3)
for video in data.data:

    frames = data.get_frames_for_sample(video)

    # Now downsample to just the ones we need.
    frames = data.rescale_list(frames, seq_length)
    # print frames
    # print len(frames)
    for i in range(3):
        frames_of_sixteen = data.get_frames_of_sixteen(frames)

        # Get the path to the sequence for this video.
        path = '/home/wpc/sequences/' + video[2] + '-16-' + str(
            seq_length) + '-' + str(i) + '-features.txt'

        # Check if we already have it.
        if os.path.isfile(path):
            pbar.update(1)
            continue

    # Now loop through and extract features to build the sequence.
        sequence = []
        for image in frames_of_sixteen:
            features = model.extract(image)
            sequence.append(features)