Skip to content

Instantly share code, notes, and snippets.

@adujardin
adujardin / for_sl_mat.cpp
Created June 22, 2022 08:47
Efficient CPU iterations over sl::Mat 32F and 8UC4
for (int y = 0; y < height; y++) {
// line pointer
float * ptr_disp = (float *) (disp.getPtr<uchar>(sl::MEM::CPU) + y * disp.getStepBytes(sl::MEM::CPU));
uchar4* ptr_image = (uchar4*) (img.getPtr<uchar>(sl::MEM::CPU) + y * img.getStepBytes(sl::MEM::CPU));
for (int x = 0; x < width; x++) {
float px_disp = ptr_disp[x];
uchar4 px = ptr_image[x];
}
}
@adujardin
adujardin / UnityPeopleSansPeople.md
Created June 2, 2022 11:56
Unity-Technologies/PeopleSansPeople for kp training
@adujardin
adujardin / mot17det_to_yolo.py
Last active May 5, 2022 08:23
MOTDet17 to Yolov5 (people class)
# wget https://motchallenge.net/data/MOT17Det.zip
# unzip MOT17Det.zip
# rm -rf MOT17Det/test/
import configparser
import os
import shutil
import numpy as np
def get_metadata_from_seqinfo(seqinfo_path):
@adujardin
adujardin / wifi_linux_driver.sh
Created December 13, 2021 14:55
wifi_linux_driver.sh
# from https://community.tp-link.com/en/home/forum/topic/208022
# tested on Ubuntu 20.04 with a TP-Link AC1300
git clone https://github.com/cilynx/rtl88x2bu.git
cd rtl88x2bu
VER=$(sed -n 's/\PACKAGE_VERSION="\(.*\)"/\1/p' dkms.conf)
sudo rsync -rvhP ./ /usr/src/rtl88x2bu-${VER}
sudo dkms add -m rtl88x2bu -v ${VER}
sudo dkms build -m rtl88x2bu -v ${VER}
sudo dkms install -m rtl88x2bu -v ${VER}
@adujardin
adujardin / config.toml
Last active September 12, 2024 17:30
Gitlab Runner NVIDIA Config
# This gitlab runner config provide full gpu support for a docker runner (including hw decoding etc)
# Requires gitlab runner >= 13.9 for 'gpus=all', can be 'runtime = "nvidia"' alternatively for older versions (not tested with NVIDIA_DRIVER_CAPABILITIES)
# Some other options may not be required such as 'privileged' but I needed it (for USB device access)
concurrent = 1
check_interval = 0
[[runners]]
name = "my_nvidia_runner"
url = <gitlab_url>
@adujardin
adujardin / alias.sh
Created September 17, 2021 13:54
Random zsh / bash alias
alias make='make -j$(nproc)'
alias m='cmake ..; make -j$(nproc)'
alias c='mkdir -p build; cd build; cmake ..; make -j$(nproc)'
alias b='mkdir -p build; cd build; cmake .. -G Ninja; ninja'
alias magicmerge='git merge -s recursive -Xignore-space-at-eol'
alias gsa='git submodule add '
alias dock='docker run -it --privileged --gpus all -e NVIDIA_DRIVER_CAPABILITIES=all -v /:/host --network=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix '
@adujardin
adujardin / setup_zed_udev-rules.sh
Last active March 11, 2025 17:26
Setup the udev rules for the ZED cameras
# This script will setup USB rules to open the ZED cameras without root access
# This can also be useful to access the cameras from a docker container without root (this script needs to be run on the host)
# NB: Running the ZED SDK installer will already setup those
# Print the commands
set -x
# Download the lightest installer
wget -q https://download.stereolabs.com/zedsdk/3.5/jp44/jetsons -O zed_installer.run
# Extracting only the file we're interested in
bash ./zed_installer.run --tar -x './99-slabs.rules' > /dev/null 2>&1
@adujardin
adujardin / Dockerfile
Created July 12, 2021 13:06
Windows docker VCTools 2019
# escape=`
# References:
# https://docs.microsoft.com/en-us/visualstudio/install/build-tools-container?view=vs-2019
# https://github.com/microsoft/vs-dockerfiles/blob/main/native-desktop/Dockerfile
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]
@adujardin
adujardin / ucf_crimes_custom_to_mmaction2.py
Created May 10, 2021 15:43
Creating label for mmaction2 for a custom dataset
# Goal is to convert this dataset into a mmaction2 friendly one (VideoDataset)
# https://github.com/open-mmlab/mmaction2/blob/master/docs/tutorials/3_new_dataset.md
import os
import random
output="ucf_crimes_custom"
output_ext="_list.txt"
ratio_train=0.8
output_list=[]
@adujardin
adujardin / imgs_seq_to_mp4
Created May 4, 2021 12:50
Create mp4 video from image sequence (in all directories in the same folder)
dest="/foo/bar"
curr="/foo/bar2/"
mkdir "${dest}"
dirs=($(find . -type d))
for dir in "${dirs[@]}"; do
echo "========================="
echo $dir
cd "${curr}${dir}"
pwd