Skip to content

Instantly share code, notes, and snippets.

View neale's full-sized avatar
🧶
zen

Neale Ratzlaff neale

🧶
zen
View GitHub Profile
@neale
neale / perlin_forward_warp.py
Created August 7, 2022 20:26
Perlin noise image augmentation
import sys
import numpy as np
import cv2
from perlin_noise import PerlinNoise
import glob
def vector_field(x, y, noise, scale=0.01, w=100):
noise_x = w * noise([scale*x, scale*y])
noise_y = w * noise([100+scale*x, scale*y])
return noise_x, noise_y
@neale
neale / Dockerfile
Created June 13, 2018 01:22
hdl_graph_slam indigo dockerfile
FROM ros:indigo
RUN apt-get update
RUN apt-get install -y
RUN apt-get install -y wget nano build-essential vim curl
RUN apt-get install -y ros-indigo-geodesy ros-indigo-pcl-ros ros-indigo-nmea-msgs
RUN apt-get install build-essential
RUN wget http://www.cmake.org/files/v3.2/cmake-3.2.2.tar.gz
RUN tar xf cmake-3.2.2.tar.gz
@neale
neale / plot_trajectory.py
Last active June 12, 2023 16:52
plot 3D trajectory from csv with xyz coordinates
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d.axes3d as p3
import matplotlib.animation as animation
import pandas as pd
from sys import exit
def update_lines(num, data, line):
# NOTE: there is no .set_data() for 3 dim data...
line.set_data(data[0:2, :num])
line.set_3d_properties(data[2, :num])
@neale
neale / ros_parse.py
Created May 29, 2018 17:42
Parse ROS odometry output to (xyz) csv file
import re
import csv
def get_n(string):
return re.findall(r"[-+]?\d*\.\d+|\d+", string)
lines = []
with open('coordsOut.txt', 'r') as f:
@neale
neale / bbox_crop.py
Created May 9, 2018 05:54
Bbox Cropping Tool - Cycle through images in directory, crop and save ROIs
import numpy as np
import cv2, os, sys, getopt
from glob import glob
import natsort
# Global Variables
helpMessage = 'Usage:\n\tcrop.py <command> [argument]\n\nCommands:\n\t-h --help\t\tDisplay this help message\n\t-i --image [path]\tInput image\n\t-f --folder [path]\tImage Folder\n\t-r --regex [regex]\tNaming of output files [WIP]\n\t-s --save [path]\tPath to Save'
# Arguments
@neale
neale / min_test.py
Last active January 12, 2018 23:27
lbfgs_test
import foolbox
import keras
import numpy
from keras.applications.resnet50 import ResNet50
import matplotlib.pyplot as plt
import scipy.misc
# instantiate model
keras.backend.set_learning_phase(0)
kmodel = ResNet50(weights='imagenet')
name: "CNN"
input: "data"
input_shape {
dim: 1
dim: 3
dim: 224
dim: 224
}
layer {
@neale
neale / a4c.py
Created March 21, 2017 19:46
stacked A4C
class A4C(torch.nn.Module):
def __init__(self, input, n_actions):
""" Standard recurrent A3C """
self.conv1 = nn.Conv2d(input, 32, 3, stride=2, padding=1)
self.conv2 = nn.Conv2d(32, 32, 3, stride=2, padding=1)
self.conv3 = nn.Conv2d(32, 32, 3, stride=2, padding=1)
self.conv4 = nn.Conv2d(32, 32, 3, stride=2, padding=1)
self.lstm = StackedLSTM(2, 256, 256, dropout=.5)
name: "ResNet-152"
input: "data"
input_shape {
dim: 1
dim: 3
dim: 224
dim: 224
}
layer {
bottom: "data"
net: "models/darkvgg/train_test.prototxt"
test_iter: 1000
test_interval: 5000
base_lr: 0.0005
lr_policy: "inv"
gamma: 0.0001
power: 0.75
display: 200
max_iter: 450000
momentum: 0.0