Skip to content

Instantly share code, notes, and snippets.

@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 September 1, 2025 07:37
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
@adujardin
adujardin / crowdhuman_to_yolo.py
Last active July 22, 2024 09:21
Convert CrowdHuman dataset to Yolo (v5) annotations
"""
Based on https://raw.githubusercontent.com/jkjung-avt/yolov4_crowdhuman/master/data/gen_txts.py
Inputs:
* nothing
* or folder with CrowdHuman_train01.zip, CrowdHuman_train02.zip, CrowdHuman_train03.zip, CrowdHuman_val.zip, annotation_train.odgt, annotation_val.odgt
python crowdhuman_to_yolo.py --dataset_path foo/bar/
Outputs:
@adujardin
adujardin / yolov5_val.sh
Last active July 18, 2022 11:55
Yolov5 accuracy test
#docker run --gpus=all -it -v /:/host/ nvcr.io/nvidia/pytorch:22.02-py3
host_folder="/host/tmp/yolov5_results.txt"
rm ${host_folder}
git clone https://github.com/ultralytics/yolov5
cd yolov5
pip install -qr requirements.txt
rm requirements.txt
pip uninstall opencv-python
pip install opencv-python-headless==4.4.0.40 ujson
@adujardin
adujardin / decode.py
Created March 31, 2021 14:25
Decoding example of ORStereo dataset GT disparity https://theairlab.org/orstereo/ from PNG 4 uint8 packed, into f32 disparity
import cv2
import numpy as np
disp_u8c4 = cv2.imread("IROS_ORStereo_4K/FoV60/CoalMine/disparity/000002_disp_lu1.png", cv2.IMREAD_UNCHANGED)
disp_gt_f32 = disp_u8c4.view(dtype=np.float32)
@adujardin
adujardin / test_pyzed_availability.sh
Last active March 30, 2021 14:31
Small script to check if the python wrapper of the ZED SDK is available for all config (lot of hardcoded stuff)
ZED_SDK_VERSION="3.5"
URL_base="https://download.stereolabs.com/zedsdk/${ZED_SDK_VERSION}/"
URL_BUCKET="https://stereolabs.sfo2.digitaloceanspaces.com/zedsdk"
#URL_BUCKET="https://stereolabs.sfo2.cdn.digitaloceanspaces.com/zedsdk"
check_HTTP_err_code() {
http_err=$(curl -I -s -o /dev/null -w "%{http_code}" $1)
if [ "$http_err" != "200" ] && [ "$http_err" != "302" ]; then
echo "ERROR: $http_err -> $1"
fi