Skip to content

Instantly share code, notes, and snippets.

View Denbergvanthijs's full-sized avatar
:fishsticks:

Thijs van den Berg Denbergvanthijs

:fishsticks:
View GitHub Profile
@Denbergvanthijs
Denbergvanthijs / yolov8.py
Created April 15, 2024 09:22
MVP for YOLOv8 Nano with webcam on CPU
from collections import defaultdict
import cv2
import numpy as np
from ultralytics import YOLO
from ultralytics.utils.plotting import Annotator, colors
# Based on "YOLOv8 Multi-Object Tracking in Videos" notebook of https://github.com/ultralytics/ultralytics
# Instal Dependencies in the command line (CMD):
# pip install ultralytics
@Denbergvanthijs
Denbergvanthijs / game_of_life_keras.py
Last active April 13, 2024 12:44
Conway's Game of Life using a neural network with Keras and Tensorflow in Python
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from matplotlib.animation import FuncAnimation
from tensorflow.keras.layers import Conv2D, InputLayer, Layer
from tensorflow.keras.models import Sequential
size = 128
n_frames = 240
full_size = (1, size, size, 1)
@Denbergvanthijs
Denbergvanthijs / donut.py
Last active April 28, 2024 16:21
3D spinning donut in Python. Based on the pseudocode from: https://www.a1k0n.net/2011/07/20/donut-math.html
import numpy as np
screen_size = 40
theta_spacing = 0.07
phi_spacing = 0.02
illumination = np.fromiter(".,-~:;=!*#$@", dtype="<U1")
A = 1
B = 1
R1 = 1