Skip to content

Instantly share code, notes, and snippets.

Avatar

Nikolai Poliarnyi PolarNick239

View GitHub Profile
View qr_rq_decompositions_2x3_matrix.py
import numpy as np
import scipy
import scipy.linalg
def ensure_close(P, A):
eps = np.max(np.abs(P)) * 10e-10
assert(np.max(np.abs(P - A)) <= eps)
def qr_decomposition_np(A):
Q, R = np.linalg.qr(A)
@PolarNick239
PolarNick239 / DeepForest_Cars.ipynb
Created Jul 7, 2021
DeepForest experiments with Cars detection on Dortmund dataset
View DeepForest_Cars.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PolarNick239
PolarNick239 / buildOCV.sh
Created Feb 13, 2021
buildOCV.sh + CLion workaround for OpenCV
View buildOCV.sh
#!/bin/bash -e
# Adopted from https://docs.opencv.org/master/d3/d52/tutorial_windows_install.html
#
# Changes:
# - version fixed to 4.5.1 - https://github.com/opencv/opencv/releases/tag/4.5.1
# - disabled opencv_contrib
# - RelWithDebInfo instead of Release
#
# How to use:
@PolarNick239
PolarNick239 / morton_code.h
Last active Sep 27, 2019
96-bit 3D Morton code (Z-curve)
View morton_code.h
#pragma once
#include <limits>
#include <cassert>
#include <stdexcept>
#define MORTON_CODE_MAX_LEVEL 32
#define UINT8 unsigned char
#define UINT32 unsigned int
@PolarNick239
PolarNick239 / CMakeLists.txt
Created May 27, 2019
Optical flow video tracking with per-triplet consistency check, using calcOpticalFlowFarneback from OpenCV
View CMakeLists.txt
cmake_minimum_required(VERSION 3.13)
project(video_optflow)
set(CMAKE_CXX_STANDARD 14)
find_package(OpenMP)
if (OpenMP_CXX_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
else()
View monitor_app.py
import os
import time
def get_memory(key="total"):
key_to_index = {
"total": 1,
"used": 2,
"free": 3,
"shared": 4,
View Main.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static javax.swing.WindowConstants.EXIT_ON_CLOSE;
public class Main {
public static void main(String[] args) throws InterruptedException {
View monitor.py
import os
import time
import subprocess
from collections import namedtuple
def get_memory(key="total"):
# See https://doeidoei.wordpress.com/2009/03/22/python-tip-3-checking-available-ram-with-python/
if os.name == "posix":
@PolarNick239
PolarNick239 / opencl_clion_defines.cpp
Created Jul 19, 2018
Defines for better OpenCL support in CLion
View opencl_clion_defines.cpp
#ifndef clion_defines_cl // pragma once
#define clion_defines_cl
#ifdef __CLION_IDE__
#define __kernel
#define __global
#define __local
#define __constant
#define __private