Skip to content

Instantly share code, notes, and snippets.

View kentsommer's full-sized avatar
💭
I may be slow to respond.

Kent Sommer kentsommer

💭
I may be slow to respond.
View GitHub Profile
@kentsommer
kentsommer / find_velo.sh
Created June 25, 2018 03:25
Find velodyne IP
read -p 'Ethernet device to use (can find with ifconfig): ' ethdev
sudo tcpdump -i $ethdev port 2368 -n | awk '{ print gensub(/(.*)\..*/,"\\1","g",$3), $4, gensub(/(.*)\..*/,"\\1","g",$5) }' | cut -d ' ' -f1

Keybase proof

I hereby claim:

  • I am kentsommer on github.
  • I am kentsommer (https://keybase.io/kentsommer) on keybase.
  • I have a public key ASDq1kE3OCWdypuzymWKSK1Gx696Q1oK7TfJN2RlaJzoWAo

To claim this, I am signing this object:

@kentsommer
kentsommer / pacman_model.py
Created August 21, 2017 05:55
I2A Pacman Model
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from torch.nn.parameter import Parameter
# Pool and Inject Module
#include <pcl/io/pcd_io.h>
#include <pcl/sample_consensus/method_types.h>
#include <pcl/sample_consensus/model_types.h>
#include <pcl/segmentation/sac_segmentation.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/surface/convex_hull.h>
#include <pcl/segmentation/extract_polygonal_prism_data.h>
#include <pcl/visualization/cloud_viewer.h>
#include <iostream>
@kentsommer
kentsommer / CMakeLists.txt
Created August 21, 2017 03:56
extract build
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(TABLETOP_EXTRACTION)
find_package(PCL REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable(extract extract.cpp)
target_link_libraries(extract ${PCL_LIBRARIES})
@kentsommer
kentsommer / test.py
Created March 21, 2017 01:14
classification test
from keras.applications.inception_v3 import *
from keras.preprocessing import image
from keras.applications.imagenet_utils import decode_predictions
from keras import backend as K
import numpy as np
model = InceptionV3(weights='imagenet')
img_path = 'apple.jpg'
img = image.load_img(img_path, target_size=(299, 299))
csv_path = "submission_kent.csv"
csv_data = []
csv_data.append(["image_name", "Type_1", "Type_2", "Type_3"])
for index, prediction in enumerate(result):
img_name = data_names[index]
type_1 = '{0:.15f}'.format(prediction[0])
type_2 = '{0:.15f}'.format(prediction[1])
type_3 = '{0:.15f}'.format(prediction[2])
line = [img_name, type_1, type_2, type_3]
@kentsommer
kentsommer / datasupplier.py
Created March 16, 2017 08:02
Preprocess for kaggle
import os
import cv2
import numpy as np
from glob import glob
from tqdm import tqdm
from keras.preprocessing import image
from keras.applications.inception_v3 import preprocess_input
def preprocess_input(x):
@kentsommer
kentsommer / shuffle_rows.py
Created February 3, 2017 08:23
row_shuffle Dense Weights
magic_number_1 = size_of_last_conv_layer
magic_number_2 = number_of_rows_in_dense / magic_number_1
def shuffle_rows(original_w):
converted_w = np.zeros(original_w.shape)
count = 0
for index, row in enumerate(original_w):
if (index % magic_number_1) == 0 and index != 0:
count += 1
new_index = ((index % magic_number_1) * magic_number_2) + count