├── .gitignore ├── LICENSE ├── README.md ├── README_en.md ├── RSL_class_list.txt ├── S3D.onnx ├── app.py ├── configs └── config.json ├── model.py ├── opencv_inference.py ├── requirements.txt └── utils.py /.gitignore: -------------------------------------------------------------------------------- 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 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm.fming.dev/#use-with-ide 110 | .pdm.toml 111 | 112 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 113 | __pypackages__/ 114 | 115 | # Celery stuff 116 | celerybeat-schedule 117 | celerybeat.pid 118 | 119 | # SageMath parsed files 120 | *.sage.py 121 | 122 | # Environments 123 | .env 124 | .venv 125 | env/ 126 | venv/ 127 | ENV/ 128 | env.bak/ 129 | venv.bak/ 130 | 131 | # Spyder project settings 132 | .spyderproject 133 | .spyproject 134 | 135 | # Rope project settings 136 | .ropeproject 137 | 138 | # mkdocs documentation 139 | /site 140 | 141 | # mypy 142 | .mypy_cache/ 143 | .dmypy.json 144 | dmypy.json 145 | 146 | # Pyre type checker 147 | .pyre/ 148 | 149 | # pytype static type analyzer 150 | .pytype/ 151 | 152 | # Cython debug symbols 153 | cython_debug/ 154 | 155 | # PyCharm 156 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 157 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 158 | # and can be added to the global gitignore or merged into this file. For a more nuclear 159 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 160 | #.idea/ 161 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Attribution-ShareAlike 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More_considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution-ShareAlike 4.0 International Public 58 | License 59 | 60 | By exercising the Licensed Rights (defined below), You accept and agree 61 | to be bound by the terms and conditions of this Creative Commons 62 | Attribution-ShareAlike 4.0 International Public License ("Public 63 | License"). To the extent this Public License may be interpreted as a 64 | contract, You are granted the Licensed Rights in consideration of Your 65 | acceptance of these terms and conditions, and the Licensor grants You 66 | such rights in consideration of benefits the Licensor receives from 67 | making the Licensed Material available under these terms and 68 | conditions. 69 | 70 | 71 | Section 1 -- Definitions. 72 | 73 | a. Adapted Material means material subject to Copyright and Similar 74 | Rights that is derived from or based upon the Licensed Material 75 | and in which the Licensed Material is translated, altered, 76 | arranged, transformed, or otherwise modified in a manner requiring 77 | permission under the Copyright and Similar Rights held by the 78 | Licensor. For purposes of this Public License, where the Licensed 79 | Material is a musical work, performance, or sound recording, 80 | Adapted Material is always produced where the Licensed Material is 81 | synched in timed relation with a moving image. 82 | 83 | b. Adapter's License means the license You apply to Your Copyright 84 | and Similar Rights in Your contributions to Adapted Material in 85 | accordance with the terms and conditions of this Public License. 86 | 87 | c. BY-SA Compatible License means a license listed at 88 | creativecommons.org/compatiblelicenses, approved by Creative 89 | Commons as essentially the equivalent of this Public License. 90 | 91 | d. Copyright and Similar Rights means copyright and/or similar rights 92 | closely related to copyright including, without limitation, 93 | performance, broadcast, sound recording, and Sui Generis Database 94 | Rights, without regard to how the rights are labeled or 95 | categorized. For purposes of this Public License, the rights 96 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 97 | Rights. 98 | 99 | e. Effective Technological Measures means those measures that, in the 100 | absence of proper authority, may not be circumvented under laws 101 | fulfilling obligations under Article 11 of the WIPO Copyright 102 | Treaty adopted on December 20, 1996, and/or similar international 103 | agreements. 104 | 105 | f. Exceptions and Limitations means fair use, fair dealing, and/or 106 | any other exception or limitation to Copyright and Similar Rights 107 | that applies to Your use of the Licensed Material. 108 | 109 | g. License Elements means the license attributes listed in the name 110 | of a Creative Commons Public License. The License Elements of this 111 | Public License are Attribution and ShareAlike. 112 | 113 | h. Licensed Material means the artistic or literary work, database, 114 | or other material to which the Licensor applied this Public 115 | License. 116 | 117 | i. Licensed Rights means the rights granted to You subject to the 118 | terms and conditions of this Public License, which are limited to 119 | all Copyright and Similar Rights that apply to Your use of the 120 | Licensed Material and that the Licensor has authority to license. 121 | 122 | j. Licensor means the individual(s) or entity(ies) granting rights 123 | under this Public License. 124 | 125 | k. Share means to provide material to the public by any means or 126 | process that requires permission under the Licensed Rights, such 127 | as reproduction, public display, public performance, distribution, 128 | dissemination, communication, or importation, and to make material 129 | available to the public including in ways that members of the 130 | public may access the material from a place and at a time 131 | individually chosen by them. 132 | 133 | l. Sui Generis Database Rights means rights other than copyright 134 | resulting from Directive 96/9/EC of the European Parliament and of 135 | the Council of 11 March 1996 on the legal protection of databases, 136 | as amended and/or succeeded, as well as other essentially 137 | equivalent rights anywhere in the world. 138 | 139 | m. You means the individual or entity exercising the Licensed Rights 140 | under this Public License. Your has a corresponding meaning. 141 | 142 | 143 | Section 2 -- Scope. 144 | 145 | a. License grant. 146 | 147 | 1. Subject to the terms and conditions of this Public License, 148 | the Licensor hereby grants You a worldwide, royalty-free, 149 | non-sublicensable, non-exclusive, irrevocable license to 150 | exercise the Licensed Rights in the Licensed Material to: 151 | 152 | a. reproduce and Share the Licensed Material, in whole or 153 | in part; and 154 | 155 | b. produce, reproduce, and Share Adapted Material. 156 | 157 | 2. Exceptions and Limitations. For the avoidance of doubt, where 158 | Exceptions and Limitations apply to Your use, this Public 159 | License does not apply, and You do not need to comply with 160 | its terms and conditions. 161 | 162 | 3. Term. The term of this Public License is specified in Section 163 | 6(a). 164 | 165 | 4. Media and formats; technical modifications allowed. The 166 | Licensor authorizes You to exercise the Licensed Rights in 167 | all media and formats whether now known or hereafter created, 168 | and to make technical modifications necessary to do so. The 169 | Licensor waives and/or agrees not to assert any right or 170 | authority to forbid You from making technical modifications 171 | necessary to exercise the Licensed Rights, including 172 | technical modifications necessary to circumvent Effective 173 | Technological Measures. For purposes of this Public License, 174 | simply making modifications authorized by this Section 2(a) 175 | (4) never produces Adapted Material. 176 | 177 | 5. Downstream recipients. 178 | 179 | a. Offer from the Licensor -- Licensed Material. Every 180 | recipient of the Licensed Material automatically 181 | receives an offer from the Licensor to exercise the 182 | Licensed Rights under the terms and conditions of this 183 | Public License. 184 | 185 | b. Additional offer from the Licensor -- Adapted Material. 186 | Every recipient of Adapted Material from You 187 | automatically receives an offer from the Licensor to 188 | exercise the Licensed Rights in the Adapted Material 189 | under the conditions of the Adapter's License You apply. 190 | 191 | c. No downstream restrictions. You may not offer or impose 192 | any additional or different terms or conditions on, or 193 | apply any Effective Technological Measures to, the 194 | Licensed Material if doing so restricts exercise of the 195 | Licensed Rights by any recipient of the Licensed 196 | Material. 197 | 198 | 6. No endorsement. Nothing in this Public License constitutes or 199 | may be construed as permission to assert or imply that You 200 | are, or that Your use of the Licensed Material is, connected 201 | with, or sponsored, endorsed, or granted official status by, 202 | the Licensor or others designated to receive attribution as 203 | provided in Section 3(a)(1)(A)(i). 204 | 205 | b. Other rights. 206 | 207 | 1. Moral rights, such as the right of integrity, are not 208 | licensed under this Public License, nor are publicity, 209 | privacy, and/or other similar personality rights; however, to 210 | the extent possible, the Licensor waives and/or agrees not to 211 | assert any such rights held by the Licensor to the limited 212 | extent necessary to allow You to exercise the Licensed 213 | Rights, but not otherwise. 214 | 215 | 2. Patent and trademark rights are not licensed under this 216 | Public License. 217 | 218 | 3. To the extent possible, the Licensor waives any right to 219 | collect royalties from You for the exercise of the Licensed 220 | Rights, whether directly or through a collecting society 221 | under any voluntary or waivable statutory or compulsory 222 | licensing scheme. In all other cases the Licensor expressly 223 | reserves any right to collect such royalties. 224 | 225 | 226 | Section 3 -- License Conditions. 227 | 228 | Your exercise of the Licensed Rights is expressly made subject to the 229 | following conditions. 230 | 231 | a. Attribution. 232 | 233 | 1. If You Share the Licensed Material (including in modified 234 | form), You must: 235 | 236 | a. retain the following if it is supplied by the Licensor 237 | with the Licensed Material: 238 | 239 | i. identification of the creator(s) of the Licensed 240 | Material and any others designated to receive 241 | attribution, in any reasonable manner requested by 242 | the Licensor (including by pseudonym if 243 | designated); 244 | 245 | ii. a copyright notice; 246 | 247 | iii. a notice that refers to this Public License; 248 | 249 | iv. a notice that refers to the disclaimer of 250 | warranties; 251 | 252 | v. a URI or hyperlink to the Licensed Material to the 253 | extent reasonably practicable; 254 | 255 | b. indicate if You modified the Licensed Material and 256 | retain an indication of any previous modifications; and 257 | 258 | c. indicate the Licensed Material is licensed under this 259 | Public License, and include the text of, or the URI or 260 | hyperlink to, this Public License. 261 | 262 | 2. You may satisfy the conditions in Section 3(a)(1) in any 263 | reasonable manner based on the medium, means, and context in 264 | which You Share the Licensed Material. For example, it may be 265 | reasonable to satisfy the conditions by providing a URI or 266 | hyperlink to a resource that includes the required 267 | information. 268 | 269 | 3. If requested by the Licensor, You must remove any of the 270 | information required by Section 3(a)(1)(A) to the extent 271 | reasonably practicable. 272 | 273 | b. ShareAlike. 274 | 275 | In addition to the conditions in Section 3(a), if You Share 276 | Adapted Material You produce, the following conditions also apply. 277 | 278 | 1. The Adapter's License You apply must be a Creative Commons 279 | license with the same License Elements, this version or 280 | later, or a BY-SA Compatible License. 281 | 282 | 2. You must include the text of, or the URI or hyperlink to, the 283 | Adapter's License You apply. You may satisfy this condition 284 | in any reasonable manner based on the medium, means, and 285 | context in which You Share Adapted Material. 286 | 287 | 3. You may not offer or impose any additional or different terms 288 | or conditions on, or apply any Effective Technological 289 | Measures to, Adapted Material that restrict exercise of the 290 | rights granted under the Adapter's License You apply. 291 | 292 | 293 | Section 4 -- Sui Generis Database Rights. 294 | 295 | Where the Licensed Rights include Sui Generis Database Rights that 296 | apply to Your use of the Licensed Material: 297 | 298 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 299 | to extract, reuse, reproduce, and Share all or a substantial 300 | portion of the contents of the database; 301 | 302 | b. if You include all or a substantial portion of the database 303 | contents in a database in which You have Sui Generis Database 304 | Rights, then the database in which You have Sui Generis Database 305 | Rights (but not its individual contents) is Adapted Material, 306 | 307 | including for purposes of Section 3(b); and 308 | c. You must comply with the conditions in Section 3(a) if You Share 309 | all or a substantial portion of the contents of the database. 310 | 311 | For the avoidance of doubt, this Section 4 supplements and does not 312 | replace Your obligations under this Public License where the Licensed 313 | Rights include other Copyright and Similar Rights. 314 | 315 | 316 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 317 | 318 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 319 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 320 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 321 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 322 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 323 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 324 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 325 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 326 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 327 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 328 | 329 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 330 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 331 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 332 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 333 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 334 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 335 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 336 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 337 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 338 | 339 | c. The disclaimer of warranties and limitation of liability provided 340 | above shall be interpreted in a manner that, to the extent 341 | possible, most closely approximates an absolute disclaimer and 342 | waiver of all liability. 343 | 344 | 345 | Section 6 -- Term and Termination. 346 | 347 | a. This Public License applies for the term of the Copyright and 348 | Similar Rights licensed here. However, if You fail to comply with 349 | this Public License, then Your rights under this Public License 350 | terminate automatically. 351 | 352 | b. Where Your right to use the Licensed Material has terminated under 353 | Section 6(a), it reinstates: 354 | 355 | 1. automatically as of the date the violation is cured, provided 356 | it is cured within 30 days of Your discovery of the 357 | violation; or 358 | 359 | 2. upon express reinstatement by the Licensor. 360 | 361 | For the avoidance of doubt, this Section 6(b) does not affect any 362 | right the Licensor may have to seek remedies for Your violations 363 | of this Public License. 364 | 365 | c. For the avoidance of doubt, the Licensor may also offer the 366 | Licensed Material under separate terms or conditions or stop 367 | distributing the Licensed Material at any time; however, doing so 368 | will not terminate this Public License. 369 | 370 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 371 | License. 372 | 373 | 374 | Section 7 -- Other Terms and Conditions. 375 | 376 | a. The Licensor shall not be bound by any additional or different 377 | terms or conditions communicated by You unless expressly agreed. 378 | 379 | b. Any arrangements, understandings, or agreements regarding the 380 | Licensed Material not stated herein are separate from and 381 | independent of the terms and conditions of this Public License. 382 | 383 | 384 | Section 8 -- Interpretation. 385 | 386 | a. For the avoidance of doubt, this Public License does not, and 387 | shall not be interpreted to, reduce, limit, restrict, or impose 388 | conditions on any use of the Licensed Material that could lawfully 389 | be made without permission under this Public License. 390 | 391 | b. To the extent possible, if any provision of this Public License is 392 | deemed unenforceable, it shall be automatically reformed to the 393 | minimum extent necessary to make it enforceable. If the provision 394 | cannot be reformed, it shall be severed from this Public License 395 | without affecting the enforceability of the remaining terms and 396 | conditions. 397 | 398 | c. No term or condition of this Public License will be waived and no 399 | failure to comply consented to unless expressly agreed to by the 400 | Licensor. 401 | 402 | d. Nothing in this Public License constitutes or may be interpreted 403 | as a limitation upon, or waiver of, any privileges and immunities 404 | that apply to the Licensor or You, including from the legal 405 | processes of any jurisdiction or authority. 406 | 407 | 408 | ======================================================================= 409 | 410 | Creative Commons is not a party to its public 411 | licenses. Notwithstanding, Creative Commons may elect to apply one of 412 | its public licenses to material it publishes and in those instances 413 | will be considered the “Licensor.” The text of the Creative Commons 414 | public licenses is dedicated to the public domain under the CC0 Public 415 | Domain Dedication. Except for the limited purpose of indicating that 416 | material is shared under a Creative Commons public license or as 417 | otherwise permitted by the Creative Commons policies published at 418 | creativecommons.org/policies, Creative Commons does not authorize the 419 | use of the trademark "Creative Commons" or any other trademark or logo 420 | of Creative Commons without its prior written consent including, 421 | without limitation, in connection with any unauthorized modifications 422 | to any of its public licenses or any other arrangements, 423 | understandings, or agreements concerning use of licensed material. For 424 | the avoidance of doubt, this paragraph does not form part of the 425 | public licenses. 426 | 427 | Creative Commons may be contacted at creativecommons.org. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [English version](README_en.md) 2 | # Easy_sign 3 | Easy_sign - опенсорс проект по распознаванию Русского жестового языка, спроектированный для развёртывания через [Streamlit](https://streamlit.io/). В проекте используется "лёгкая" ML-модель, способная работать на CPU. 4 | 5 | ## О проекте 6 | Easy_sign использует ML-модель для распознавания отдельных жестов Русского жестового языка. 7 | Модель была обучена на ~180 000 примеров жестов. Приблизительно 20 000 из которых были взяты из датасета [Slovo](https://github.com/hukenovs/slovo). 8 | Модель распознаёт 1598 жестов Русского жестового языка и может обеспечить распознавание 3-3.5 жестов в секунду на процессоре Intel(R) Core(TM) i5-6600 CPU @3.30GHz. Список распознаваемых жестов содержится в файле [RSL_class_list.txt](RSL_class_list.txt). 9 | 10 | Больше информации о проекте - в статье на [habr](https://habr.com/ru/companies/sberbank/articles/775688/). 11 | 12 | ## Порядок установки 13 | ``` 14 | conda create --name fleury-env python=3.10 15 | conda activate fleury-env 16 | pip install -r requirements.txt 17 | ``` 18 | 19 | ## Использование 20 | ``` 21 | streamlit run app.py 22 | ``` 23 | ![Good day](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExY3lsZXJvd296NW9qYzhlcThkbnFvOXg3ZG9qaXhkamg1aHJ0OWVpOCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/WyoGGzp74qzWdtPiik/giphy.gif) 24 | 25 | 26 | ## Ссылки 27 | Команда ПИН-КОД выпустила на базе easy_sign тренажёр для изучения РЖЯ. [Статья на хабр](https://habr.com/ru/articles/777700/), [репозиторий](https://github.com/PINCODE-project/RSL-Recognition-API-exe) 28 | 29 | S3D модели, обученные на датасете [Slovo](https://github.com/hukenovs/slovo) для различного количества кадров, подаваемых на вход. 30 | 31 | | Кол-во кадров | Ссылка | Mean accuracy, % | 32 | |:---------------:|:--------:|:----------------:| 33 | | 32 | https://sc.link/l8VTi | 44.22 | 34 | | 48 | https://sc.link/GSojW | 52.28 | 35 | | 64 | https://sc.link/fhLfd | 55.86 | 36 | 37 | 38 | ## Лицензия 39 | Creative Commons License
This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. 40 | -------------------------------------------------------------------------------- /README_en.md: -------------------------------------------------------------------------------- 1 | [Русская версия](README.md) 2 | # Easy_sign 3 | 4 | Easy_sign is an open source russian sign language recognition project that uses small CPU model for predictions and is designed for easy deployment via Streamlit. 5 | 6 | ## About the project 7 | Easy_sign uses a machine learning model to recognize Russian sign language gestures. 8 | The model was trained on ~180,000 examples of Russian sign language gestures. Approximately 20,000 of which are taken from the [Slovo](https://github.com/hukenovs/slovo) dataset. 9 | The model recognizes 1598 Russian sign language gestures and can process 3-3.5 gestures per second on an Intel(R) Core(TM) i5-6600 CPU @3.30GHz. The list of recognized gestures is available in the file [RSL_class_list.txt](RSL_class_list.txt). 10 | 11 | To learn more about the project - visit the link to our article on [habr](https://habr.com/ru/companies/sberbank/articles/775688/). 12 | 13 | ## Installation 14 | ``` 15 | conda create --name fleury-env python=3.10 16 | conda activate fleury-env 17 | pip install -r requirements.txt 18 | ``` 19 | 20 | ## Usage 21 | ``` 22 | streamlit run app.py 23 | ``` 24 | ![Good day](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExY3lsZXJvd296NW9qYzhlcThkbnFvOXg3ZG9qaXhkamg1aHJ0OWVpOCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/WyoGGzp74qzWdtPiik/giphy.gif) 25 | 26 | 27 | ## Links 28 | The PINCODE team has released a training simulator based on easy_sign to study Russian sign language. [Habr (Russian)](https://habr.com/ru/articles/777700/), [github](https://github.com/PINCODE-project/RSL-Recognition-API-exe) 29 | 30 | 31 | ## License 32 | Creative Commons License
This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. 33 | -------------------------------------------------------------------------------- /RSL_class_list.txt: -------------------------------------------------------------------------------- 1 | 0 1 2 | 1 10 3 | 2 2 4 | 3 2 часа 5 | 4 20 6 | 5 3 7 | 6 4 8 | 7 5 9 | 8 6 10 | 9 6 часов 11 | 10 7 12 | 11 8 13 | 12 9 14 | 13 makdonalds 15 | 14 no 16 | 15 а 17 | 16 август 18 | 17 автобус 19 | 18 агрессивный 20 | 19 агрессия 21 | 20 адаптивное поведение 22 | 21 адаптивность 23 | 22 адаптивный 24 | 23 адрес/улица 25 | 24 аккуратный 26 | 25 активный 27 | 26 актёр 28 | 27 акула 29 | 28 аллергия на еду 30 | 29 аллигатор 31 | 30 амбициозный 32 | 31 английский 33 | 32 аниматор 34 | 33 аппетит 35 | 34 аренда 36 | 35 армия 37 | 36 ароматный 38 | 37 аэропорт 39 | 38 б 40 | 39 бабочка 41 | 40 багаж 42 | 41 база 43 | 42 банк 44 | 43 банкет 45 | 44 башенные часы 46 | 45 бегемот 47 | 46 бежать 48 | 47 бежевый 49 | 48 без 50 | 49 безопасность 51 | 50 безразличие 52 | 51 безумный 53 | 52 белок 54 | 53 белый 55 | 54 берег 56 | 55 беспокоить 57 | 56 беспокоиться 58 | 57 беспокойный 59 | 58 беспокойство 60 | 59 бизнес 61 | 60 билет 62 | 61 благоговение 63 | 62 благодарность 64 | 63 благополучие 65 | 64 бледный 66 | 65 близкий 67 | 66 бог 68 | 67 бой 69 | 68 более 70 | 69 болеть 71 | 70 большинство 72 | 71 большой 73 | 72 борода 74 | 73 борьба 75 | 74 бояться 76 | 75 брат 77 | 76 брать 78 | 77 бронь 79 | 78 бросать 80 | 79 брюзжать 81 | 80 будто 82 | 81 будущий 83 | 82 бумага 84 | 83 бутылка 85 | 84 бы 86 | 85 бывать 87 | 86 бывший 88 | 87 бык 89 | 88 быстрый 90 | 89 быть 91 | 90 быть потрясенным 92 | 91 бюро 93 | 92 в 94 | 93 в восемь пятнадцать 95 | 94 в настоящее время 96 | 95 в прошлом году 97 | 96 в спешке 98 | 97 в то время как 99 | 98 в этом году 100 | 99 вагон 101 | 100 важный 102 | 101 вариант 103 | 102 вверх 104 | 103 вдохновение 105 | 104 вдохновлять 106 | 105 вдруг 107 | 106 ведать 108 | 107 ведь 109 | 108 вежливый 110 | 109 везде 111 | 110 век 112 | 111 великий 113 | 112 вера 114 | 113 верблюд 115 | 114 верить 116 | 115 верный 117 | 116 вероятно 118 | 117 верх 119 | 118 вес 120 | 119 веселиться 121 | 120 весенний 122 | 121 весна 123 | 122 вести 124 | 123 весь 125 | 124 весёлый 126 | 125 ветер 127 | 126 вечер 128 | 127 вечность 129 | 128 вечный 130 | 129 вещь 131 | 130 взгляд 132 | 131 вздрагивать 133 | 132 взять 134 | 133 вид 135 | 134 видимый 136 | 135 виза 137 | 136 вилка 138 | 137 вилять 139 | 138 вино 140 | 139 витамин 141 | 140 вкус 142 | 141 вкусный 143 | 142 власть 144 | 143 влюбить 145 | 144 влюбляться 146 | 145 вместе 147 | 146 вместо 148 | 147 внешний 149 | 148 вниз 150 | 149 внизу 151 | 150 внимание 152 | 151 внутренний 153 | 152 внутри 154 | 153 вовсе 155 | 154 вода 156 | 155 водоплавающий 157 | 156 военный 158 | 157 возбудить 159 | 158 возбуждать 160 | 159 возбуждение 161 | 160 возвращаться 162 | 161 возвращение 163 | 162 воздух 164 | 163 возможный 165 | 164 возникать 166 | 165 возрадоваться 167 | 166 возраст 168 | 167 вой 169 | 168 война 170 | 169 вокзал 171 | 170 вокруг 172 | 171 вол 173 | 172 волк 174 | 173 волос 175 | 174 воля 176 | 175 вообще 177 | 176 вопрос 178 | 177 воротник 179 | 178 восемнадцать 180 | 179 восемьдесят 181 | 180 восемьсот 182 | 181 воскресение 183 | 182 восток 184 | 183 восхищаться 185 | 184 восхищение 186 | 185 восход солнца 187 | 186 восьмой 188 | 187 вот 189 | 188 впечатление 190 | 189 вполне 191 | 190 впрочем 192 | 191 враг 193 | 192 враждебный 194 | 193 врач 195 | 194 вред 196 | 195 вредный; озорной 197 | 196 временный 198 | 197 время 199 | 198 время 11 часов 200 | 199 время для измерений 201 | 200 время от 0 ночи до 12 дня 202 | 201 время по гринвичу 203 | 202 всегда 204 | 203 вскружить 205 | 204 вспоминать 206 | 205 вспомнить 207 | 206 вставать 208 | 207 встреча 209 | 208 встречать 210 | 209 всякий 211 | 210 всё 212 | 211 всё равный 213 | 212 вторник 214 | 213 второй 215 | 214 входить 216 | 215 вчера 217 | 216 вы 218 | 217 вы/твой/ваш 219 | 218 выбирать 220 | 219 вывод 221 | 220 вызывать 222 | 221 выигрыш 223 | 222 вылетать 224 | 223 выпуск 225 | 224 выручать 226 | 225 высокий 227 | 226 высокомерный 228 | 227 выставка 229 | 228 выходить 230 | 229 выходной 231 | 230 г 232 | 231 гавканье 233 | 232 газета 234 | 233 где 235 | 234 генерал 236 | 235 гений 237 | 236 главный 238 | 237 глаз 239 | 238 глотать 240 | 239 глотать жадно 241 | 240 глупый 242 | 241 глухой 243 | 242 глядеть 244 | 243 гнев 245 | 244 гнездо 246 | 245 говорить 247 | 246 год 248 | 247 голова 249 | 248 голод 250 | 249 голос 251 | 250 гора 252 | 251 горазд 253 | 252 гордость 254 | 253 гордый 255 | 254 горевать 256 | 255 город 257 | 256 горький 258 | 257 господин 259 | 258 гостиница 260 | 259 гость 261 | 260 государство 262 | 261 готовить 263 | 262 гражданин 264 | 263 грубый 265 | 264 группа/компания 266 | 265 грустный 267 | 266 грязный 268 | 267 д 269 | 268 да 270 | 269 давать 271 | 270 давление 272 | 271 давно 273 | 272 даже 274 | 273 далёкий 275 | 274 данный 276 | 275 дать 277 | 276 двадцать 278 | 277 дважды 279 | 278 две недели 280 | 279 две тысячи 281 | 280 двенадцатый 282 | 281 двенадцать 283 | 282 дверь 284 | 283 двести 285 | 284 движение 286 | 285 двор 287 | 286 девочка 288 | 287 девушка 289 | 288 девяносто 290 | 289 девятнадцать 291 | 290 девятый 292 | 291 девятьсот 293 | 292 действительно 294 | 293 действовать 295 | 294 декабрь 296 | 295 делать 297 | 296 делать выводы 298 | 297 делать мелкий глоток 299 | 298 дело 300 | 299 дельфин 301 | 300 день 302 | 301 день и ночь 303 | 302 деньга 304 | 303 дерево 305 | 304 держать 306 | 305 десна 307 | 306 десять 308 | 307 детский 309 | 308 дешёвый 310 | 309 диета 311 | 310 дизайн 312 | 311 дикое животное 313 | 312 динозавр 314 | 313 директор 315 | 314 дистресс 316 | 315 длинный 317 | 316 для 318 | 317 до 319 | 318 до свидание 320 | 319 добавлять 321 | 320 добро 322 | 321 добро пожаловать! 323 | 322 добропорядочность 324 | 323 доверять 325 | 324 довольный 326 | 325 довольство 327 | 326 договор 328 | 327 доктор 329 | 328 документ 330 | 329 долгий 331 | 330 должный 332 | 331 доллар 333 | 332 дом 334 | 333 домашнее животное 335 | 334 доминантный 336 | 335 доминировать 337 | 336 домогаться 338 | 337 домой 339 | 338 дорога 340 | 339 дорогой 341 | 340 доставлять удовольствие 342 | 341 достаточный 343 | 342 достигать 344 | 343 дочь 345 | 344 дрожать 346 | 345 друг 347 | 346 друг друг 348 | 347 другой 349 | 348 дружелюбный 350 | 349 думать 351 | 350 дух 352 | 351 душа 353 | 352 дятел 354 | 353 е 355 | 354 еда 356 | 355 единственный 357 | 356 единый 358 | 357 ежедневный 359 | 358 если/или 360 | 359 естественно 361 | 360 ехать 362 | 361 еще нет 363 | 362 ещё 364 | 363 ж 365 | 364 жадно есть 366 | 365 жадность 367 | 366 жадный 368 | 367 жажда 369 | 368 жаждать 370 | 369 жалость 371 | 370 жаль 372 | 371 жарить 373 | 372 жаркий 374 | 373 ждать 375 | 374 же 376 | 375 жевать 377 | 376 желание 378 | 377 желать 379 | 378 жена 380 | 379 женатый 381 | 380 женский 382 | 381 женский туалет 383 | 382 женщина 384 | 383 жестокий 385 | 384 живой 386 | 385 животное 387 | 386 жираф 388 | 387 жить 389 | 388 журнал 390 | 389 жуткий 391 | 390 жёлтый 392 | 391 жёсткий 393 | 392 з 394 | 393 за 395 | 394 забирать 396 | 395 забота 397 | 396 забывать 398 | 397 заварочный чайник 399 | 398 зависеть 400 | 399 зависть 401 | 400 завтра 402 | 401 задавать 403 | 402 задача 404 | 403 задерживать 405 | 404 заказ 406 | 405 заканчивать 407 | 406 закон 408 | 407 закрывать 409 | 408 закуска перед едой 410 | 409 зал 411 | 410 замечать 412 | 411 занимать 413 | 412 заниматься 414 | 413 занятый 415 | 414 запад 416 | 415 запасливый 417 | 416 записывать 418 | 417 запоздалый 419 | 418 заполнять 420 | 419 заставлять 421 | 420 застенчивый 422 | 421 затем; потом 423 | 422 затягивать 424 | 423 зачем 425 | 424 защита 426 | 425 заявлять 427 | 426 заяц 428 | 427 звать 429 | 428 звезда 430 | 429 зверь 431 | 430 звонить 432 | 431 звук 433 | 432 здесь/тут 434 | 433 здоровье 435 | 434 здравствуйте 436 | 435 зелёный 437 | 436 земля 438 | 437 зима 439 | 438 зло 440 | 439 злобный 441 | 440 злой 442 | 441 злость 443 | 442 змея 444 | 443 знак 445 | 444 знакомить 446 | 445 знакомый 447 | 446 значит 448 | 447 золотой 449 | 448 зоопарк 450 | 449 зрелищный 451 | 450 зрение 452 | 451 зуб 453 | 452 и 454 | 453 игра 455 | 454 играть 456 | 455 идея 457 | 456 идти 458 | 457 из 459 | 458 из-за 460 | 459 известно 461 | 460 изменение 462 | 461 изменять 463 | 462 измождённый 464 | 463 износить 465 | 464 изучать 466 | 465 именно 467 | 466 иметь 468 | 467 импульс 469 | 468 имя 470 | 469 иначе 471 | 470 инвалид 472 | 471 инициатива 473 | 472 инклюзивный 474 | 473 иногда 475 | 474 иной 476 | 475 иностранный 477 | 476 институт 478 | 477 интеллектуальный 479 | 478 интересный 480 | 479 информация 481 | 480 искать 482 | 481 искренний 483 | 482 искусство 484 | 483 использовать 485 | 484 испортить 486 | 485 испуг 487 | 486 испуганный 488 | 487 испытывать 489 | 488 истерика 490 | 489 история 491 | 490 исчезать 492 | 491 итог 493 | 492 й 494 | 493 к 495 | 494 каждый 496 | 495 как 497 | 496 какой 498 | 497 календарь 499 | 498 камень 500 | 499 каникулы 501 | 500 канун 502 | 501 карандаш 503 | 502 карта 504 | 503 картина 505 | 504 касаться 506 | 505 кафе 507 | 506 кафетерий 508 | 507 качество 509 | 508 квартира 510 | 509 квитанция 511 | 510 кино 512 | 511 класс/кабинет/комната 513 | 512 клевать 514 | 513 клетка 515 | 514 клиент 516 | 515 клюв 517 | 516 ключ 518 | 517 км 519 | 518 книга 520 | 519 когда 521 | 520 коготь 522 | 521 коза 523 | 522 козёл 524 | 523 количество 525 | 524 команда 526 | 525 комар 527 | 526 комментарий 528 | 527 компьютер 529 | 528 конец 530 | 529 конечно 531 | 530 контроль 532 | 531 копыто 533 | 532 корабль 534 | 533 коридор 535 | 534 коричневый 536 | 535 корм для домашних животных 537 | 536 кормить 538 | 537 корова 539 | 538 корона 540 | 539 короткий 541 | 540 который 542 | 541 кофе 543 | 542 кошка 544 | 543 край 545 | 544 крайний 546 | 545 красивый 547 | 546 красноватый 548 | 547 красный 549 | 548 краткий 550 | 549 креветка 551 | 550 крест 552 | 551 кровь 553 | 552 крокодил 554 | 553 кролик 555 | 554 кроме 556 | 555 кротость 557 | 556 круг 558 | 557 кружка 559 | 558 крыло 560 | 559 крыса 561 | 560 кстати 562 | 561 кто 563 | 562 кубок 564 | 563 кувшин 565 | 564 куда 566 | 565 культура 567 | 566 купить 568 | 567 курица 569 | 568 курс 570 | 569 кусать 571 | 570 кусок 572 | 571 кусок; тонкими слоями 573 | 572 л 574 | 573 лак 575 | 574 ланч 576 | 575 лебедь 577 | 576 лев 578 | 577 левый 579 | 578 лежать 580 | 579 лекарство 581 | 580 ленивый 582 | 581 ленность 583 | 582 лес 584 | 583 лето 585 | 584 летучая мышь 586 | 585 ли 587 | 586 либо 588 | 587 линия 589 | 588 лиса 590 | 589 лист 591 | 590 лить 592 | 591 лицемерный 593 | 592 лицензия/регистрация 594 | 593 лицо 595 | 594 личные качества 596 | 595 личный 597 | 596 лишний 598 | 597 лишь 599 | 598 логичный 600 | 599 ложиться 601 | 600 лондон 602 | 601 лопата 603 | 602 лось 604 | 603 лошадь 605 | 604 любовь 606 | 605 любой 607 | 606 любопытный 608 | 607 лягушка 609 | 608 лёгкий 610 | 609 м 611 | 610 магазин 612 | 611 маленький 613 | 612 мало 614 | 613 мальчик 615 | 614 мама 616 | 615 марка 617 | 616 масса 618 | 617 материал 619 | 618 мать 620 | 619 машина 621 | 620 мгновение 622 | 621 медведь 623 | 622 медленный 624 | 623 медуза 625 | 624 между 626 | 625 между тем 627 | 626 международный 628 | 627 менее 629 | 628 мера 630 | 629 место 631 | 630 место для пикника 632 | 631 месяц 633 | 632 метр 634 | 633 метро 635 | 634 миграция 636 | 635 миленький 637 | 636 миллион 638 | 637 милосердный 639 | 638 милый 640 | 639 минимум 641 | 640 минута 642 | 641 мир 643 | 642 мировой 644 | 643 мнение 645 | 644 много 646 | 645 множество 647 | 646 модель 648 | 647 мой/наш 649 | 648 молодой 650 | 649 момент 651 | 650 море 652 | 651 москва 653 | 652 мотивация 654 | 653 мотивировать 655 | 654 мочь 656 | 655 мудрый 657 | 656 муж 658 | 657 мужественность 659 | 658 мужской туалет 660 | 659 мужчина 661 | 660 музей 662 | 661 музыка 663 | 662 мурашки 664 | 663 мы 665 | 664 мысль 666 | 665 мыть 667 | 666 мышь 668 | 667 мятежный 669 | 668 мёртвый 670 | 669 н 671 | 670 на 672 | 671 наблюдательность 673 | 672 наверное 674 | 673 наверху 675 | 674 навсегда 676 | 675 наглость 677 | 676 над 678 | 677 надеяться 679 | 678 надоедать 680 | 679 назад 681 | 680 назначенное время 682 | 681 называть 683 | 682 наивный 684 | 683 наконец 685 | 684 накрывать на стол 686 | 685 налог 687 | 686 написать 688 | 687 направление 689 | 688 например 690 | 689 напряжение 691 | 690 напугать 692 | 691 народ 693 | 692 наружу 694 | 693 населять 695 | 694 насколько 696 | 695 наслаждаться 697 | 696 настоящий 698 | 697 наука 699 | 698 нахальный 700 | 699 находить 701 | 700 находиться 702 | 701 нац 703 | 702 национальность 704 | 703 начало 705 | 704 начальник 706 | 705 начинать 707 | 706 нашествие 708 | 707 не 709 | 708 не бояться 710 | 709 не бывать 711 | 710 не быть 712 | 711 не верить 713 | 712 не видеть 714 | 713 не выносить 715 | 714 не выходить 716 | 715 не говорить 717 | 716 не давать 718 | 717 не делать 719 | 718 не думать 720 | 719 не забывать 721 | 720 не замечать 722 | 721 не знать 723 | 722 не иметь 724 | 723 не любить 725 | 724 не любовь 726 | 725 не мочь 727 | 726 не надо 728 | 727 не находить 729 | 728 не нравиться 730 | 729 не нужно 731 | 730 не обращать 732 | 731 не ответ 733 | 732 не отвечать 734 | 733 не очень 735 | 734 не получаться 736 | 735 не помнить 737 | 736 не понимать 738 | 737 не приходить 739 | 738 не против 740 | 739 не работа 741 | 740 не работать 742 | 741 не сказать 743 | 742 не слышать 744 | 743 не смочь 745 | 744 не стоить 746 | 745 не уверенный 747 | 746 не узнавать 748 | 747 не уметь 749 | 748 не успевать 750 | 749 не хватать 751 | 750 не хотеть 752 | 751 небо 753 | 752 невиновный 754 | 753 невозможный 755 | 754 недавно 756 | 755 неделя 757 | 756 недобрый 758 | 757 недовольный 759 | 758 нежный 760 | 759 нежный мягкий 761 | 760 некий 762 | 761 некоторый 763 | 762 неловкий; неуклюжий 764 | 763 нельзя 765 | 764 немедленный 766 | 765 немного 767 | 766 немой 768 | 767 ненавидеть 769 | 768 необходимо 770 | 769 необходимый 771 | 770 неожиданный 772 | 771 непослушный 773 | 772 непреклонный 774 | 773 неприятный 775 | 774 непрозрачность 776 | 775 нерадивый 777 | 776 нераскрашенный 778 | 777 нерв 779 | 778 несколько 780 | 779 несчастие 781 | 780 нет 782 | 781 неуважение 783 | 782 неудобный 784 | 783 неудобство 785 | 784 ни 786 | 785 нибыть 787 | 786 низкий 788 | 787 никак 789 | 788 никакой 790 | 789 никогда 791 | 790 никто 792 | 791 ничего 793 | 792 ничто 794 | 793 но 795 | 794 новость 796 | 795 новый 797 | 796 нога 798 | 797 ноль 799 | 798 номер 800 | 799 нормальный 801 | 800 носить 802 | 801 носорог 803 | 802 ночь 804 | 803 ноябрь 805 | 804 нравиться 806 | 805 нравственность 807 | 806 ну 808 | 807 нуждаться 809 | 808 нужно 810 | 809 нужный 811 | 810 нью-йорк 812 | 811 о 813 | 812 оба 814 | 813 обедать 815 | 814 обезьяна 816 | 815 обеспокоить 817 | 816 обещать 818 | 817 обладать 819 | 818 область 820 | 819 облегчение 821 | 820 обманчивость 822 | 821 обмен 823 | 822 обнаруживать 824 | 823 обнимать 825 | 824 образ 826 | 825 образование 827 | 826 образовать 828 | 827 обращать 829 | 828 обращаться 830 | 829 обучать 831 | 830 обучение 832 | 831 общество 833 | 832 общий 834 | 833 объект 835 | 834 объективный 836 | 835 объявление 837 | 836 объяснять 838 | 837 объятие 839 | 838 обычный 840 | 839 обязательный/должный 841 | 840 овца 842 | 841 огромный 843 | 842 одалживать 844 | 843 одарённый 845 | 844 одежда 846 | 845 одержимый 847 | 846 одиннадцатый 848 | 847 одиннадцать 849 | 848 одинокий 850 | 849 однажды 851 | 850 однако 852 | 851 одновременность 853 | 852 одновременный 854 | 853 оживлённый 855 | 854 ожидать 856 | 855 озаботить 857 | 856 означать 858 | 857 оказывать 859 | 858 оказываться 860 | 859 окно 861 | 860 около 862 | 861 октябрь 863 | 862 окунать 864 | 863 олень 865 | 864 он/она/оно/они 866 | 865 она 867 | 866 они 868 | 867 онлайн 869 | 868 опасный 870 | 869 операция 871 | 870 описывать 872 | 871 оплата 873 | 872 определять 874 | 873 опыт 875 | 874 опять 876 | 875 оранжевый 877 | 876 организация 878 | 877 оружие 879 | 878 орёл 880 | 879 оседать 881 | 880 осень 882 | 881 основа 883 | 882 основной 884 | 883 основной цвет 885 | 884 особенно 886 | 885 особенный 887 | 886 особый 888 | 887 оставаться 889 | 888 оставлять 890 | 889 остальной 891 | 890 останавливать 892 | 891 останавливаться 893 | 892 остановка 894 | 893 осторожный 895 | 894 остроумие 896 | 895 острый 897 | 896 от 898 | 897 отважиться 899 | 898 ответ/сказать 900 | 899 ответственный 901 | 900 отвечать 902 | 901 отвратительный 903 | 902 отвращение 904 | 903 отдавать 905 | 904 отдел 906 | 905 отдельный 907 | 906 отец 908 | 907 отказ 909 | 908 отказывать 910 | 909 откладывать 911 | 910 открывать 912 | 911 откуда 913 | 912 откупоривать 914 | 913 откусывание 915 | 914 отличный 916 | 915 отмечать 917 | 916 относиться 918 | 917 отношение 919 | 918 отправлять 920 | 919 отрицательный 921 | 920 отсутствие 922 | 921 оттенок 923 | 922 отчаиваться 924 | 923 отчаянный 925 | 924 официант 926 | 925 охотный 927 | 926 оценка 928 | 927 очередь 929 | 928 очки 930 | 929 ошарашивать 931 | 930 ошеломлять 932 | 931 ошибка 933 | 932 ощущение 934 | 933 п 935 | 934 павлин 936 | 935 пакет 937 | 936 палец 938 | 937 памятник 939 | 938 память 940 | 939 панда 941 | 940 папа 942 | 941 пара 943 | 942 парень 944 | 943 парикмахерская 945 | 944 паспорт 946 | 945 паук 947 | 946 паучья сеть 948 | 947 первый 949 | 948 переваривание 950 | 949 переваривать 951 | 950 перевод 952 | 951 переводить 953 | 952 перед 954 | 953 передавать 955 | 954 пересадка 956 | 955 переставать 957 | 956 переход 958 | 957 переходить 959 | 958 перо 960 | 959 песня 961 | 960 петух 962 | 961 петь 963 | 962 печаль 964 | 963 пингвин 965 | 964 пир 966 | 965 писать 967 | 966 письмо 968 | 967 пить 969 | 968 питьевая вода 970 | 969 плавник 971 | 970 плакать 972 | 971 план 973 | 972 плата за вход 974 | 973 плохо 975 | 974 плохой 976 | 975 по 977 | 976 по часам 978 | 977 повар 979 | 978 поведение 980 | 979 поверхностный 981 | 980 повод 982 | 981 повторять 983 | 982 погода 984 | 983 под 985 | 984 подавлять 986 | 985 подарок 987 | 986 поддержка 988 | 987 подлинный 989 | 988 подниматься 990 | 989 поднос 991 | 990 подобно 992 | 991 подобный 993 | 992 подозревать 994 | 993 подробный 995 | 994 подруга 996 | 995 подстригать 997 | 996 подтверждение 998 | 997 подумать 999 | 998 подходить 1000 | 999 подымать 1001 | 1000 поезд 1002 | 1001 поехать 1003 | 1002 позволять 1004 | 1003 позвонить на сервис 1005 | 1004 поздний 1006 | 1005 поздно 1007 | 1006 позиция 1008 | 1007 позор 1009 | 1008 поиск 1010 | 1009 пойти 1011 | 1010 пока 1012 | 1011 пока (что) 1013 | 1012 показывать 1014 | 1013 покаяние 1015 | 1014 покрасить 1016 | 1015 покраснеть 1017 | 1016 полагать 1018 | 1017 поле 1019 | 1018 ползание 1020 | 1019 политика 1021 | 1020 полиция 1022 | 1021 полный 1023 | 1022 половина 1024 | 1023 положение 1025 | 1024 положительный 1026 | 1025 получать 1027 | 1026 получаться 1028 | 1027 получающий удовольствие 1029 | 1028 пользоваться 1030 | 1029 помесь 1031 | 1030 помнить 1032 | 1031 помогать 1033 | 1032 помощник повара 1034 | 1033 понедельник 1035 | 1034 понимать 1036 | 1035 попадать 1037 | 1036 попугай 1038 | 1037 попытка 1039 | 1038 пора 1040 | 1039 порядок 1041 | 1040 посадка 1042 | 1041 посещать 1043 | 1042 после 1044 | 1043 последний 1045 | 1044 послушный 1046 | 1045 посмотреть 1047 | 1046 посольство 1048 | 1047 поставлять 1049 | 1048 постепенный 1050 | 1049 постоянный 1051 | 1050 поступать 1052 | 1051 посылать 1053 | 1052 пот 1054 | 1053 потерять 1055 | 1054 потому 1056 | 1055 потрясать 1057 | 1056 похоже 1058 | 1057 почва 1059 | 1058 почему 1060 | 1059 починять 1061 | 1060 почка 1062 | 1061 почта 1063 | 1062 почти 1064 | 1063 поэтому 1065 | 1064 появление 1066 | 1065 правда 1067 | 1066 правило 1068 | 1067 правильный 1069 | 1068 правительство 1070 | 1069 право 1071 | 1070 правша 1072 | 1071 правый 1073 | 1072 прагматичный 1074 | 1073 праздник 1075 | 1074 практика 1076 | 1075 практически 1077 | 1076 предать 1078 | 1077 предел 1079 | 1078 предлагать 1080 | 1079 предложить тост 1081 | 1080 предпочитать 1082 | 1081 представитель 1083 | 1082 представлять 1084 | 1083 предусмотрительный 1085 | 1084 предыдущий 1086 | 1085 прежде 1087 | 1086 президент 1088 | 1087 презирать 1089 | 1088 презрение 1090 | 1089 прекрасный 1091 | 1090 пренебрежение 1092 | 1091 при 1093 | 1092 прибывать 1094 | 1093 привет 1095 | 1094 привозить 1096 | 1095 привыкать 1097 | 1096 приглашение 1098 | 1097 приезжать 1099 | 1098 прием пищи 1100 | 1099 признавать 1101 | 1100 приличный 1102 | 1101 пример/казаться 1103 | 1102 примерный 1104 | 1103 принимать/получать 1105 | 1104 приносить 1106 | 1105 принцип 1107 | 1106 природа 1108 | 1107 приручать 1109 | 1108 приходить 1110 | 1109 приходиться 1111 | 1110 причина 1112 | 1111 причинять резкую боль 1113 | 1112 приятный 1114 | 1113 приём 1115 | 1114 про 1116 | 1115 проблема 1117 | 1116 пробовать 1118 | 1117 проверка 1119 | 1118 проверять 1120 | 1119 проводить 1121 | 1120 программа 1122 | 1121 продавать 1123 | 1122 продлевать 1124 | 1123 продлиться 1125 | 1124 продолжать 1126 | 1125 продолжение 1127 | 1126 продолжительность 1128 | 1127 продумывать 1129 | 1128 проект 1130 | 1129 прозрачный 1131 | 1130 произносить 1132 | 1131 происходить 1133 | 1132 проныра 1134 | 1133 просить 1135 | 1134 просто 1136 | 1135 пространство 1137 | 1136 против 1138 | 1137 проходить 1139 | 1138 процесс 1140 | 1139 прошлый 1141 | 1140 прощание 1142 | 1141 прощать 1143 | 1142 прямо 1144 | 1143 прямой 1145 | 1144 птица 1146 | 1145 пункт 1147 | 1146 пустой 1148 | 1147 пусть 1149 | 1148 путешествие 1150 | 1149 путешествовать 1151 | 1150 путь 1152 | 1151 пчела 1153 | 1152 пылесос 1154 | 1153 пытаться 1155 | 1154 пятнадцать 1156 | 1155 пятница 1157 | 1156 пятый 1158 | 1157 пять год 1159 | 1158 пять тысяч 1160 | 1159 пятьдесят 1161 | 1160 пятьсот 1162 | 1161 р 1163 | 1162 раб 1164 | 1163 работа 1165 | 1164 работать 1166 | 1165 рабочий 1167 | 1166 равно 1168 | 1167 рад 1169 | 1168 радостный 1170 | 1169 раз 1171 | 1170 разбивать 1172 | 1171 разве 1173 | 1172 развитие 1174 | 1173 разгневать 1175 | 1174 разговор 1176 | 1175 раздражать 1177 | 1176 различный 1178 | 1177 размер 1179 | 1178 разный 1180 | 1179 разочаровывать 1181 | 1180 разрыдаться 1182 | 1181 разумный 1183 | 1182 разъярённый 1184 | 1183 район 1185 | 1184 ранее 1186 | 1185 ранний 1187 | 1186 рано 1188 | 1187 расписание 1189 | 1188 распределять 1190 | 1189 рассердиться 1191 | 1190 рассеянный 1192 | 1191 рассказывать 1193 | 1192 расслабление 1194 | 1193 расслабляться 1195 | 1194 расстраивать 1196 | 1195 расстройство 1197 | 1196 расти 1198 | 1197 растить 1199 | 1198 рвеность 1200 | 1199 реальный 1201 | 1200 ребята 1202 | 1201 ребяческий 1203 | 1202 ребёнок 1204 | 1203 ревнивый 1205 | 1204 редкий 1206 | 1205 результат 1207 | 1206 рейс 1208 | 1207 река 1209 | 1208 религия 1210 | 1209 ремонт 1211 | 1210 ресторан 1212 | 1211 речь 1213 | 1212 решать 1214 | 1213 рог 1215 | 1214 родитель 1216 | 1215 родиться 1217 | 1216 рождение 1218 | 1217 розовато-лиловый 1219 | 1218 розовый 1220 | 1219 роль 1221 | 1220 роман 1222 | 1221 россия 1223 | 1222 рот 1224 | 1223 рубль 1225 | 1224 рука 1226 | 1225 руководитель 1227 | 1226 ручка 1228 | 1227 рыба 1229 | 1228 рыдать 1230 | 1229 рынок 1231 | 1230 рычание 1232 | 1231 рычать 1233 | 1232 ряд 1234 | 1233 с 1235 | 1234 с днем рождения 1236 | 1235 с тех пор как 1237 | 1236 с я 1238 | 1237 сайт 1239 | 1238 сам 1240 | 1239 самоанализ 1241 | 1240 самовосприятие 1242 | 1241 самоконтроль 1243 | 1242 самолёт 1244 | 1243 самомнение 1245 | 1244 самообман 1246 | 1245 самоосознание 1247 | 1246 самопроверка 1248 | 1247 самый 1249 | 1248 сарказм 1250 | 1249 сбер 1251 | 1250 сверху 1252 | 1251 свет 1253 | 1252 свинья 1254 | 1253 свисток 1255 | 1254 свобода 1256 | 1255 свободный/разрешение 1257 | 1256 свой 1258 | 1257 связь 1259 | 1258 сдавать 1260 | 1259 сделать 1261 | 1260 себя 1262 | 1261 север 1263 | 1262 седьмой 1264 | 1263 сей пора 1265 | 1264 сейчас/сегодня 1266 | 1265 секунда 1267 | 1266 семнадцать 1268 | 1267 семьдесят 1269 | 1268 семьсот 1270 | 1269 семья 1271 | 1270 сентябрь 1272 | 1271 сердитый 1273 | 1272 сердце 1274 | 1273 серебро 1275 | 1274 серый 1276 | 1275 сестра 1277 | 1276 сеть 1278 | 1277 сзади 1279 | 1278 сидеть 1280 | 1279 сила 1281 | 1280 синий 1282 | 1281 система 1283 | 1282 ситуация 1284 | 1283 сквозь 1285 | 1284 скидка 1286 | 1285 сколько 1287 | 1286 скорбеть 1288 | 1287 скорый 1289 | 1288 скромный 1290 | 1289 скучать 1291 | 1290 скучный 1292 | 1291 слабость 1293 | 1292 слабый 1294 | 1293 следовать 1295 | 1294 следующий 1296 | 1295 слепой 1297 | 1296 слишком/очень 1298 | 1297 словно 1299 | 1298 слово 1300 | 1299 сложный 1301 | 1300 сломать 1302 | 1301 слон 1303 | 1302 служба 1304 | 1303 случаться 1305 | 1304 слушать 1306 | 1305 слышать 1307 | 1306 смелость 1308 | 1307 смерть 1309 | 1308 смех 1310 | 1309 смешной 1311 | 1310 смеяться 1312 | 1311 смиряться 1313 | 1312 смотреть/видеть 1314 | 1313 смочь 1315 | 1314 смутить 1316 | 1315 смысл 1317 | 1316 сначала 1318 | 1317 снимать 1319 | 1318 снова 1320 | 1319 собака 1321 | 1320 собачий домик 1322 | 1321 собирать 1323 | 1322 собственный 1324 | 1323 событие 1325 | 1324 совершать 1326 | 1325 советовать 1327 | 1326 советский 1328 | 1327 современный 1329 | 1328 совсем 1330 | 1329 согласно 1331 | 1330 соглашаться 1332 | 1331 сожаление 1333 | 1332 сожалеть 1334 | 1333 создавать 1335 | 1334 создание 1336 | 1335 сознание 1337 | 1336 солнце 1338 | 1337 соль 1339 | 1338 сомневаться 1340 | 1339 сомнение 1341 | 1340 сон 1342 | 1341 сообщение 1343 | 1342 сорок 1344 | 1343 составлять 1345 | 1344 состояние 1346 | 1345 состоять 1347 | 1346 соты 1348 | 1347 сохранять 1349 | 1348 социальный 1350 | 1349 сочувствие 1351 | 1350 союз 1352 | 1351 спасибо 1353 | 1352 спать 1354 | 1353 спектакль 1355 | 1354 специалист 1356 | 1355 специальность 1357 | 1356 список 1358 | 1357 спокойный 1359 | 1358 способ 1360 | 1359 способность 1361 | 1360 способный 1362 | 1361 справка 1363 | 1362 спрашивать 1364 | 1363 сразу 1365 | 1364 среда 1366 | 1365 среди 1367 | 1366 средний 1368 | 1367 средство 1369 | 1368 срок 1370 | 1369 срочный 1371 | 1370 ставить 1372 | 1371 становиться 1373 | 1372 старание 1374 | 1373 стараться 1375 | 1374 старик 1376 | 1375 старый 1377 | 1376 статья 1378 | 1377 стена 1379 | 1378 сто 1380 | 1379 стоить 1381 | 1380 стойкость 1382 | 1381 стол 1383 | 1382 столь 1384 | 1383 стоп 1385 | 1384 сторона 1386 | 1385 стоять 1387 | 1386 страдание 1388 | 1387 страдать 1389 | 1388 страна 1390 | 1389 странный 1391 | 1390 страсть 1392 | 1391 страшный 1393 | 1392 строгий 1394 | 1393 строить 1395 | 1394 студент 1396 | 1395 стыдный 1397 | 1396 суббота 1398 | 1397 суд 1399 | 1398 судьба 1400 | 1399 суматоха 1401 | 1400 сумка 1402 | 1401 сумма 1403 | 1402 сухой 1404 | 1403 существо 1405 | 1404 существование 1406 | 1405 существовать 1407 | 1406 сфера 1408 | 1407 сцена 1409 | 1408 счастие 1410 | 1409 счастливый 1411 | 1410 считать 1412 | 1411 сын 1413 | 1412 сюда 1414 | 1413 сюрприз 1415 | 1414 т 1416 | 1415 таблетка 1417 | 1416 так 1418 | 1417 так себе 1419 | 1418 также 1420 | 1419 таки 1421 | 1420 такси 1422 | 1421 талант 1423 | 1422 там/туда 1424 | 1423 тарелка 1425 | 1424 твёрдый 1426 | 1425 театр 1427 | 1426 текст 1428 | 1427 телефон 1429 | 1428 тело 1430 | 1429 тема/название 1431 | 1430 темнота 1432 | 1431 теория 1433 | 1432 теперь 1434 | 1433 терпение 1435 | 1434 терпеть 1436 | 1435 территория 1437 | 1436 техника 1438 | 1437 течение 1439 | 1438 тигр 1440 | 1439 тип 1441 | 1440 то 1442 | 1441 товар 1443 | 1442 тогда 1444 | 1443 тоже 1445 | 1444 только 1446 | 1445 торжественный 1447 | 1446 тот 1448 | 1447 тот же 1449 | 1448 тот же самый (одинаковый) 1450 | 1449 точка 1451 | 1450 точно 1452 | 1451 требование 1453 | 1452 требовать 1454 | 1453 тревога 1455 | 1454 третий 1456 | 1455 три тысячи 1457 | 1456 тридцать 1458 | 1457 тринадцать 1459 | 1458 триста 1460 | 1459 труд 1461 | 1460 трудный 1462 | 1461 трус 1463 | 1462 трусливый 1464 | 1463 туфля 1465 | 1464 тщеславный 1466 | 1465 ты 1467 | 1466 тысяча 1468 | 1467 тяжёлый 1469 | 1468 тёмный 1470 | 1469 тёплый 1471 | 1470 у 1472 | 1471 у вы 1473 | 1472 у мы 1474 | 1473 у он 1475 | 1474 у она 1476 | 1475 у они 1477 | 1476 у ты 1478 | 1477 у я 1479 | 1478 убивать 1480 | 1479 уверенный 1481 | 1480 угол 1482 | 1481 угрюмый 1483 | 1482 удаваться 1484 | 1483 ударять 1485 | 1484 удивлять 1486 | 1485 удовольствие 1487 | 1486 уезжать 1488 | 1487 уж 1489 | 1488 ужасный 1490 | 1489 уже 1491 | 1490 узнавать 1492 | 1491 указывать 1493 | 1492 улыбаться 1494 | 1493 улыбка 1495 | 1494 ум 1496 | 1495 уметь/знать 1497 | 1496 умирать 1498 | 1497 университет 1499 | 1498 упасть 1500 | 1499 управление 1501 | 1500 уровень 1502 | 1501 уронить 1503 | 1502 условие 1504 | 1503 услуга 1505 | 1504 услышать 1506 | 1505 успевать 1507 | 1506 успех 1508 | 1507 устраивать 1509 | 1508 утро 1510 | 1509 ухо 1511 | 1510 уходить 1512 | 1511 участие 1513 | 1512 ученик 1514 | 1513 учитель 1515 | 1514 учить 1516 | 1515 ф 1517 | 1516 факс 1518 | 1517 факт 1519 | 1518 фамилия 1520 | 1519 фиолетовый 1521 | 1520 фирма 1522 | 1521 форма 1523 | 1522 фотография 1524 | 1523 футбол 1525 | 1524 х 1526 | 1525 характер 1527 | 1526 хватать 1528 | 1527 химия 1529 | 1528 хлеб 1530 | 1529 ход 1531 | 1530 хозяин 1532 | 1531 холод 1533 | 1532 холостой 1534 | 1533 хороший 1535 | 1534 хорошо 1536 | 1535 хотеть 1537 | 1536 хоть 1538 | 1537 хотя 1539 | 1538 ц 1540 | 1539 цвет 1541 | 1540 цветовой оттенок 1542 | 1541 целый 1543 | 1542 цель 1544 | 1543 цемент 1545 | 1544 цена 1546 | 1545 центр 1547 | 1546 ч 1548 | 1547 час 1549 | 1548 частый 1550 | 1549 часть 1551 | 1550 часы 1552 | 1551 чашка 1553 | 1552 человек 1554 | 1553 чемодан 1555 | 1554 через 1556 | 1555 четверг 1557 | 1556 четвёртый 1558 | 1557 четыре тысячи 1559 | 1558 четыреста 1560 | 1559 четырнадцать 1561 | 1560 чинить 1562 | 1561 число 1563 | 1562 чистый 1564 | 1563 читать 1565 | 1564 что 1566 | 1565 что-нибудь 1567 | 1566 чтобы 1568 | 1567 чувствовать 1569 | 1568 чудесный 1570 | 1569 чужой 1571 | 1570 чуть-чуть 1572 | 1571 чёрный 1573 | 1572 ш 1574 | 1573 шаг 1575 | 1574 шестнадцать 1576 | 1575 шестой 1577 | 1576 шестьдесят 1578 | 1577 школа 1579 | 1578 шум 1580 | 1579 шутить 1581 | 1580 щ 1582 | 1581 ъ 1583 | 1582 ы 1584 | 1583 ь 1585 | 1584 э 1586 | 1585 экономика 1587 | 1586 экскурсия 1588 | 1587 энергия 1589 | 1588 этаж 1590 | 1589 это 1591 | 1590 этот 1592 | 1591 ю 1593 | 1592 юг 1594 | 1593 я 1595 | 1594 являться 1596 | 1595 язык 1597 | 1596 ясный 1598 | 1597 ё 1599 | 1598 ёжик 1600 | -------------------------------------------------------------------------------- /S3D.onnx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ai-forever/easy_sign/c7ab48e38e39d415789d69d4674e2d4ce2c5df4a/S3D.onnx -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import queue 3 | from collections import deque 4 | 5 | import streamlit as st 6 | from streamlit_webrtc import WebRtcMode, webrtc_streamer 7 | 8 | from utils import SLInference 9 | 10 | 11 | logger = logging.getLogger(__name__) 12 | 13 | def main(config_path): 14 | """ 15 | Main function of the app. 16 | """ 17 | inference_thread = SLInference(config_path) 18 | inference_thread.start() 19 | 20 | webrtc_ctx = webrtc_streamer( 21 | key="video-sendonly", 22 | mode=WebRtcMode.SENDONLY, 23 | media_stream_constraints={"video": True}, 24 | ) 25 | 26 | gestures_deque = deque(maxlen=5) 27 | 28 | # Set up Streamlit interface 29 | st.title("Sign Language Recognition Demo") 30 | image_place = st.empty() 31 | text_output = st.empty() 32 | last_5_gestures = st.empty() 33 | st.markdown( 34 | """ 35 | 36 | This application is designed to recognize sign language using a webcam feed. 37 | The model has been trained to recognize various sign language gestures and display the corresponding text in real-time. 38 | 39 | This demo app is based on code here: https://github.com/ai-forever/easy_sign 40 | The project is open for collaboration. If you have any suggestions or want to contribute, please feel free to reach out. 41 | """ 42 | ) 43 | 44 | while True: 45 | if webrtc_ctx.video_receiver: 46 | try: 47 | video_frame = webrtc_ctx.video_receiver.get_frame(timeout=1) 48 | except queue.Empty: 49 | logger.warning("Queue is empty") 50 | continue 51 | 52 | img_rgb = video_frame.to_ndarray(format="rgb24") 53 | image_place.image(img_rgb) 54 | inference_thread.input_queue.append(video_frame.reformat(224,224).to_ndarray(format="rgb24")) 55 | 56 | gesture = inference_thread.pred 57 | if gesture not in ['no', '']: 58 | if not gestures_deque: 59 | gestures_deque.append(gesture) 60 | elif gesture != gestures_deque[-1]: 61 | gestures_deque.append(gesture) 62 | 63 | text_output.markdown(f'

Current gesture: {gesture}

', 64 | unsafe_allow_html=True) 65 | last_5_gestures.markdown(f'

Last 5 gestures: {" ".join(gestures_deque)}

', 66 | unsafe_allow_html=True) 67 | print(gestures_deque) 68 | 69 | 70 | 71 | if __name__ == "__main__": 72 | main("configs/config.json") 73 | 74 | -------------------------------------------------------------------------------- /configs/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "path_to_model": "S3D.onnx", 3 | "threshold": 0.5, 4 | "topk": 1, 5 | "path_to_class_list": "RSL_class_list.txt", 6 | "window_size": 32, 7 | "provider": "OpenVINOExecutionProvider" 8 | } 9 | -------------------------------------------------------------------------------- /model.py: -------------------------------------------------------------------------------- 1 | from sys import platform 2 | import onnxruntime as rt 3 | from einops import rearrange 4 | import numpy as np 5 | 6 | if platform in {"win32", "win64"}: 7 | import onnxruntime.tools.add_openvino_win_libs as utils 8 | utils.add_openvino_libs_to_path() 9 | 10 | 11 | class Predictor: 12 | def __init__(self, model_config): 13 | """ 14 | Initialize the Predictor class. 15 | 16 | Args: 17 | model_config (dict): Model configuration containing path_to_model, 18 | path_to_class_list, threshold, and topk values. 19 | """ 20 | self.config = model_config 21 | self.provider = self.config["provider"] 22 | self.threshold = self.config["threshold"] 23 | self.labels = {} 24 | 25 | self.model_init(self.config["path_to_model"]) 26 | self.create_labels() 27 | 28 | def create_labels(self): 29 | """ 30 | Create a dictionary of labels from the provided path_to_class_list. 31 | """ 32 | with open(self.config["path_to_class_list"], "r") as f: 33 | labels = [line.strip() for line in f] 34 | labels = self.decode_preds(labels) 35 | 36 | idx_lbl_pairs = [x.split("\t") for x in labels] 37 | self.labels = {int(x[0]): x[1] for x in idx_lbl_pairs} 38 | 39 | 40 | def softmax(self, x): 41 | exp_x = np.exp(x - np.max(x, axis=1, keepdims=True)) 42 | return exp_x / np.sum(exp_x, axis=1, keepdims=True) 43 | 44 | def predict(self, x): 45 | """ 46 | Make a prediction using the provided input frames. 47 | 48 | Args: 49 | x (list): List of input frames. 50 | 51 | Returns: 52 | dict: Dictionary containing predicted labels and confidence values. 53 | """ 54 | clip = np.array(x).astype(np.float32) / 255.0 55 | clip = rearrange(clip, "t h w c -> 1 c t h w") 56 | 57 | prediction = self.model([self.output_name], {self.input_name: clip})[0] 58 | prediction = self.softmax(prediction) 59 | prediction = np.squeeze(prediction) 60 | topk_labels = prediction.argsort()[-self.config["topk"] :][::-1] 61 | topk_confidence = prediction[topk_labels] 62 | 63 | result = [self.labels[lbl_idx] for lbl_idx in topk_labels] 64 | if np.max(topk_confidence) < self.threshold: 65 | return None 66 | 67 | return { 68 | "labels": dict(zip([i for i in range(len(result))], result)), 69 | "confidence": dict(zip([i for i in range(len(result))], topk_confidence)), 70 | } 71 | 72 | def model_init(self, path_to_model: str) -> None: 73 | """ 74 | Load and init the ONNX model using the provided path. 75 | 76 | Args: 77 | path_to_model (str): Path to the ONNX model file. 78 | 79 | Returns: 80 | None 81 | """ 82 | session = rt.InferenceSession(path_to_model, providers=[self.provider]) 83 | self.input_name = session.get_inputs()[0].name 84 | self.output_name = session.get_outputs()[0].name 85 | 86 | self.model = session.run 87 | 88 | def decode_preds(self, data): 89 | if platform in {"win32", "win64"}: 90 | data = [i.encode("cp1251").decode("utf-8") for i in data] 91 | return data -------------------------------------------------------------------------------- /opencv_inference.py: -------------------------------------------------------------------------------- 1 | from collections import deque 2 | 3 | import cv2 4 | 5 | from utils import SLInference 6 | 7 | 8 | def main(config_path): 9 | """ 10 | Main function of the app. 11 | """ 12 | 13 | cap = cv2.VideoCapture(0) 14 | 15 | inference_thread = SLInference(config_path) 16 | inference_thread.start() 17 | 18 | gestures_deque = deque(maxlen=5) 19 | 20 | while True: 21 | _, img = cap.read() 22 | img_resized = cv2.resize(img, (224, 224)) 23 | inference_thread.input_queue.append(img_resized) 24 | 25 | gesture = inference_thread.pred 26 | if gesture not in ['no', '']: 27 | if not gestures_deque: 28 | gestures_deque.append(gesture) 29 | elif gesture != gestures_deque[-1]: 30 | gestures_deque.append(gesture) 31 | 32 | if gestures_deque: 33 | print(gestures_deque[-1]) 34 | 35 | cv2.imshow("img", img) 36 | cv2.waitKey(1) 37 | 38 | 39 | if __name__ == "__main__": 40 | main("configs/config.json") -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | onnx==1.14.0 2 | streamlit==1.28.2 3 | streamlit-webrtc==0.47.1 4 | einops==0.6.1 5 | opencv-python 6 | 7 | # only for mac 8 | onnxruntime==1.16.0; sys_platform == 'darwin' 9 | # only linux or windows 10 | onnxruntime-openvino==1.16; sys_platform != 'darwin' 11 | # Windows-specific dependency 12 | openvino==2023.1; sys_platform == 'win32' -------------------------------------------------------------------------------- /utils.py: -------------------------------------------------------------------------------- 1 | from collections import deque 2 | import json 3 | from threading import Thread 4 | from model import Predictor 5 | import time 6 | 7 | class SLInference: 8 | """ 9 | Main prediction thread. 10 | 11 | Attributes: 12 | running (bool): Flag to control the running of the thread. 13 | config (dict): Configuration parameters for the model. 14 | model (Predictor): The prediction model. 15 | input_queue (deque): A queue to hold the input data. 16 | pred (str): The prediction result. 17 | thread (Thread): The worker thread. 18 | """ 19 | def __init__(self, config_path): 20 | """ 21 | Initialize the SLInference object. 22 | 23 | Args: 24 | config_path (str): Path to the configuration file. 25 | """ 26 | self.running = True 27 | self.config = self.read_config(config_path) 28 | self.model = Predictor(self.config) 29 | self.input_queue = deque(maxlen=self.config["window_size"]) 30 | self.pred = "" 31 | 32 | def read_config(self, config_path): 33 | """ 34 | Read the configuration file. 35 | 36 | Args: 37 | config_path (str): Path to the configuration file. 38 | 39 | Returns: 40 | dict: The configuration parameters. 41 | """ 42 | with open(config_path, "r") as f: 43 | config = json.load(f) 44 | return config 45 | 46 | def worker(self): 47 | """ 48 | The main worker function that runs in a separate thread. 49 | """ 50 | while self.running: 51 | if len(self.input_queue) == self.config["window_size"]: 52 | pred_dict = self.model.predict(self.input_queue) 53 | if pred_dict: 54 | self.pred = pred_dict["labels"][0] 55 | self.input_queue.clear() 56 | else: 57 | self.pred = "" 58 | time.sleep(0.1) 59 | 60 | def start(self): 61 | """ 62 | Start the worker thread. 63 | """ 64 | self.thread = Thread(target=self.worker) 65 | self.thread.start() 66 | 67 | def stop(self): 68 | """ 69 | Stop the worker thread. 70 | """ 71 | self.running = False 72 | self.thread.join() --------------------------------------------------------------------------------