Ejemplo n.º 1
0
def main():
    gg = GG()
    all_thunks = []
    next_thunk = GGThunk(exe=test_prog_bin, outname='thunk.out',
             exe_args=[], args_infiles=False)
    next_thunk.add_infile([])
    all_thunks.append(next_thunk)

    gg.create_thunks(all_thunks)
Ejemplo n.º 2
0
def main():
    gg = GG()
    all_thunks = []
    for i in range(num_test_lines):
        next_thunk = GGThunk(exe=test_prog_bin, outname='test_%d.out' % i,
                exe_args=[test_lines, '%d' % i], args_infiles=False)
        next_thunk.add_infile(test_lines)
        all_thunks.append(next_thunk)

    gg.create_thunks(all_thunks)
Ejemplo n.º 3
0
def main(args):
    vidStart = args.vidToProcess
    execEnv = args.execEnv
    nJobs = args.numJobs

    all_chunks = glob.glob(vidStart + '_chunk*')

    # Get all durations
    all_dur = {}
    for ac in all_chunks:
        ts = get_dur_fps(ac)
        all_dur[ac] = ts

    gg = GG()
    all_thunks = []

    start = now()
    for vidind, myvid in enumerate(all_chunks):
        ts = int(all_dur[myvid])
        num_out = int(ts) * 2
        all_outname = []
        for j in range(num_out):
            all_outname.append('frameout%03d_%03d.jpg' % (j + 1, vidind))

        next_cmd = CMD.format(video=myvid,
                              numout=num_out,
                              ofile='%03d' % vidind)
        next_cmd_split = next_cmd.split()
        gen_jpg_thunk = GGThunk(exe=next_cmd_split[0],
                                outname=all_outname,
                                exe_args=next_cmd_split[1:],
                                args_infiles=False)
        gen_jpg_thunk.add_infile(myvid)

        for j in range(num_out):
            pic_out = 'frameout%03d_%03d_lab.out' % (j + 1, vidind)
            last_cmd = CMD_IMREC.format(myimage=all_outname[j],
                                        myoutput=pic_out)
            last_cmd_split = last_cmd.split()
            last_thunk = GGThunk(exe=last_cmd_split[0],
                                 outname=pic_out,
                                 exe_args=last_cmd_split[1:],
                                 args_infiles=False)
            last_thunk.add_infile([
                'inception_v3_2016_08_28_frozen.pb',
                'imagenet_slim_labels.txt', (gen_jpg_thunk, all_outname[j])
            ])

            all_thunks.append(last_thunk)

    end = now()
    delta = end - start
    print("Total time to declare thunks: %.3f seconds" % delta)
    gg.create_and_force(all_thunks, showcomm=False, numjobs=nJobs, env=execEnv)
Ejemplo n.º 4
0
def main(num_image):
    gg = GG()
    all_thunks = []

    for i in range(0, num_image):
        name = bname(i)

        conv = make_command(CONV.format(input_file="%s.txt" % name, output_file="%s.out" % name))
        conv_split = conv.split()
        next_thunk = GGThunk(exe=conv_split[0], outname="%s.out" % name,
                        exe_args=conv_split[1:], args_infiles=False)
        next_thunk.add_infile(name + '.txt')
        all_thunks.append(next_thunk)

    gg.create_thunks(all_thunks)
Ejemplo n.º 5
0
def main():
    vid_dur = get_duration(VID_TO_PROC)

    gg = GG()
    all_thunks = []

    for ind, i in enumerate(np.arange(0, vid_dur - 0.5, 0.5)):
        next_min = '%02d' % int(i / 60)
        next_sec = '%02d' % (i % 60)
        next_outname = 'frameout%02d.jpg' % ind
        next_cmd = CMD.format(video=VID_TO_PROC,
                              min=next_min,
                              sec=next_sec,
                              ofile=next_outname)
        next_cmd_split = next_cmd.split()
        gen_jpg_thunk = GGThunk(exe=next_cmd_split[0],
                                outname=next_outname,
                                exe_args=next_cmd_split[1:],
                                args_infiles=False)
        gen_jpg_thunk.add_infile(VID_TO_PROC)

        pic_out = 'frameout%02d_lab.out' % ind
        last_cmd = CMD_IMREC.format(myimage=next_outname, myoutput=pic_out)
        last_cmd_split = last_cmd.split()
        last_thunk = GGThunk(exe=last_cmd_split[0],
                             outname=pic_out,
                             exe_args=last_cmd_split[1:],
                             args_infiles=False)
        last_thunk.add_infile([
            'inception_v3_2016_08_28_frozen.pb', 'imagenet_slim_labels.txt',
            gen_jpg_thunk
        ])

        all_thunks.append(last_thunk)

    gg.create_thunks(all_thunks)
Ejemplo n.º 6
0
                        exe_args=xc_dump12_split[1:],
                        args_infiles=False)
                xc_dump12_thunk.add_infile([xc_dump1_list[ind], xc_enc_rb_thunk])
                xc_dump1_list.append(xc_dump12_thunk)
                thunk_dict["%s-1.state" % name] = xc_dump12_thunk

        return list(thunk_dict.values())

if __name__ == '__main__':
    if len(sys.argv) != 5:
        print("Usage: gen_makefile.py <start> <end> <batch-size> <cq-level>")
        sys.exit(1)

    start = int(sys.argv[1])
    end = int(sys.argv[2])
    batch_size = int(sys.argv[3])
    quality = int(sys.argv[4])

    gg = GG()

    batch_start = start

    out_thunks = []
    for batch_index in range(math.ceil((end - start + 1) / batch_size)):
        batch_end = min(batch_start + batch_size - 1, end)
        out_thunks.extend(generate_batch(batch_start, batch_end, quality))
        batch_start = batch_end + 1

    gg.create_thunks(out_thunks)

Ejemplo n.º 7
0
            thunk_dict["%s-1.state" % name] = xc_dump12_thunk

    return list(thunk_dict.values())


if __name__ == '__main__':
    if len(sys.argv) != 6:
        print(
            "Usage: gen_makefile.py <start> <end> <batch-size> <cq-level> <nworkers>"
        )
        sys.exit(1)

    start = int(sys.argv[1])
    end = int(sys.argv[2])
    batch_size = int(sys.argv[3])
    quality = int(sys.argv[4])
    nworkers = int(sys.argv[5])

    gg = GG()

    batch_start = start

    out_thunks = []
    for batch_index in range(math.ceil((end - start + 1) / batch_size)):
        batch_end = min(batch_start + batch_size - 1, end)
        out_thunks.extend(generate_batch(batch_start, batch_end, quality))
        batch_start = batch_end + 1

    gg.create_and_force(out_thunks, showcomm=False, numjobs=nworkers)
    #gg.create_thunks(out_thunks)