コード例 #1
0
ファイル: test_full_seq.py プロジェクト: sjyk/deeplens-cv
def runFullPutMany(src_list, cleanUp=False):
    if cleanUp:
        if os.path.exists('./videos_full'):
            shutil.rmtree('./videos_full')

    manager = FullStorageManager(None, CropSplitter(), 'videos_full')
    now = timer()
    targets = [os.path.basename(src) for src in src_list]
    logs = manager.put_many(src_list,
                            targets,
                            log=True,
                            args={
                                'encoding': XVID,
                                'size': -1,
                                'sample': 1.0,
                                'offset': 0,
                                'limit': -1,
                                'batch_size': 30,
                                'num_processes': os.cpu_count()
                            })
    put_time = timer() - now
    logrecord('full', ({
        'file': src_list
    }), 'put', str({'elapsed': put_time}), 's')
    for i, log in enumerate(logs):
        logrecord('fullMany', i, 'put', str({'elapsed': log}), 's')
コード例 #2
0
def runFullPutMany(src_list, batch_size=30, cleanUp=False):
    if cleanUp:
        if os.path.exists('./videos_full'):
            shutil.rmtree('./videos_full')

    manager = FullStorageManager(None, CropSplitter(), 'videos_full')
    now = timer()
    targets = [os.path.basename(src) for src in src_list]
    logs = manager.put_many(src_list,
                            targets,
                            log=True,
                            args={
                                'encoding': XVID,
                                'size': -1,
                                'sample': 1.0,
                                'offset': 0,
                                'limit': -1,
                                'batch_size': batch_size,
                                'num_processes': os.cpu_count()
                            })
    put_time = timer() - now
    logrecord('full', ({
        'file': src_list
    }), 'put', str({'elapsed': put_time}), 's')
    for i, log in enumerate(logs):
        logrecord('fullMany', i, 'put', str({'elapsed': log}), 's')

    # Don't call get() for now
    for src in src_list:
        clips = manager.get(os.path.basename(src), Condition())
        pipelines = []
        for c in clips:
            pipelines.append(c[KeyPoints()])
        result = counts(pipelines, ['one'], stats=True)
        logrecord('full', ({'file': src}), 'get', str(result), 's')