コード例 #1
0
def test_ssim_classifier():
    cl = SSIMClassifier()
    cl.load(CUTTER_RESULT_DIR)
    classify_result = cl.classify(VIDEO_PATH)

    # --- draw ---
    _draw_report(classify_result)
コード例 #2
0
def test_load_from_range_list():
    cl = SSIMClassifier()
    cl.load(cutter_res.range_list)
    classify_result = cl.classify(VIDEO_PATH)

    # --- draw ---
    _draw_report(classify_result)
コード例 #3
0
def test_ssim_classifier():
    cl = SSIMClassifier()
    cl.load(CUTTER_RESULT_DIR)
    cl.classify(VIDEO_PATH, boost_mode=False)
コード例 #4
0
from stagesepx.classifier import SSIMClassifier
from stagesepx.reporter import Reporter

# 在运行这个例子前需要有前置数据
# 你可以先从 cut.py 开始

# 这里用的分类器是默认的SSIM分类器
# 更多的分类器会在稳定之后逐步加入
cl = SSIMClassifier()
# cut.py会把数据生成在这个路径下
# 如果你改动了,这里也要做相应修改
data_home = './cut_result'
cl.load(data_home)
# 开始分析即可
res = cl.classify(
    '../demo.mp4',
    # 步长,可以自行设置用于平衡效率与颗粒度
    # 默认为1,即每帧都检测
    step=1)

# 分类出来的结果是一个 list,里面包含 ClassifierResult 对象
# 你可以用它进行二次开发
for each in res:
    # 它的帧编号
    print(each.frame_id)
    # 它的时间戳
    print(each.timestamp)
    # 它被划分为什么类型
    print(each.stage)
    break
コード例 #5
0
from stagesepx.cutter import VideoCutter
from stagesepx.classifier import SSIMClassifier
from stagesepx.reporter import Reporter

# cut
video_path = '../test.mp4'
cutter = VideoCutter()
res = cutter.cut(video_path)
stable = res.get_stable_range()

# classify
cl = SSIMClassifier()
cl.load(stable)

res = cl.classify(
    video_path,
    stable,
)

# draw
Reporter.draw(res)
コード例 #6
0
from stagesepx.cutter import VideoCutter
from stagesepx.classifier import SSIMClassifier
from stagesepx.reporter import Reporter

# # cut
video_path = 'test.mp4'
cutter = VideoCutter(step=2)
res = cutter.cut(video_path)
stable = res.get_stable_range()
data_home = res.pick_and_save(stable, 3)

# classify
cl = SSIMClassifier()
cl.load(data_home)
res = cl.classify(video_path)

# draw
Reporter.draw(res, report_path=f'{data_home}/report.html')