Skip to content

Instantly share code, notes, and snippets.

View ekarad1um's full-sized avatar
๐ŸŒƒ
the odyssey to the enigmatic and inscrutable

Eka ekarad1um

๐ŸŒƒ
the odyssey to the enigmatic and inscrutable
  • world.execute(me);
View GitHub Profile
@ekarad1um
ekarad1um / opencv-tutorial-transparent-mask-overlay-to-recognized-faces.md
Last active January 24, 2020 15:46
OpenCV Tutorial transparent mask overlay to recognized faces

As the death toll from the Wuhan coronavirus still risen, I felt anxious and helpless through everyone here were talking and laughing on New Year's Eve. Not sure what should I do and I just wrote this python3 program to make people aware of the importance of wearing respirator masks when defeating the virus.

In this program, we use CascadeClassifier to add respirators masks to the recognized faces in the capture. Before everything start, we have to import the necessary packages:

import argparse
import cv2

We use argparse to construct the argument parse for more flexible usage. The respirator image cloud be found on eBay, Google... and transparent background required as .png format. The haarcascade_frontalface_default.xml could be found at OpenCV official git repository https://github.com/opencv/opencv/tree/master/data/haarcascade.

@ekarad1um
ekarad1um / build-pytorch-and-pytorch-vision.md
Created February 3, 2020 05:43
Build PyTorch and PyTorch Vision
  • Install dependencies
sudo apt-get install -y libopenblas-dev libblas-dev m4 cmake cython python3-dev python3-yaml python3-setuptools libavutil-dev libavcodec-dev libavformat-dev libswscale-dev
  • Build PyTorch from the source
git clone --recursive https://github.com/pytorch/pytorch
pushd pytorch
git submodule update --remote third_party/protobuf
@ekarad1um
ekarad1um / migration.md
Last active May 8, 2021 11:37
Migration

I migrated my gist to my website:

  • WebSite https://unbinilium.github.io/
@ekarad1um
ekarad1um / mnist_onnx_inferring.hpp
Last active March 2, 2022 05:26
MNIST ONNX inferring using OpenCV DNN
#pragma once
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <opencv2/core.hpp>
#include <opencv2/dnn.hpp>
#include <opencv2/imgproc.hpp>
@ekarad1um
ekarad1um / data_2_mnist.py
Created February 27, 2022 06:47
Datasets to MNIST
#!/usr/bin/env python3
import os, argparse, secrets
import numpy as np
from array import *
from pathlib import Path
from PIL import Image
def data_2_mnist(data_folder:Path, img_size:int, output_folder:Path):
print("Dataset folder ->", data_folder)
@ekarad1um
ekarad1um / torch_mnist_inferring.hpp
Last active March 2, 2022 05:25
Inferring MNIST Torchscript model
#pragma once
#include <string>
#include <vector>
#include <utility>
#include <torch/torch.h>
#include <torch/script.h>
#include <opencv2/core.hpp>
@ekarad1um
ekarad1um / mnist_2_pt.ipynb
Created February 28, 2022 15:10
Create Torch Script Model from MNIST
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ekarad1um
ekarad1um / engine.hpp
Last active November 21, 2024 06:16
Hailo RT SDK example
#pragma once
#include <hailo/hailort.hpp>
#include <chrono>
#include <future>
#include <iostream>
#include <mutex>
#include <string>
#include <string_view>
@ekarad1um
ekarad1um / ring_buffer.hpp
Last active July 17, 2025 11:33
SPSC RingBuffer
#pragma once
#ifndef RING_BUFFER_HPP
#define RING_BUFFER_HPP
#include "logger.hpp"
#include <atomic>
#include <cmath>
#include <cstddef>
#include <cstdint>
// JSerializer - An exceptionally fast, stream-oriented, header-only C++ JSON serialization library.
// MIT License Copyright (c) 2025 Unbinilium
#pragma once
#ifndef JSERIALIZER_HPP
#define JSERIALIZER_HPP
#include <array>
#include <cerrno>
#include <charconv>