Skip to content

Commit 3a7fb41

Browse files
committedApr 24, 2020
initial
1 parent 25d3584 commit 3a7fb41

File tree

18 files changed

+1297
-0
lines changed

18 files changed

+1297
-0
lines changed
 

‎.gitignore

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
cover/
54+
55+
# Translations
56+
*.mo
57+
*.pot
58+
59+
# Django stuff:
60+
*.log
61+
local_settings.py
62+
db.sqlite3
63+
db.sqlite3-journal
64+
65+
# Flask stuff:
66+
instance/
67+
.webassets-cache
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
.pybuilder/
77+
target/
78+
79+
# Jupyter Notebook
80+
.ipynb_checkpoints
81+
82+
# IPython
83+
profile_default/
84+
ipython_config.py
85+
86+
# pyenv
87+
# For a library or package, you might want to ignore these files since the code is
88+
# intended to run in multiple environments; otherwise, check them in:
89+
# .python-version
90+
91+
# pipenv
92+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
94+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
95+
# install all needed dependencies.
96+
#Pipfile.lock
97+
98+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
99+
__pypackages__/
100+
101+
# Celery stuff
102+
celerybeat-schedule
103+
celerybeat.pid
104+
105+
# SageMath parsed files
106+
*.sage.py
107+
108+
# Environments
109+
.env
110+
.venv
111+
env/
112+
venv/
113+
ENV/
114+
env.bak/
115+
venv.bak/
116+
117+
# Spyder project settings
118+
.spyderproject
119+
.spyproject
120+
121+
# Rope project settings
122+
.ropeproject
123+
124+
# mkdocs documentation
125+
/site
126+
127+
# mypy
128+
.mypy_cache/
129+
.dmypy.json
130+
dmypy.json
131+
132+
# Pyre type checker
133+
.pyre/
134+
135+
# pytype static type analyzer
136+
.pytype/
137+
138+
# Cython debug symbols
139+
cython_debug/
140+
141+
# static files generated from Django application using `collectstatic`
142+
media
143+
static

‎README.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Chinese Overlay
2+
Detects Chinese text and displays an overlay with the corresponding pinyin, phrase translations and optionally a Google translation. Works on videos and anything else that can be visually captured from the screen.
3+
4+
![](screenshots/douyu.jpg)
5+
6+
## Usage
7+
Prebuilt packages are made available for Windows that can be downloaded from the [Releases](/releases) page. Windows 10 1709 and a DirectX 12 compatible GPU will be required to use the DirectML provider (basically a neural network runtime that leverages DirectX12 to run the OCR on all modern GPUs). Alternatively, the much slower CPU backend can be used or any of the other onnxruntime execution providers (eg. CUDA).
8+
To launch the overlay open any of the .bat files (eg. `overlay-pinyin.bat` or `overlay-google-trans.bat`). By default the overlay can toggled using the `F8` key. The translation overlay will be shown within the displayed window, which can also be resized to fit
9+
whatever region you want to translated. By default only the pinyin is shown which is obtained from a dictionary.
10+
The overlay can also be started by executing the program from the command line with the `ui` subcommand ´(`cli.exe ui`) which opens up more options that can be found by typing `cli.exe --help` and `cli.exe ui --help`.
11+
12+
## Running in Python instead of using prepackaged version
13+
The [requirements file](/requirements.txt) contains all the necessary requirements and some optional ones. However to use the DirectML interface a modified version is required with [this](https://github.com/microsoft/onnxruntime/pull/3359) PR and [this](https://github.com/microsoft/onnxruntime/issues/3360) fix to make it work with the default Windows DirectML library). The program should work on non-Windows systems but it has not been tested much.
14+
15+
## Running a translation server
16+
The project also contains an http server that can run OCR on received images and return the results. It can be started by specifying the `server` argument. This makes it possible to easily make frontends in other languages
17+
or to use the OCR for any other purpose.

0 commit comments

Comments
 (0)