mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:36:31 +00:00
b21f8e320f
add tensorrt engine
77 lines
2.0 KiB
Markdown
77 lines
2.0 KiB
Markdown
<h2>Azaion AI</h2>
|
|
|
|
<p>
|
|
Azaion AI is a worker written on cython (c-compilable python) which listens to socket and rabbit queue.
|
|
It accepts commands om a format:
|
|
|
|
- CommandType: Inference / Load
|
|
- Filename
|
|
|
|
And correspondingly do inference or just load encrypted file from the API.
|
|
Results (file or annotations) is putted to the other queue, or the same socket, depending on the command source.
|
|
</p>
|
|
|
|
<h2>Installation</h2>
|
|
|
|
Prepare correct onnx model from YOLO:
|
|
```python
|
|
from ultralytics import YOLO
|
|
import netron
|
|
|
|
model = YOLO("azaion.pt")
|
|
model.export(format="onnx", imgsz=1280, nms=True, batch=4)
|
|
netron.start('azaion.onnx')
|
|
```
|
|
Read carefully about [export arguments](https://docs.ultralytics.com/modes/export/), you have to use nms=True, and batching with a proper batch size
|
|
|
|
<h3>Install libs</h3>
|
|
https://www.python.org/downloads/
|
|
|
|
Windows
|
|
|
|
- [Install CUDA](https://developer.nvidia.com/cuda-12-1-0-download-archive)
|
|
|
|
Linux
|
|
```
|
|
sudo apt install nvidia-driver-535
|
|
|
|
wget https://developer.download.nvidia.com/compute/cudnn/9.2.0/local_installers/cudnn-local-repo-ubuntu2204-9.2.0_1.0-1_amd64.deb
|
|
sudo dpkg -i cudnn-local-repo-ubuntu2204-9.2.0_1.0-1_amd64.deb
|
|
|
|
sudo cp /var/cudnn-local-repo-ubuntu2204-9.2.0/cudnn-*-keyring.gpg /usr/share/keyrings/
|
|
sudo apt-get update
|
|
sudo apt-get -y install cudnn nvidia-cuda-toolkit -y
|
|
nvcc --version
|
|
```
|
|
|
|
|
|
<h3>Install dependencies</h3>
|
|
1. Install python with max version 3.11. Pytorch for now supports 3.11 max
|
|
|
|
Make sure that your virtual env is installed with links to the global python packages and headers, like this:
|
|
```
|
|
python -m venv --system-site-packages venv
|
|
```
|
|
This is crucial for the build because build needs Python.h header and other files.
|
|
|
|
```
|
|
python -m pip install --upgrade pip
|
|
pip install requirements.txt
|
|
pip install pyinstaller
|
|
|
|
```
|
|
In case of fbgemm.dll error (Windows specific):
|
|
|
|
- copypaste libomp140.x86_64.dll to C:\Windows\System32
|
|
|
|
|
|
<h3>Build</h3>
|
|
```
|
|
python setup.py build_ext --inplace
|
|
```
|
|
|
|
<h3>Build exe</h3>
|
|
```
|
|
.\build.cmd
|
|
```
|