Skip to content

Instantly share code, notes, and snippets.

View l4rz's full-sized avatar

Mike K. l4rz

View GitHub Profile
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
@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 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: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
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
MVP: a digit recognition neural network, trained on MNIST dataset
https://medium.com/swlh/a-hello-world-into-image-recognition-with-mnist-eb9b91520db4
---
Simple neural network implementation in C:
https://towardsdatascience.com/simple-neural-network-implementation-in-c-663f51447547
(complete code: https://gist.github.com/espiritusanti/b7485c68a06ef2c8c76d8c62c8c39d8f)
Simple MLP Backpropagation Artificial Neural Network in C++ (Step by Step):
NAME NETWORK DEST_RANGE NEXT_HOP PRIORITY
default-route-042574ab739c3f72 default 10.156.0.0/20 default 1000
default-route-0b9f1e6146c66b11 default 10.140.0.0/20 default 1000
default-route-0d5055943aa5804a l4rz-euw4a-vpc2 10.3.128.0/20 l4rz-euw4a-vpc2 1000
default-route-11daac8c62e1b09f default 10.178.0.0/20 default 1000
default-route-1263525c16e385d7 default 0.0.0.0/0 default-internet-gateway 1000
default-route-185877d5235de021 default 10.174.0.0/20 default 1000
default-route-185a79c4e35ea184 default 10.154.0.0/20 default 1000
default-route-236922f973f32b70 default 10.150.0.0/20 default 1000
default-route-28399d4aa129dc68 default 10.168.0.0/20 default 1000
[
{
"creationTimestamp": "2020-03-30T14:06:46.377-07:00",
"description": "Default local route to the subnetwork 10.156.0.0/20.",
"destRange": "10.156.0.0/20",
"id": "7426702127196529033",
"kind": "compute#route",
"name": "default-route-042574ab739c3f72",
"network": "https://www.googleapis.com/compute/v1/projects/utility-grin-272721/global/networks/default",
"nextHopNetwork": "https://www.googleapis.com/compute/v1/projects/utility-grin-272721/global/networks/default",
NAME SUBNET_MODE BGP_ROUTING_MODE IPV4_RANGE GATEWAY_IPV4
default AUTO REGIONAL
l4rz-euw4a-vpc CUSTOM REGIONAL
l4rz-euw4a-vpc2 CUSTOM REGIONAL
l4rz-euw4a-vpc3 CUSTOM REGIONAL
[
{
"autoCreateSubnetworks": true,
"creationTimestamp": "2020-03-30T14:06:23.515-07:00",
"description": "Default network for the project",
"id": "6532364033498014112",
"kind": "compute#network",
"name": "default",
"routingConfig": {
"routingMode": "REGIONAL"