START_NUMBER = 60

# what to end at
hm_data = 111

# use a previous model to begin?
START_FRESH = False

WIDTH = 160
HEIGHT = 120
LR = 1e-3
EPOCHS = 1
MODEL_NAME = ''
EXISTING_MODEL_NAME = ''

model = alexnet2(WIDTH, HEIGHT, LR, output=9)

if not START_FRESH:
    model.load(EXISTING_MODEL_NAME)

for i in range(EPOCHS):
    data_order = [i for i in range(START_NUMBER, hm_data + 1)]
    shuffle(data_order)
    for i in data_order:
        train_data = np.load('training_data.npy'.format(i))

        df = pd.DataFrame(train_data)
        df = df.iloc[np.random.permutation(len(df))]
        train_data = df.values.tolist()

        train = train_data[:-100]
예제 #2
0
from alexnet import alexnet, alexnet2
import numpy as np
import os
import tensorflow as tf

data = np.load('training_data_after_Canny.npy', allow_pickle=True)

model = alexnet2(152, 104, 0.5, 3)

model.predict(data[0][0])

print(1)
예제 #3
0
START_NUMBER = 60

# what to end at
hm_data = 111

# use a previous model to begin?
START_FRESH = False

WIDTH = 160
HEIGHT = 120
LR = 1e-3
EPOCHS = 1
MODEL_NAME = ''
EXISTING_MODEL_NAME = ''

model = alexnet2(WIDTH, HEIGHT, LR, output=9)

if not START_FRESH:
    model.load(EXISTING_MODEL_NAME)

for i in range(EPOCHS):
    data_order = [i for i in range(START_NUMBER,hm_data+1)]
    shuffle(data_order)
    for i in data_order:
        train_data = np.load('training_data-{}.npy'.format(i))
        
        df = pd.DataFrame(train_data)
        df = df.iloc[np.random.permutation(len(df))]
        train_data = df.values.tolist()

        train = train_data[:-100]
예제 #4
0
    #ReleaseKey(A)
    time.sleep(t_time)
    ReleaseKey(A)


def right():
    PressKey(W)
    PressKey(D)
    ReleaseKey(A)
    #ReleaseKey(W)
    #ReleaseKey(D)
    time.sleep(t_time)
    ReleaseKey(D)


model = alexnet2(WIDTH, HEIGHT, LR)
model.load(MODEL_NAME)


def region_of_interest(img, vertices):
    mask = np.zeros_like(img)
    match_mask_color = 255
    cv2.fillPoly(mask, vertices, match_mask_color)
    masked_image = cv2.bitwise_and(img, mask)
    return masked_image


def main():
    last_time = time.time()
    region_of_interest_vertices = [(0, 480), (0, 294), (640, 294), (640, 480)]
    for i in list(range(4))[::-1]:
예제 #5
0

def forward_right():
    PressKey(W)
    PressKey(D)
    ReleaseKey(A)


def no_keys():
    PressKey(W)
    ReleaseKey(A)
    ReleaseKey(S)
    ReleaseKey(D)


model = alexnet2(width, height, 6)
model.load(model_name)


def main():
    last_time = time()
    for i in range(1, 4):
        print(4 - i)
        sleep(1)

    paused = False
    while (True):

        if not paused:
            screen = takeScreenShot(region=(0, 30, 800, 630))
            print('loop took {} seconds'.format(time() - last_time))
예제 #6
0
from random import shuffle
import pandas as pd
import tflearn, os

# what to start at
START_NUMBER = 60

# what to end at
hm_data = 111

w = 160
h = 120

modelName = 'GTA5-TestModel-70k-data.model'
trainingDataName = 'trainingData.npy'
model = alexnet2(w, h, 6)

if os.path.isfile(modelName):
    print("File exists")
    model.load(modelName)

epochs = 10
for i in range(epochs):
    data_order = [i for i in range(START_NUMBER, hm_data + 1)]
    shuffle(data_order)

    for i in data_order:
        trainData = np.load(trainingDataName)

        df = pd.DataFrame(trainData)
        df = df.iloc[np.random.permutation(len(df))]