Skip to content

Instantly share code, notes, and snippets.

View InputBlackBoxOutput's full-sized avatar
🐮

Rutuparn Pawar InputBlackBoxOutput

🐮
  • Boston, MA
View GitHub Profile
@InputBlackBoxOutput
InputBlackBoxOutput / json2yolo.py
Created March 23, 2022 10:09
labelImg: Convert annotations in JSON to YOLO format
import glob
import json
import cv2
LUT = {"class0": 0, "class1": 1, "class2": 2}
for each_file in glob.glob("data/*.json"):
with open(each_file) as json_file:
data = json.load(json_file)[0]
@InputBlackBoxOutput
InputBlackBoxOutput / pose.html
Created February 5, 2022 07:25
Mediapipe: Pose
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Pose</title>
<script
src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils@0.1/camera_utils.js"
crossorigin="anonymous"
></script>
<script
@InputBlackBoxOutput
InputBlackBoxOutput / holistic.html
Created February 5, 2022 07:25
Mediapipe: Holistic
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Holistic</title>
<script
src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils@0.1/camera_utils.js"
crossorigin="anonymous"
></script>
<script
@InputBlackBoxOutput
InputBlackBoxOutput / hands.html
Created February 5, 2022 07:24
Mediapipe: Hands
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Hands</title>
<script
src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils@0.1/camera_utils.js"
crossorigin="anonymous"
></script>
<script
@InputBlackBoxOutput
InputBlackBoxOutput / face-mesh.html
Created February 5, 2022 07:23
Mediapipe: Face Mesh
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Face mesh</title>
<script
src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils@0.1/camera_utils.js"
crossorigin="anonymous"
></script>
<script
@InputBlackBoxOutput
InputBlackBoxOutput / face-detection.html
Created February 5, 2022 07:23
Mediapipe: Face detection
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Face detection</title>
<script
src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils@0.1/camera_utils.js"
crossorigin="anonymous"
></script>
<script
@InputBlackBoxOutput
InputBlackBoxOutput / segmentation.py
Created January 22, 2022 13:14
Perform skin segmentation by combining masks obtained by thresholding an image using multipe colour models
# Perform skin segmentation by combining masks obtained by thresholding an image using multipe colour models
# Modified from source: https://medium.com/swlh/human-skin-color-classification-using-the-threshold-classifier-rgb-ycbcr-hsv-python-code-d34d51febdf8
import cv2
import numpy as np
import matplotlib.pyplot as plt
def generate_RGB_mask(img):
B_Frame, G_Frame, R_Frame = [img[..., BGR] for BGR in range(3)]
@InputBlackBoxOutput
InputBlackBoxOutput / main.py
Last active January 29, 2022 04:46
Channel routing using the Left edge algorithm
from router import router, plotter
# A = ['0', 'A', 'D', 'E', 'A', 'F', 'G', '0', 'D', 'I', 'J', 'J']
# B = ['B', 'C', 'E', 'C', 'E', 'B', 'F', 'H', 'I', 'H', 'G', 'I']
# A = ['A', '0', 'B', 'C']
# B = ['A', 'B', '0', 'C']
# A = ['N1', '0', 'N2', 'N3']
@InputBlackBoxOutput
InputBlackBoxOutput / yosys.py
Created January 5, 2022 13:07
Python wrapper for Yosys
import os, re, subprocess, json
class Yosys:
def __init__(self, path):
self.yosys = subprocess.Popen(
[path, '-Q', '-T'], universal_newlines=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE
)
def process(self, filepath, save=False):
if not os.path.isfile(filepath):
@InputBlackBoxOutput
InputBlackBoxOutput / image-utils.py
Created October 18, 2021 10:37
Functions to save and show an image in IPYNB notebooks
import matplotlib.pyplot as plt
def save_image(img, filename="image.png"):
plt.plot(), plt.imshow(img)
plt.xticks([]), plt.yticks([])
plt.axes("off")
plt.savefig(filename)
def show_image(img, title="title"):
plt.plot(), plt.imshow(img)