Metadata-Version: 2.4
Name: rvc-lib
Version: 0.10.10
Summary: 
Author: Nagy Dominik
Author-email: dominik.nagy@irfsolutions.at
Requires-Python: >3.11.0,<3.14
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Provides-Extra: detection
Requires-Dist: accelerate (==1.8.1)
Requires-Dist: anyio (>=4.9.0,<5.0.0)
Requires-Dist: apscheduler (>=3.10.4,<4.0.0)
Requires-Dist: click (>=8.1.8,<9.0.0)
Requires-Dist: cryptography (>=42.0.7,<43.0.0)
Requires-Dist: docker (>=7.1.0,<8.0.0)
Requires-Dist: dynaconf (>=3.2.5,<4.0.0)
Requires-Dist: filterpy (>=1.4.5) ; extra == "detection"
Requires-Dist: grpcio (>=1.74.0,<2.0.0)
Requires-Dist: grpcio-tools (>=1.66.1,<2.0.0)
Requires-Dist: hsemotion (>=0.3.0,<0.4.0) ; extra == "detection"
Requires-Dist: humanize (>=4.9.0,<5.0.0)
Requires-Dist: jsonschema (>=4.21.1,<5.0.0)
Requires-Dist: kafka-python (>=2.0.2,<3.0.0)
Requires-Dist: kazoo (>=2.10.0,<3.0.0)
Requires-Dist: mivolo (==0.6.0dev) ; extra == "detection"
Requires-Dist: more-itertools (>=10.2.0,<11.0.0)
Requires-Dist: numpy (<2.0.0) ; sys_platform == "win32"
Requires-Dist: openpyxl (>=3.1.4,<4.0.0)
Requires-Dist: openvino (==2024.6.0) ; extra == "detection"
Requires-Dist: pandas (>=2.1.0,<3.0.0)
Requires-Dist: prometheus-client (>=0.23.1,<0.24.0)
Requires-Dist: psutil (>=6.1.0,<7.0.0)
Requires-Dist: py7zr (>=0.21.0,<0.22.0)
Requires-Dist: pyarrow (>=18.1.0,<19.0.0)
Requires-Dist: pycryptodome (==3.23.0)
Requires-Dist: pyee (>=11.1.0,<12.0.0)
Requires-Dist: pygrabber (>=0.2,<0.3) ; sys_platform == "win32"
Requires-Dist: pyreadline3 (>=3.5.4,<4.0.0) ; sys_platform == "win32"
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
Requires-Dist: pyudev (>=0.24.1,<0.25.0) ; sys_platform == "linux"
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
Requires-Dist: returns[compatible-mypy] (>=0.25.0,<0.26.0)
Requires-Dist: rich (>=13.7.1,<14.0.0)
Requires-Dist: similari-trackers-rs (>=0.26.5,<0.27.0) ; extra == "detection"
Requires-Dist: sqlmodel (==0.0.27)
Requires-Dist: structlog (>=24.4.0,<25.0.0)
Requires-Dist: supervision (>=0.27.0,<0.28.0)
Requires-Dist: tabulate (>=0.9.0,<0.10.0)
Requires-Dist: torch (==2.4) ; (sys_platform == "linux") and (extra == "detection")
Requires-Dist: torch (>=2.4,<3.0) ; (sys_platform == "win32") and (extra == "detection")
Requires-Dist: torchvision (>=0.19,<0.20) ; (sys_platform == "linux") and (extra == "detection")
Requires-Dist: torchvision (>=0.19,<0.20) ; (sys_platform == "win32") and (extra == "detection")
Requires-Dist: transformers (==4.51.0)
Requires-Dist: v4l2ctl (>=0.1a5,<0.2)
Requires-Dist: websockets (>=11.0.3,<12.0.0)
Requires-Dist: yacs (>=0.1.0,<0.2.0)
Description-Content-Type: text/markdown

This repository poses as a base (library) to all projects involving RVC.
All features required thorough the RVC opbject detection and its Pipeline,
should be developed here to be available across all projects.

## Contains

| Module          | Description                                                                                                  |
| --------------- | ------------------------------------------------------------------------------------------------------------ |
| Camera          | Input device (camera), input stream (rtsp), input file (video) processing and configuration.                 |
| ConfigManager   | Global configuration to the project.                                                                         |
| DataUpload      | Uploading local data related objects.                                                                        |
| DB              | Local data persistence related components.                                                                   |
| Detector        | Detector implementations, detector detects with model.                                                       |
| Model           | Model persistence, dynamic loading, result translation, common functions.                                    |
| Pipeline        | Main category, all the different Pipeline elements. Use these to create your pipeline, or extend with yours. |
| Tracking        | Object tracking implementations.                                                                             |
| Utils           | Misc utils.                                                                                                  |

## Examples

There's an extensive examples directory for using different components.

## Production

For production ready configurations please checkout this repository, and modify the configuration in `examples/pipeline/prod.py`.
Use the created configuration with the Pipeline.

## Info

|                 |                              |
| --------------- | ---------------------------- |
| Python          | Python3.11                   |
| Supported OS    | Ubuntu 20.04, 22.04          |
| Tested          | OpenSUSE Tumbleweed 20240321 |

## Preequistes

Please see `pyproject.toml` or list dependencies with `poetry show -T`.

## Install

Please don't install this, use as a dependency.

You can find the supported versions on [RVC PYPI](pip.rvc.digital).
## Dev Setup

This package requires [Poetry](https://python-poetry.org/) for building.

When needed create a different environment with `poetry env use <python version>`.

Install dependencies with `poetry install` or `poetry update`.

Create wheel package for _pip_ with `poetry build`.

## Obfuscating using pyarmor

The script `called make_obfus.sh` is designed to obfuscate (make the code unclear or difficult to understand) the Python library named `rvc_lib` using a tool called PyArmor. It also uses the `rg` (ripgrep) tool to search through files and the `sed` tool to perform in-place file modifications. Before running the script, you must ensure that PyArmor, `rg`, and `sed` are installed on your system. The process, in summary, involves the following steps:

1. **Deletion:** First, it removes the previously obfuscated library if it exists, named `dist-obfus`.

   ```bash
   rm -rf dist-obfus
   ```

2. **Obfuscation:** Then, it recursively obfuscates the `rvc_lib` library using PyArmor and stores the result in the `dist-obfus` directory.
   ```bash
   pyarmor gen -r -O dist-obfus rvc_lib
   ```

3. **Backup:** Afterwards, the script renames the current `rvc_lib` directory to `rvc_lib_bak` for backup purposes.
   ```bash
   mv rvc_lib rvc_lib_bak
   ```

4. **Import Fixing:** The script searches for the `pyarmor_runtime` import in all obfuscated files and replaces it with `rvc_lib.pyarmor_runtime`.
   ```bash
   rg pyarmor_runtime --files dist-obfus/rvc_lib | xargs sed -i 's/pyarmor_runtime/rvc_lib.pyarmor_runtime/'
   ```

5. **Moving Runtime Folder:** It moves the `pyarmor_runtime_000000` folder into the `dist-obfus/rvc_lib` directory.
   ```bash
   mv dist-obfus/pyarmor_runtime_000000 dist-obfus/rvc_lib/
   ```

6. **Moving New Library:** It moves the obfuscated `rvc_lib` directory to the root directory.
   ```bash
   mv dist-obfus/rvc_lib .
   ```

7. **Creating Wheel Package:** Using the Poetry tool, the script builds a wheel package from the new `rvc_lib` directory.
   ```bash
   poetry build
   ```

8. **Restoring Original Library:** Finally, the script removes the obfuscated `rvc_lib` directory and restores the original `rvc_lib` directory from the `rvc_lib_bak` directory.
   ```bash
   rm -rf rvc_lib
   mv rvc_lib_bak rvc_lib
   ```

It is important to note that this process makes changes to the file system, so ensure that you have proper backups before running the script.

## CUDA

### PyTorch

To use pytorch with CUDA Capabilities please see: [Getting started](https://pytorch.org/get-started/locally/)

for now, use `poetry run python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
`

## Setup gRPC

- init submodule `git submodule --update --init`
- compile protobuf definitions
  ```bash
  poetry run python3 -m grpc_tools.protoc \
    -I rvc_lib/proto \
    --python_out=rvc_lib/proto_files \
    --pyi_out=rvc_lib/proto_files \
    --grpc_python_out=rvc_lib/proto_files \
    rvc_lib/proto/*.proto
  ```
- Update when changed

# Windows

## Fix for `fbgemm.dll" or one of its dependencies.`

[see](https://discuss.pytorch.org/t/failed-to-import-pytorch-fbgemm-dll-or-one-of-its-dependencies-is-missing/201969/27)

downloads and get:

- https://aka.ms/vs/16/release/14.29.30153/VC_Redist.x64.exe
- https://aka.ms/vs/16/release/14.29.30153/VC_Redist.x86.exe

