{"id":16391756,"url":"https://github.com/williamfzc/stagesep2","last_synced_at":"2025-08-07T00:38:43.033Z","repository":{"id":57471033,"uuid":"157824967","full_name":"williamfzc/stagesep2","owner":"williamfzc","description":"[TOO SLOW NOW] Analyse, and convert video into useful data.","archived":false,"fork":false,"pushed_at":"2019-08-17T10:07:32.000Z","size":135,"stargazers_count":23,"open_issues_count":3,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-07-28T23:03:45.800Z","etag":null,"topics":["android","ocr","opencv","python","video"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/williamfzc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-16T06:49:13.000Z","updated_at":"2025-01-16T10:27:51.000Z","dependencies_parsed_at":"2022-09-26T17:40:35.896Z","dependency_job_id":null,"html_url":"https://github.com/williamfzc/stagesep2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/williamfzc/stagesep2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamfzc%2Fstagesep2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamfzc%2Fstagesep2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamfzc%2Fstagesep2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamfzc%2Fstagesep2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/williamfzc","download_url":"https://codeload.github.com/williamfzc/stagesep2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamfzc%2Fstagesep2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269180931,"owners_count":24373838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-06T02:00:09.910Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","ocr","opencv","python","video"],"created_at":"2024-10-11T04:47:15.988Z","updated_at":"2025-08-07T00:38:43.009Z","avatar_url":"https://github.com/williamfzc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e 该项目处于低活跃状态，建议使用 https://github.com/williamfzc/stagesepx\n\n# stagesep2\n\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/stagesep2.svg?style=flat-square)\n[![PyPI version](https://badge.fury.io/py/stagesep2.svg)](https://badge.fury.io/py/stagesep2)\n[![Build Status](https://travis-ci.org/williamfzc/stagesep2.svg?branch=master)](https://travis-ci.org/williamfzc/stagesep2)\n[![Maintainability](https://api.codeclimate.com/v1/badges/ad4c729fcf98d98497b8/maintainability)](https://codeclimate.com/github/williamfzc/stagesep2/maintainability)\n\n---\n\nAnalyse, and convert video into useful data.\n\n# 原理\n\nstagesep2 的两个核心功能：\n\n- ocr（tesseract）\n- 图像识别（opencv）\n\n视频是由一系列连续的图片（帧）组成的，通过逐帧分析，我们能够从视频中提取出流程相关信息。理论上，每一帧都存在能够区分它与其他帧的标识，可能是文字或图像。\n\n例如，我们需要测试 从桌面启动chrome，打开amazon 的速度：\n\n- 在操作前，我们在主页。主页上会有特定的文字与图像（例如chrome icon）\n- 在操作时，页面会有特定的变化（例如chrome icon变暗，或出现点击位置反馈）\n- 在操作后（chrome启动后），页面发生切换，页面上的文字与图像都会发生改变（例如amazon logo出现）\n\n那么，我们可以通过两个方面来进行检测。首先是通过标志性图片：\n\n![](pics/sample_report.png)\n\n可以看到，在 0.2s 时chrome图标被点击，在 0.96s 时amazon图标正式出现。再看看文字的：\n\n```json\n{\n\t\"result_id\": \"c2e5116c-462b-11e9-9ed2-005056c00008\",\n\t\"video_name\": \"./videos/demo1.mp4\",\n\t\"frame_id\": 24,\n\t\"current_time\": 0.96,\n\t\"ocr\": [\"PO\", \"/\", \"1dX00d\", \"¥\", \":\", \"00Xv00Yv00\", \"—\", \"ESRRGRERSize0.0215\", \":\", \"27dSlsB\", \"(\", \"ayhttps\", \"/\", \"/\", \"www\", \".\", \"amazon\", \".\", \"comQO\", \"°\", \"oa\", \"\\\"\", \"四\", \"Ney\", \",\", \"DepartmentsListsDealsVideoMusic\", \"©\", \"DelivertoChinaWeshipinternationallyWe\", \"'\", \"reshowingyouitemsthatshiptoChina\", \".\", \"Toseeiemsthatshiptoadifferentcountrychangeyourgetiveryaddres5AdditionallanguagesettingsareavailableSomecontentmaybeauto\", \"-\", \"translatedCHANGETHEADDRESSrs\", \"并\", \"~\", \"Shopwith100%\", \"ConfidenceonAmazonLJ\", \"—\", \")\", \"SigninforthebestexperienceCoO00\", \"@\"],\n\t\"match_template\": {\n\t\t\"amazon\": {\n\t\t\t\"min\": -0.4684264361858368,\n\t\t\t\"max\": 0.6224471926689148\n\t\t},\n\t\t\"chrome\": {\n\t\t\t\"min\": -0.4022962152957916,\n\t\t\t\"max\": 0.7294253706932068\n\t\t},\n\t\t\"chrome_clicked\": {\n\t\t\t\"min\": -0.6132965087890625,\n\t\t\t\"max\": 0.7038567066192627\n\t\t}\n\t},\n\t\"trend\": {\n\t\t\"previous\": 0.8785946933890821,\n\t\t\"first\": 0.8719320065296263,\n\t\t\"last\": 0.5842399940047383\n\t}\n}\n```\n\n节选 0.96s 的检测结果，可以发现在该时刻amazon网页上的相关字样开始出现，与图片检测的结果是一致的。\n\n通过对这些阶段进行分析，得到每个阶段及帧对应的时间戳，我们就能够准确地知晓视频每个阶段发生的事情。你的视频FPS越高，数据会越精确。\n\n# 目的\n\n\u003e 值得注意的是，在性能测试范畴内，fps的稳定性是非常重要的。而目前软件录制手段实际上并不稳定，容易造成结果不准确的问题。如果用于生产环境，建议使用硬件方式（例如外置摄像头）。\n\n全平台的 性能测试/有效性验证 方案\n\n- 渲染内容是否符合期望\n- 渲染性能\n\n## 为什么介入图像识别\n\n### UI\n\n现阶段的UI测试大多属于纯代码层面的行为，而对于控件是否真的渲染成为我们希望的样子我们并不知晓。\n\n### 性能\n\n在常规速度类性能测试中通常通过提前埋点进行测试，一般会有两个问题：\n\n- 具有侵入性（需要改动源码）\n- 对于界面相关的场景不适用（并不知道界面是否已经被真正渲染出来）\n\n## 图像识别在测试中的应用\n\n一般来说，通过图像识别来进行测试分为三个步骤：\n\n- 图像/视频 采集\n    - 这个部分通常由高速摄像机或稳定帧率的外置相机进行拍摄，得到固定帧率的视频\n    - 软件录制是不靠谱的，很容易出现帧率不稳定的情况。而如果时间与帧数不能精确对应的话数据会失真\n\n- 视频处理\n    - 提取视频中的信息，输出成为我们需要的形式\n    - 也是整个流程最关键的部分\n\n- 数据分析\n    - 将视频处理的结果进行分析，得到结论或生成报告\n\n该项目将承载视频处理的部分，将录制好的视频解析成开发者需要的格式。\n\n# 使用\n\n目前支持两种使用方式：\n\n- docker（推荐）\n- python包\n\n从 [官方示例](https://github.com/williamfzc/stagesep2-sample) 开始吧。\n\n# 相关内容\n\n## 依赖\n\n- [opencv](https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_tutorials.html): 图像与视频处理\n- [tesseract-ocr](https://github.com/tesseract-ocr/tesseract/wiki/Downloads) \u0026 [tesserocr](https://github.com/sirfz/tesserocr): 文本检测\n- [skimage](https://github.com/scikit-image/scikit-image): 主要用于图片相似度比较\n- [jieba](https://github.com/fxsjy/jieba)：ocr结果的进一步处理\n- [pyecharts](https://github.com/pyecharts/pyecharts)：结果图表渲染\n\n## 旧版本\n\n- [stagesep](https://github.com/williamfzc/stagesep)\n- [利用图像识别与 OCR 进行速度类测试](https://testerhome.com/topics/16063)\n\n# Bug与建议\n\n欢迎通过 issue 告知，或直接发起 PR 加入 :)\n\n# 协议\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamfzc%2Fstagesep2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilliamfzc%2Fstagesep2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamfzc%2Fstagesep2/lists"}