• Stars
    star
    407
  • Rank 102,289 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 5 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

detect stages in video automatically

stage sep(aration) x

detect stages in video automatically


Type Status
package version PyPI version
python version PyPI - Python Version
auto test CI Status
code maintainability Maintainability
code coverage codecov
code style Code style: black
stat Downloads Downloads Downloads

2022/08/13:在 0.18.0 之后,ffmpeg 以 imageio_ffmpeg 方式内置(请自行评估其LICENSE影响)。此版本为解决opencv版本及M1芯片的限制,并不再需要额外安装ffmpeg。详见 #178

2022/03/30:官方不维护任何诸如微信群、QQ群的多人群组,所有信息请通过issue公开交流。不需要任何捐赠支持,如遇到涉及金钱相关的信息请不要相信。

2021/12/15:在 0.16.0 之后,stagesepx 将开始提供部分功能测试的支持,详见 #158

2020/05/21:目前,该项目已经达到一个较为稳定的状态,并顺利在多家头部公司、团队落地,作为正式工具存在。Bug跟踪与建议请优先通过 issue 联系我,感谢所有支持过这个项目的人。欢迎有心优化的同学、落地成功的团队共同建设:)


English README here

这段视频展示了一个应用的完整启动过程:

video_readme.gif

将视频传递给 stagesepx,它将自动分析拆解,得到视频中所有的阶段。包括变化的过程及其耗时,以及在稳定的阶段停留的时长:

taobao_startup.png

你可以据此得到每个阶段对应的精确耗时。

跨端运作

当然,它是天然跨端的,例如web端。甚至,任何端:

sugar.gif

sugar

高准确度

与视频一致的高准确度。以秒表为例:

accuracy.png

可以看到,与秒表的表现几乎没有差异。请注意,这里的准确度指的是 stagesepx 能够精确还原视频本身的数据与表现。而对于现象(例如某某时间点出现什么状态)而言,准确度很大程度上取决于视频本身,如fps/分辨率等。

彻底解耦 & 可编程

如果比起报告,更希望亲自处理原始数据,进而进行二次开发,你可以直接将 report 部分去除。如此做,你将得到一个 python 对象供你随意使用。它提供了大量的API,例如转换成字典:

{
	"data": [{
		"data": null,
		"frame_id": 1,
		"stage": "0",
		"timestamp": 0.0,
		"video_path": "../demo.mp4"
	}, {
		"data": null,
		"frame_id": 2,
		"stage": "0",
		"timestamp": 0.04,
		"video_path": "../demo.mp4"
	}, {
		"data": null,
		"frame_id": 3,
		"stage": "0",
		"timestamp": 0.08,
		"video_path": "../demo.mp4"
	}, {
	
  ...

从这个字典中我们可以知道,每一帧分别对应的:

  • 被分类到哪一个类别
  • 时间戳
  • 帧编号
  • ...

用户可以随意处理这些数据,无论是保存或是交给下一段代码。

完整自动化支持 & 规模化

  • 既然它是可编程的,那么它必然是朝着彻底替代人力的方向演进的。这也是它最强大的特性;
  • 它允许用户利用自己的训练集进行模型训练,利用神经网络进行规模化、全自动化的特定阶段耗时计算;
  • 此方案能够被广泛应用到各类业务迭代中,与持续集成配合,有效降低人力消耗;
  • 一些方向参考:
    • 为你的应用建立高频次的性能回归测试,形成benchmark
    • 对模型进行补足,为一系列同类应用(如小程序、小游戏,etc.)构建巡检能力
    • ...

具体可参见 将 stagesepx 应用到实际业务中


  • 标准模式下无需前置训练与学习
  • 更少的代码需要
  • 高度可配置化,适应不同场景
  • 支持与其他框架结合,融入你的业务
  • 所有你需要的,只是一个视频

开始

正式使用

在正式落地时,推荐使用 完整的python脚本 而不是命令行,以保证更高的可编程性。完整的落地例子另外单独开了一个 repo 存放,传送门。 请一定配合 这篇文章 使用,基本能解决90%的问题。

命令行

你也可以直接通过命令行使用,而无需编写脚本:

stagesepx analyse your_video.mp4 report.html

基于此,你可以非常方便地利用 shell 建立工作流。以 android 为例:

adb shell screenrecord --time-limit 10 /sdcard/demo.mp4
adb pull /sdcard/demo.mp4 .
stagesepx analyse demo.mp4 report.html

关于结果不准确的问题请参考 #46

配置化运行(0.15.0)

当然,通常因为场景差异,我们需要对参数进行修改使其达到更好的效果。这使得用户需要投入一些精力在脚本编写上。在 0.15.0 之后,配置化运行的加入使用户能够在不需要编写脚本的情况下直接使用所有能力,大大降低了接入门槛。

{
  "output": ".",
  "video": {
    "path": "./PATH_TO_YOUR/VIDEO.mp4",
    "fps": 30
  }
}

命令行运行:

stagesepx run YOUR_CONFIG.json

即可达到与脚本相同的效果。其他的配置项可以参考:work_with_stagesepx

安装

标准版(pypi)

pip install stagesepx

预览版(github):

pip install --upgrade git+https://github.com/williamfzc/stagesepx.git

常见问题

最终我还是决定通过 issue 面板维护所有的 Q&A ,毕竟问题的提出与回复是一个强交互过程。如果在查看下列链接之后你的问题依旧没有得到解答:

  • 新建issue
  • 或在相关的 issue 下进行追问与补充
  • 你的提问将不止帮助到你一个人 :)

问题列表:

不仅是问题,如果有任何建议与交流想法,同样可以通过 issue 面板找到我。我们每天都会查看 issue 面板,无需担心跟进不足。

相关文章

架构

structure

参与项目

规划

在 1.0版本 之前,我们接下来的工作主要分为下面几个部分:

标准化

随着越来越多的业务落地,我们开始思考它是否能够作为行业级别的方案。

  • 基于实验室数据的准确度对比(未公开)
  • 规范且适合落地的例子
  • 边界情况下的确认
  • 代码覆盖率 95%+
  • API参数相关文档

新需求的收集与开发

该部分由 issue 面板管理。

贡献代码

欢迎感兴趣的同学为这个项目添砖加瓦,三个必备步骤:

  • 请在开始编码前留个 issue 告知你想完成的功能,因为可能这个功能已经在开发中或者已有;
  • commit规范我们严格遵守 约定式提交
  • 该repo有较为完善的单测与CI以保障整个项目的质量,在过去的迭代中发挥了巨大的作用。所以请为你新增的代码同步新增单元测试(具体写法请参考 tests 中的已有用例)。

联系我们

Changelog / History

see CHANGELOG.md

Thanks

Thank you JetBrains for supporting the project with free product licenses.

License

MIT

More Repositories

1

chat-gpt-ppt

Use ChatGPT (or other backends) to generate PPT automatically, all in one single file.
Go
701
star
2

pyminitouch

python wrapper of minitouch, for better experience
Python
103
star
3

findit

find target icon on your picture, and get its position
Python
99
star
4

BaseDesktopApp

electron + vue + element = cool desktop app
JavaScript
83
star
5

fitch

[TOY PROJECT] Android UI automation based on opencv 🚀 fitch = fi(nd) & t(ou)ch
Python
63
star
6

wx_jump

[DEPRECATED] 一个规范且适合新手阅读的weixin跳一跳辅助
Python
53
star
7

work_with_stagesepx

about how to use stagesepx in production
Python
47
star
8

randunit

Bring unittest to your Android/JVM applications with tiny effort.
Kotlin
36
star
9

stagesep2

[TOO SLOW NOW] Analyse, and convert video into useful data.
Python
22
star
10

diffctx

A GitHub action for automatically evaluating the function level impacts of Pull Requests.
Python
21
star
11

usb2container

binding specific USB devices to container
Python
19
star
12

pyatool

python android toolkit 🔨
Python
19
star
13

sepmachine

stagesepx workflow in production
Python
19
star
14

fastcap

fast screen cap on android, with minicap.
Python
16
star
15

whenconnect

when your android connected, do sth :)
Python
14
star
16

srctx

A library for extracting and analyzing definition/reference graphs from your codebase. Powered by tree-sitter and LSIF/SCIP.
Go
13
star
17

socket2adb

60 lines to describe how to write an adb client
Python
11
star
18

linkediff

linked graph for diff
Python
10
star
19

minadb

min adb client implemented with subprocess, nothing special but useful and stable.
Python
10
star
20

stagesep

detect stages in video
Python
7
star
21

ConnectionTracer

when connected devices changed, do sth :)
Python
7
star
22

ToolCover

easily run your terminal app in html
Python
4
star
23

pyudevmonitor

simple wrapper of udevadm monitor
Python
3
star
24

lockadb

lockable android debug bridge, for managing devices precisely and safely
Python
2
star
25

devcube

last step to use docker in local development
Python
2
star
26

sidebike

一个轻量无中间件的、基于发布订阅模型的、开箱可用的 agent-server 库。 用于快速构建简单的任务分发流程。
Go
2
star
27

findtext

OCR, based on tesseract (tesserocr), with accuracy improvement
Python
2
star
28

findit-client

client for findit
Python
2
star
29

pycallback

[TOY PROJECT] simple callback wrapper for python
Python
1
star
30

sibyl

static code analyzer for multi languages based on antlr4
Java
1
star
31

stagesep2-sample

sample project for stagesep2
Python
1
star
32

build_sdk_with_go

sample project to describe how to build an android SDK with golang.
1
star
33

simhand2

UI operator like a real hand 👆
Java
1
star
34

grabel

Python
1
star