Data sent via websocket to Unreal Engine
There are two main scripts to this repo:
- objectDetectionGPU1cam_ZMQ_IMUUE.py
- ZMQ_UEwebSocket_sleep.py
objectDetectionGPU1cam_ZMQ_IMUUE.py
is to start up the recognition system. It requires a ZED camera, ZED API and YOLO v8. You can switch the YOLOv8 model for your own custom YOLO model.
ZMQ_UEwebSocket_sleep.py
is a webocket server that sends out the recognition data to Unreal Engine via websocket.
There's a third file. ZMQ_UEwebSocket_clientTest.py
, this is just a simple websocket client testing script to check the stability of the websocket server.
1st objectDetectionGPU1cam_ZMQ_IMUUE.py
2nd ZMQ_UEwebSocket_sleep.py
- add the requirement.txt to the repo (remove from gitignore)
- rename files for easier understanding
- create a .bat to startup both main files (remove from gitignore)
I strongly suggest to use ZED cameras and ZED API with windows 11 or Linux. Otherwise, you'll have to do the below steps for Windows 10.
Works with CUDA 11.7 and 11.8 (tested)
You need to use Anaconda.
- Install the ZED SDK 4.0+
- Create an Python 3.7 environment
- Open Conda Terminal
- CD to your project folder
- Run the get_python_api.py from this folder with OpenVPN connection
- Close Conda Terminal
- Copy the build 'sl.cp37-win_amd64.pyd' from the src build folder in the ZED ZED_API_installation folder on the D: Drive to your version of: C:\Users\remko\anaconda3\envs\ZED5gpu_env\Lib\site-packages\pyzed
- Yes replace the existing one.
- Copy all the .dll files from C:\Program Files (x86)\ZED SDK\bin to your version of: C:\Users\remko\anaconda3\envs\ZED5gpu_env\Lib\site-packages\pyzed
- Go back to Anaconda Navigator and update Index on the environment you created
- Open the Conda Terminal
- Launch VSCode via Code . or from within Anaconda Navigator. Both work, but you may have to resign in to your plug-ins if you use the one from Anaconda Navigator.
- Make sure you're using the correct python interpreter inside of VSCode. Check the bottom VSCode.
Note: If you don’t have the already built 'sl.cp37-win_amd64.pyd' from the src build folder in the ZED ZED_API_installation folder on the D: Drive. Then you can rebuild it, following the instructions below.
- Copy the original sl.cp37-win_amd64.pyd file from your version of:
C:\Users\remko\anaconda3\envs\ZED5gpu_env\Lib\site-packages\pyzed
to your just downloaded and unzipped version of:D:\Development\ZED_API_installation\zed-python-api-4.0\src\pyzed
- Install Cython inside your python environment and a C++ Compiler: If you don’t have Cython installed, you can install it using pip:
pip install Cython
Additionally, you will need a C++ compiler. Since you are on Windows, you can install Visual Studio with C++ support.
- Build the Extension: Now, open a command prompt in the root of your project directory where
setup.py
is located. Then run the following command to build the extension:
python setup.py build_ext --inplace
This command tells setup.py
to build the extension in place, which means the compiled .pyd
file will be created in the current directory.
You can find the GitHub repo to the Cython Extension API build here:
After installing the regular version of ZED API and doing all the necessary changes.
You need to install pytorch version with 11.7 CUDA. It doesn’t come with installer script. It’s an additional installation.
conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia
That should do it. Update index within Anaconda Navigator, and always run Anaconda prompt as administrator
Download the necessary models for YOLOv8
- yolov8m.pt