Skip to content

Instantly share code, notes, and snippets.

View l4rz's full-sized avatar

Mike K. l4rz

View GitHub Profile
from mtcnn import MTCNN
detector = MTCNN()
data = detector.detect_faces(cv.cvtColor(imq, cv.COLOR_BGR2RGB))
box = data[0]['box']
keypoints = data[0]['keypoints']
# first of all, eyes Y must be within certain % of face height
f_height = int(box[3] / 0.3 ) # height in px
@l4rz
l4rz / gist:130cbe40ba6e65a4c22ab1a0240f42c2
Created January 5, 2021 22:16
{vr ⋃/⋂ python} links
PyOpenVR?
https://github.com/cmbruns/pyopenvr
https://github.com/cmbruns/pyopenvr/blob/master/src/samples/glfw/hellovr_glfw.py
VR API for Python?
https://github.com/harfang3d
OpenCV VR Controllers
https://github.com/angrammenos97/OpenCV-VR-Controllers
import torch
import clip
from PIL import Image
from pathlib import Path
import random, sys, string
import shutil
import os
device = "cuda" if torch.cuda.is_available() else "cpu"
model, preprocess = clip.load("ViT-B/32", device=device)
@l4rz
l4rz / gist:7040835c3f8266d8b8ea3615a0b49494
Created February 25, 2021 18:35
ALEPH by @advadnoun but for local execution
#
# ALEPH by Advadnoun, https://colab.research.google.com/drive/1Q-TbYvASMPRMXCOQjkxxf72CXYjR_8Vp
# "This is a notebook that uses DALL-E's decoder and CLIP to generate images from text. I will very likely make this better & easier to use in the future."
#
# rearranged to run locally on faster GPU
#
# directions:
# clone https://github.com/openai/DALL-E/ and https://github.com/openai/CLIP
# copy relevant files into one dir with this script
# install torch==1.7.1 and other stuff
import copy
import os
import click
import numpy as np
import PIL.Image
import PIL.ImageOps
import torch
import dnnlib
import legacy
from tqdm import tqdm