Skip to content

Instantly share code, notes, and snippets.

View devymex's full-sized avatar

Devymex devymex

View GitHub Profile
@devymex
devymex / labelme_requirements.sh
Created February 17, 2021 12:22
requirements of labelme
apt install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 \
libxcb-render-util0 libxcb-shape0 libxcb-xfixes0 libxcb-xinerama0 \
libxcb-xkb1 libxkbcommon-x11-0 libgl1-mesa-glx fontconfig \
libfontconfig libfontconfig1 libfontconfig1-dev
python3 -m pip install pyyaml qtpy qtpy5 pyside2 imgviz termcolor requests
@devymex
devymex / renew_wifi_ip
Created March 23, 2021 04:49
Renew IP address of WIFI connection by DHCP
#!/bin/bash
WIFI_DEVICE=$(iw dev | grep Interface | head -n 1 | sed 's/.*Interface //')
sudo dhclient -r $WIFI_DEVICE
sudo dhclient $WIFI_DEVICE
@devymex
devymex / frame_player.py
Created April 28, 2021 07:33
play video frame by frame
#!/usr/bin/python3
import sys, cv2
video_file = sys.argv[1]
video = cv2.VideoCapture(video_file)
assert video.isOpened()
frame_cnt = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
def read_frame(pos):
@devymex
devymex / Dockerfile
Last active May 31, 2021 06:23
my dockerfile: nvidia/cuda:11.3.0-cudnn8-devel-ubuntu18.04
FROM nvidia/cuda:11.3.0-cudnn8-devel-ubuntu18.04
RUN mkdir -p /home/root
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils dialog
RUN apt install -y bash-completion locate vim tmux unzip htop
RUN apt install -y openssh-server # net-tools iputils-ping curl
RUN apt install -y build-essential pkg-config gdb git
RUN apt install -y libssl-dev libgoogle-glog-dev libgflags-dev
@devymex
devymex / run_devbase.sh
Last active June 15, 2021 03:06
Run an docker image as a container with public ssh port
#!/bin/bash -e
if [ $# -eq 0 ]; then
echo "Please specify an name for the new container!"
exit
fi
indices=""
for cid in $(docker container ls -a | sed 1,1d | awk '{print $1}'); do
port=$(docker inspect --format='{{if .NetworkSettings.Ports}}{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}{{else}}{{"null"}}{{end}}' $cid)
indices=$indices" "$port
@devymex
devymex / vswt_onnx_trt7.py
Created February 27, 2022 07:57
Exporting Video-Swin-Transformer to onnx for TensorRT 7.x
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as checkpoint
import numpy as np
import math
def drop_path(x, drop_prob: float = 0., training: bool = False, scale_by_keep: bool = True):
"""Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).
This is the same as the DropConnect impl I created for EfficientNet, etc networks, however,
@devymex
devymex / ctimer.hpp
Created April 1, 2022 16:50
high precision timer
/**
* Copyright (C) DeepGlint, Inc - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
*
* CTimer for Code Profile
*
* Written by Devymex <yumengwang@deepglint.com>, Jan. 2019
*/
@devymex
devymex / nvencoder.cpp
Created May 22, 2022 07:35
Video encoder with GPU
#include "NvEncoder/NvEncoderCuda.h"
#include "NvEncoder/NvEncoderCLIOptions.h"
#include "NvEncoder/NvCodecUtils.h"
#include <cuda_runtime.h>
extern "C" {
#include <libavutil/opt.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
}
@devymex
devymex / docker_cheetsheet.txt
Last active December 31, 2022 13:00
Docker Cheetsheet
下载镜像:
docker pull <IMAGE_NAME> # https://hub.docker.com/r/nvidia/cuda
列出所有镜像
docker images
运行镜像(运行为一个容器)
#!/bin/bash -e
export TOOLCHAIN_ROOT=/heop/.tool/toolchain/arm-ca9-linux-gnueabihf-6.5
export SYSROOT=$TOOLCHAIN_ROOT/arm-ca9-linux-gnueabihf/sysroot
export CC=$TOOLCHAIN_ROOT/bin/arm-linux-gcc
export CXX=$TOOLCHAIN_ROOT/bin/arm-linux-g++
export AR=$TOOLCHAIN_ROOT/bin/arm-linux-ar
export RANLIB=$TOOLCHAIN_ROOT/bin/arm-linux-ranlib
mkdir -p build