Player detection is a ROS node that takes images and detects whether a T or CT player model from CS:GO is present. We prioritize detection on GPU (supports both nVidia and AMD) and falls back on CPU if no CUDA devices are found.
screen_msgis the image topic we subscribe to for detections.vizis a flag dictating whether we want to visualize our detections via publishing an annotated image.weights_diris the path to the directory where we load our NN weights.ratedoesn't do anything for now, we publish immediately in the callback function.
TODO:
- Set up publishing at a set rate.
After you clone the repo, make sure to clone the submodule as well. Documentation here
After that you have two options:
- Run locally (for nVidia and CPU)
- Run via docker (for AMD)
Simply launch our node the usual ROS way. Remember to source devel/setup.bash first.
roslaunch player_detection detect.launch weights_dir:=$(rospack find player_detection)/include/Sequoia/
The node will by default look for a CUDA device and will fall back to CPU if not present. The dockerfile extends ROCm pytorch image so AMD devices are supported as well. For a full list of supported devices, visit the ROCm docs
To build dockerfile:
sudo docker build -f ./Dockerfile -t csgo_bot/player_detection .
To run the node within the docker container:
sudo docker run -it --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --device=/dev/kfd --device=/dev/dri --group-add video --ipc=host --shm-size 8G \
--mount type=bind,source="$(rospack find player_detection)",target=/ws/src/player_detection \
--network host \
csgo_bot/player_detection:latest ./setup.sh --run
To start the container only, run without ./setup.sh --run. On entry, source setup.sh. This will catkin_make and source devel/setup.bash.
I'm using a Ryzen 7 5900X with 64Gb DDR4-3600 cl 18 and a RX 6800XT. I'm feeding image data published from my screencap node, which caps at 84 fps.
According to rostopic hz, we detect at around 70-75hz for publishing rate when detecting on GPU with visualization off. I'm sure it can go higher if I offload the screencap node to a different device.
With visualization on, the rate drops to around 50-55hz.
This package would not be possible without the help of Igor Rocha. The player detection node relies on his project Sequoia, which is a CS:GO player detector.