Beispiel #1
0
def test_wider_than_packet_stencil(cl):
    input = NamedVideoStream(cl, 'test1')
    frame = cl.io.Input([input])
    sample_frame = cl.streams.Range(frame, ranges=[{'start': 0, 'end': 3}])
    flow = cl.ops.OpticalFlow(frame=sample_frame, stencil=[0, 1])
    output = NamedStream(cl, 'test_stencil')
    output_op = cl.io.Output(flow, [output])

    cl.run(output_op,
           PerfParams.manual(1, 1, pipeline_instances_per_node=1),
           cache_mode=CacheMode.Overwrite,
           show_progress=False)

    assert output.len() == 3
def test_shot_detection(sc):
    input = NamedVideoStream(sc, 'test1')
    frame = sc.io.Input([input])
    range_frame = sc.streams.Range(frame, [{'start': 0, 'end': 1000}])
    hist = sc.ops.Histogram(frame=range_frame)
    boundaries = sc.ops.ShotBoundaries(histograms=hist)
    output = NamedStream(sc, 'output')
    output_op = sc.io.Output(boundaries, [output])
    sc.run(output_op,
           PerfParams.manual(work_packet_size=1000,
                             io_packet_size=1000,
                             pipeline_instances_per_node=1),
           cache_mode=CacheMode.Overwrite,
           show_progress=False)
    assert len(next(output.load(rows=[0]))) == 7
Beispiel #3
0
def test_perf_params(cl):
    frame = cl.io.Input([NamedVideoStream(cl, 'test1')])
    hist = cl.ops.Histogram(frame=frame)
    ghist = cl.streams.Gather(hist, [[0]])
    output_op = cl.io.Output(ghist, [NamedStream(cl, '_ignore')])

    cl.run(output_op,
           PerfParams.manual(10, 10),
           show_progress=False,
           cache_mode=CacheMode.Overwrite)

    cl.run(output_op,
           PerfParams.estimate(),
           show_progress=False,
           cache_mode=CacheMode.Overwrite)
def run(sc, op, name, device):
    vid = NamedVideoStream(sc, 'test3')
    inp = sc.io.Input([vid])
    f = sc.streams.Gather(inp, [list(range(10000))])
    res = sc.ops.Resize(frame=inp,
                        width=[224],
                        height=[224],
                        device=device,
                        batch=100)
    tf = op(frame=res, batch=100, device=device)
    out = NamedStream(sc, 'qq')
    outp = sc.io.Output(tf, [out])

    s = now()
    sc.run(outp,
           PerfParams.manual(500, 10000, pipeline_instances_per_node=1),
           cache_mode=CacheMode.Overwrite,
           gpu_pool='8G')
    sc.table('qq').profiler().write_trace('{}.tar.gz'.format(name))
    print('{:.1f}s'.format(now() - s))