Skip to content

Instantly share code, notes, and snippets.

View Goddard's full-sized avatar
🎰
Coding

Ryein Goddard Goddard

🎰
Coding
View GitHub Profile
@Goddard
Goddard / diagonalDifference.py
Created April 15, 2019 13:38
something I did for hankerrank
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the diagonalDifference function below.
def diagonalDifference(arr):
def draw_lines(img, lines, color=[255, 0, 0], thickness=10):
"""
NOTE: this is the function you might want to use as a starting point once you want to
average/extrapolate the line segments you detect to map out the full
extent of the lane (going from the result shown in raw-lines-example.mp4
to that shown in P1_example.mp4).
Think about things like separating line segments by their
slope ((y2-y1)/(x2-x1)) to decide which segments are part of the left
line vs. the right line. Then, you can average the position of each of
@Goddard
Goddard / publish_video.py
Created November 19, 2017 23:27 — forked from wngreene/publish_video.py
Publish a video as ROS messages.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2016 Massachusetts Institute of Technology
"""Publish a video as ROS messages.
"""
import argparse
@Goddard
Goddard / helper.py
Created October 15, 2017 18:19
function from helper
def gen_test_video(sess, logits, keep_prob, input_image, clip, image_shape): #test_image
# image = scipy.misc.imresize(scipy.misc.imread(test_image), image_shape)
image = clip
im_softmax = sess.run(
[tf.nn.softmax(logits)],
{keep_prob: 1.0, input_image: [image]})
im_softmax = im_softmax[0][:, 1].reshape(image_shape[0], image_shape[1])
segmentation = (im_softmax > 0.5).reshape(image_shape[0], image_shape[1], 1)
mask = np.dot(segmentation, np.array([[0, 255, 0, 127]]))
@Goddard
Goddard / main.py
Created October 15, 2017 17:59
main network file for semantic segmentation
import os.path
import tensorflow as tf
import helper
import freeze
import warnings
from distutils.version import LooseVersion
import project_tests as tests
@Goddard
Goddard / video.py
Created October 15, 2017 17:15
Trying to use a pre-existing model and my additions after saving then restoring and run on video
import os.path
import tensorflow as tf
import helper
import cv2
from distutils.version import LooseVersion
# Check TensorFlow Version
assert LooseVersion(tf.__version__) >= LooseVersion('1.0'), 'Please use TensorFlow version 1.0 or newer. You are using {}'.format(tf.__version__)
print('TensorFlow Version: {}'.format(tf.__version__))
import numpy as np
import matplotlib.pyplot as plt
def graph(formula, x_range):
x = np.array(x_range)
y = formula(x)
plt.plot(x, y)
plt.show()
def my_formula(x):
@Goddard
Goddard / terminal-session
Created November 1, 2015 23:20 — forked from nlevchuk/terminal-session
It's bash script for saving and loading gnome-terminal session. Special for Ubuntu.
#!/bin/bash
##
## This is bash script for saving and loading gnome-terminal session. Special for Ubuntu.
##
## Usage: ./terminal-session -s <name_profile> - for save session
## ./terminal-session -l <name_profile> - for load existing session
## ./terminal-session --profiles - for show existing session files
##
## Instructions:
## - Run gnome-terminal;
from gdata.youtube import YouTubeVideoEntry
from gdata.youtube.service import YouTubeService
import gdata
from gdata.service import BadAuthentication, CaptchaRequired
from optparse import OptionParser
import sys
import time
import os
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {