<commit_before>from VideoReader import * 
from ArgParser import *
import sys, cv2, pickle, os

FRAME_STEP = 5
HISTORY_WINDOW = 30 
FUTURE_WINDOW = 20

def export_frames(fnums, fname):
    f = open(fname, 'w')
    pickle.dump(fnums, f)


def drawBorder(I, color, thickness): 
    cv2.rectangle(I, (0,0), (I.shape[1], I.shape[0]), color, thickness)

if __name__ == '__main__':
    args = parse_args(sys.argv[1], sys.argv[2])
    reader = VideoReader(args['video'])

    outdir = sys.argv[1] + '/car_frames'
    try:
        os.mkdir(outdir)
    except:
        pass

    outfname = outdir + "/" + args['basename'] + '.pickle'


    framenums = set()
    last_record = 0 
    while True:
        for p in range(FRAME_STEP):
            (success, I) = reader.getNextFrame()
        if not success:
            break

        if reader.framenum in framenums:
            drawBorder(I, (0,255,0), 10)
        cv2.imshow('video', cv2.pyrDown(cv2.pyrDown(I)))
        key = chr(cv2.waitKey(5) & 255)
        if key == 'c':
            print reader.framenum
            for p in range(HISTORY_WINDOW):
                framenums.add(reader.framenum - p)
            for p in range(FUTURE_WINDOW):
                framenums.add(reader.framenum + p)
<commit_msg>fixing for cluster<commit_after>from VideoReader import * 
from ArgParser import *
import sys, cv2, pickle, os, stat

FRAME_STEP = 5
HISTORY_WINDOW = 40 
FUTURE_WINDOW = 30

def export_frames(fnums, fname):
    f = open(fname, 'w')
    pickle.dump(fnums, f)


def drawBorder(I, color, thickness): 
    cv2.rectangle(I, (0,0), (I.shape[1], I.shape[0]), color, thickness)

if __name__ == '__main__':
    args = parse_args(sys.argv[1], sys.argv[2])
    reader = VideoReader(args['video'])

    outdir = sys.argv[1] + '/car_frames'
    try:
        os.mkdir(outdir)
        os.chmod(outdir, 
                stat.IRUSR | stat.IWUSR | stat.IXUSR | stat.IRGRP | stat.IWGRP | stat.IXGRP | stat.IROTH | stat.IWOTH | stat.IXOTH )
    except:
        pass

    outfname = outdir + "/" + args['basename'] + str(args['cam_num']) + '.pickle'


    framenums = set()
    last_record = 0 
    while True:
        for p in range(FRAME_STEP):
            (success, I) = reader.getNextFrame()
        if not success:
            break

        if reader.framenum in framenums:
            drawBorder(I, (0,255,0), 10)
        cv2.imshow('video', cv2.pyrDown(cv2.pyrDown(I)))
        key = chr(cv2.waitKey(5) & 255)
        if key == 'c':
            print reader.framenum
            for p in range(HISTORY_WINDOW):
                framenums.add(reader.framenum - p)
            for p in range(FUTURE_WINDOW):
                framenums.add(reader.framenum + p)

{'fraction_non_alphanumeric': 0.13330857779428146, 'fraction_numerical': 0.02227998514667657, 'mean_word_length': 2.3095823095823094, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3290378', 'n_tokens_mistral': 1028, 'n_tokens_neox': 967, 'n_words': 214}