Skip to content

Instantly share code, notes, and snippets.

View pqcfox's full-sized avatar

kat fox pqcfox

View GitHub Profile
@pqcfox
pqcfox / softer.py
Created November 16, 2018 09:41
Text detection for A Softer World comics (yes, really)
import cv2
import numpy as np
def belongs_to(contour, cluster):
for other in cluster:
x1, y1, w1, h1 = cv2.boundingRect(contour)
x2, y2, w2, h2 = cv2.boundingRect(other)
x_match = (abs(x2 - (x1 + w1)) < 40 or abs(x1 - (x2 + w2)) < 40)
y_match = (abs(y1 - y2) < 20)
@pqcfox
pqcfox / sat.py
Last active April 20, 2021 14:57
A tiny DPLL SAT solver in pure Python 🔬
"""sat.py: a simple DPLL SAT solver in pure python.
The API is designed to be as simple as possible:
>>> x = Var('x')
>>> y = Var('y')
>>> z = Var('z')
>>> DPLL([(x, y, z),
... (x, y, ~z),
... (x, ~y, z),
@pqcfox
pqcfox / lecture18.md
Last active June 11, 2018 23:08
Research Notes on Lecture 18

Since there weren't slides for the 5/30 lecture that I missed for the University Rover Challenge, I decided to delve further into the lectures of the following week. Specifically, there was a paper I'd found the morning before the lecture on further possible experimental findings from Fermilab regarding data suggesting the existence of sterile neutrinos, which can be found here.

The paper itself focuses around MiniBooNE, a neutrino tank designed for detecting neutrino mass by observing neutrino oscillations. This paper demonstrates an "excess of electron-like events" relative to how the standard model characterizes neutrino oscillation, matching that previously detected at the Liquid Scintillator Neutrino Detector. These data together hint at the existence of a possible fourth sterile neutrino; however, the paper makes clear that the data given still technically fit the standard oscillation model.

A "sterile" neutrino is one which only interacts with gravity. Since it do

@pqcfox
pqcfox / children.txt
Created June 7, 2018 02:25
ResNet50 child layers in PyTorch
0: Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
1: BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
2: ReLU(inplace)
3: MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False)
4: Sequential(
(0): Bottleneck(
(conv1): Conv2d(64, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
@pqcfox
pqcfox / baseline.txt
Created June 6, 2018 23:41
Baseline network logs
[TRAIN] Epoch 1/30, Batch 1/17, Loss: 8503.9794921875, Acc: 0.0
[TRAIN] Epoch 1/30, Batch 2/17, Loss: 7371.7607421875, Acc: 0.0
[TRAIN] Epoch 1/30, Batch 3/17, Loss: 5777.77197265625, Acc: 0.0
[TRAIN] Epoch 1/30, Batch 4/17, Loss: 4548.74658203125, Acc: 0.015625
[TRAIN] Epoch 1/30, Batch 5/17, Loss: 4026.79345703125, Acc: 0.0125
[TRAIN] Epoch 1/30, Batch 6/17, Loss: 3588.6357421875, Acc: 0.010416666666666666
[TRAIN] Epoch 1/30, Batch 7/17, Loss: 3293.489990234375, Acc: 0.008928571428571428
[TRAIN] Epoch 1/30, Batch 8/17, Loss: 3001.840087890625, Acc: 0.0078125
[TRAIN] Epoch 1/30, Batch 9/17, Loss: 2736.41552734375, Acc: 0.010416666666666666
[TRAIN] Epoch 1/30, Batch 10/17, Loss: 2515.69091796875, Acc: 0.021875
@pqcfox
pqcfox / section_paragraphs.md
Created May 26, 2018 04:35
Paragraphs for THINK 45 section

Week 7

One of the primary things that intrigued me about the content this week was that the string theory landscape results in a finite number of configurations. The number of $n$-manifolds for $n \geq 2$ should be infinite, as one should be able to construct a handlebody with an arbitrary number of handles. Thus there must be some restriction, i.e. some topological invariant that makes all but a fininte number of configurations unstable. Possibly more surprising is the possibility of an application of topology (grin).

Additionally, having taken some deep learning coursework, I do envy the theoretical possibility for our universe to tunnel between local minima--there'd be plenty of money and research saved had we figured out how to do that with loss functions on (classical) computers! In this vein, the existence of metastable vacuua as referenced here somewhat surprises me, given the rarity of local minima in high-dimensional loss functions (

@pqcfox
pqcfox / reading_response.md
Last active May 26, 2018 02:47
Week 8 reading response for THINK 45: Thinking About the Universe

1. Based on Lewis and Barnes, distinguish between the theoretical foundations and explanatory power of the multiverse as a result of chaotic inflation (not other ideas of a multiverse as explained succinctly by Ellis). In light of your distinction, characterize this version of the multiverse as either a physical or metaphysical construct. (Respond in 4-6 sentences.)

According to the theory of chaotic inflation, the existence of an inflaton field in the early universe would allow for the rapid expansion of spacetime. As space grew, small pockets would form that would branch off into other "bubble universes" in a massive fractal universe. There is indeed a mathematically-formulated theoretical foundation for this process, but unfortunately the only explaining power that it yields is the existence of other universes (yet to be confirmed by experimental evidence!), and not the variation of physical constants between them. Supplementary theories such as the KKLT mechanism are required for this.

Although chao

@pqcfox
pqcfox / nv_tegra_release
Created May 18, 2018 23:31
Jetson release stuff, yeet.
# R28 (release), REVISION: 1.0, GCID: 9379712, BOARD: t186ref, EABI: aarch64, DATE: Thu Jul 20 07:59:31 UTC 2017
7f8fb47183cbd3d4cacc5eb50fc7869aacdefe40 */usr/lib/aarch64-linux-gnu/libv4l/plugins/libv4l2_nvvideocodec.so
c33af0b5f9a88ab8ff62b31c16c635aa2744902d */usr/lib/aarch64-linux-gnu/libv4l/plugins/libv4l2_nvvidconv.so
678e42e35687f11c9b5b602a539a56cc3de1188f */usr/lib/aarch64-linux-gnu/tegra/libnvomx.so
ccecdd04fb3ef95308a25a96ccf6670310400ba1 */usr/lib/aarch64-linux-gnu/tegra/libnveglstreamproducer.so
1653e5d266b7b030dc882d226b03f0c0157b4f3a */usr/lib/aarch64-linux-gnu/tegra/libnvtx_helper.so
fc646aa1d227d10ee3c338373e721ffade0b36d5 */usr/lib/aarch64-linux-gnu/tegra/libnvddk_vic.so
c255aeebc742731b2a1e796816178b3b8ffa7dea */usr/lib/aarch64-linux-gnu/tegra/libglx.so
6cc4acdeee4908f9c4ff4f4dcfedef71be190354 */usr/lib/aarch64-linux-gnu/tegra/libargus_socketserver.so
5b66cf6e49430ca8918835a8ea287b51c8b3b941 */usr/lib/aarch64-linux-gnu/tegra/libnvmmlite.so
@pqcfox
pqcfox / grasp.py
Created May 18, 2018 06:30
A baseline grasp prediction model in PyTorch
import os
import re
import numpy as np
import shapely.geometry
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, models
@pqcfox
pqcfox / odscript_one.txt
Created May 5, 2018 02:08
Working OD files for the Rover
1000:00=393618 // 0x00060192
1001:00=0 // 0x00
1003:00=0 // 0x00
1005:00=128 // 0x00000080
1007:00=0 // 0x00000000
1008:00=C5-E-2-09
1009:00=W006
100A:00=FIR-v1650-B527540
100C:00=0 // 0x0000
100D:00=0 // 0x00