Skip to content

Instantly share code, notes, and snippets.

View chexov's full-sized avatar

Anton P. Linevich chexov

  • Los Angeles
View GitHub Profile
@chexov
chexov / h5test.py
Last active March 30, 2018 13:24
create HDF5 dataset
# coding: utf-8
import cv2
import h5py
import numpy
img = cv2.imread('/Users/chexov/opencv-lena.jpg', 1)
f = h5py.File('test2.hdf5', mode='w')
group = f.create_group("images")
@chexov
chexov / create_vec_samples.sh
Created March 21, 2018 14:55
Train HAAR like classifier. opencv 3.3.1 [opencv_createsamples]
export OPENCV_OPENCL_RUNTIME=""
find positives/ -type f | \
xargs -P 8 -n 1 -INAME opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 80 -h 40 -img 'NAME' -bg ./negs/negatives.txt -vec samples/NAME.vec -num 1
wget 'https://raw.githubusercontent.com/wulfebw/mergevec/master/mergevec.py'
python mergevec.py -v ./samples/cuts/ -o samples.vec
OPENCV_OPENCL_RUNTIME=NVIDIA:GPU:1 opencv_traincascade -data classifier -vec samples.vec -bg negs/negatives.txt -numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 70000 -numNeg 78678 -w 80 -h 40 -mode ALL -precalcValBufSize 1024 -precalcIdxBufSize 1024
@chexov
chexov / Tensorflow_Build_GPU.md
Created December 11, 2017 23:54 — forked from smitshilu/Tensorflow_Build_GPU.md
Tensorflow 1.4 Mac OS High Sierra 10.13 GPU Support

Tensorflow

System information

  • OS - High Sierra 10.13
  • Tensorflow - 1.4
  • Xcode command line tools - 8.2 (Download from here: Xcode - Support - Apple Developer & Switch to different clang version: sudo xcode-select --switch/Library/Developer/CommandLineTools & check version: clang -v)
  • Cmake - 3.7
  • Bazel - 0.7.0
@chexov
chexov / dnn-cuda-ubuntu.sh
Last active March 23, 2018 14:53
install cuda and nvidia drivers into ubuntu
#!/bin/sh
NVIDIA_GPGKEY_SUM=d1be581509378368edeec8c1eb2958702feedf3bc3d17011adbf24efacce4ab5 && \
NVIDIA_GPGKEY_FPR=ae09fe4bbd223a84b2ccfce3f60f4b3d7fa2af80 && \
apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub && \
apt-key adv --export --no-emit-version -a $NVIDIA_GPGKEY_FPR | tail -n +5 > cudasign.pub && \
echo "$NVIDIA_GPGKEY_SUM cudasign.pub" | sha256sum -c --strict - && rm cudasign.pub
echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 /" > /etc/apt/sources.list.d/cuda.list
echo "deb http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/ /" > /etc/apt/sources.list.d/nvidia-machine-learning.list
@chexov
chexov / Hex.java
Created November 16, 2017 17:04
apache commons-codec class Hex for Android (just put it into your project)
```
Just put it into your code and import like this
import android.org.apache.commons.codec.binary.Hex;
```
package android.org.apache.commons.codec.binary;
import java.nio.charset.Charset;
@chexov
chexov / hhmmss.js
Created June 19, 2017 20:00
get you Date() into hhmmss.msec
var zeroPad2 = function (n) {
var _n = n + "";
if (_n.length < 2) {
return "0" + _n;
} else {
return _n;
}
};
var zeroPad = function (n, width) {
var z = "0";
@chexov
chexov / mvn-release.md
Last active September 28, 2023 11:55
Maven release plugin oneliners

Maven release plugin cheat sheet

Perform release dry run

During the dry run and again during the release proper you will be prompted for version information. The release plugin will attempt to guess the release, tag and snapshot versions. You can accept the values as is or supply your own.

mvn release:prepare -DdryRun=true

@chexov
chexov / web-servers.md
Created March 17, 2017 09:15 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@chexov
chexov / cudalxc.md
Last active August 29, 2017 01:02
lxc 2 passthrough nvidia cuda

GPU as profile

lxc profile create gpu
lxc profile device add gpu /dev/nvidia0 unix-char path=/dev/nvidia0
lxc profile device add gpu /dev/nvidia1 unix-char path=/dev/nvidia1
lxc profile device add gpu /dev/nvidiactl unix-char path=/dev/nvidiactl
lxc profile device add gpu /dev/nvidia-uvm unix-char path=/dev/nvidia-uvm
lxc profile device add gpu  /dev/nvidia-uvm-tools unix-char path=/dev/nvidia-uvm-tools

lxc profile assign modelAgency default,gpu
@chexov
chexov / ubuntu-teamcity-server.yml
Created October 28, 2016 15:03
ubuntu-teamcity-server cloud-init
#cloud-config
apt_sources:
- source: "ppa:webupd8team/java"
package_upgrade: true
package_update: true
packages:
- mysql-server
- apache2-utils