minor changes
This commit is contained in:
parent
ccce3c9362
commit
4acea19558
37
createNeuralNetworkDatabase.py
Normal file
37
createNeuralNetworkDatabase.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import os
|
||||||
|
import cv2
|
||||||
|
import matplotlib
|
||||||
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
path_potatoes = 'neural_network\\images\\potatoes'
|
||||||
|
path_beetroot = 'neural_network\\images\\beetroot'
|
||||||
|
size = 250
|
||||||
|
|
||||||
|
#POTATOES
|
||||||
|
training_data_potatoes = []
|
||||||
|
for img in os.listdir(path_potatoes):
|
||||||
|
pic = cv2.imread(os.path.join(path_potatoes,img))
|
||||||
|
pic = cv2.cvtColor(pic,cv2.COLOR_BGR2RGB)
|
||||||
|
pic = cv2.resize(pic,(size,size))
|
||||||
|
training_data_potatoes.append([pic])
|
||||||
|
|
||||||
|
np.save(os.path.join('neural_network','potatoes-dataset'),np.array(training_data_potatoes))
|
||||||
|
|
||||||
|
saved_potatoes = np.load(os.path.join('neural_network','potatoes-dataset.npy'))
|
||||||
|
|
||||||
|
#BEETROOT
|
||||||
|
training_data_beetroot = []
|
||||||
|
for img in os.listdir(path_beetroot):
|
||||||
|
pic = cv2.imread(os.path.join(path_beetroot,img))
|
||||||
|
pic = cv2.cvtColor(pic,cv2.COLOR_BGR2RGB)
|
||||||
|
pic = cv2.resize(pic,(size,size))
|
||||||
|
training_data_beetroot.append([pic])
|
||||||
|
|
||||||
|
np.save(os.path.join('neural_network','beetroot-dataset'),np.array(training_data_beetroot))
|
||||||
|
|
||||||
|
saved_potatoes = np.load(os.path.join('neural_network','beetroot-dataset.npy'))
|
||||||
|
|
||||||
|
# for i in range(5):
|
||||||
|
# plt.imshow(np.array(training_data_potatoes[i]).reshape(size,size,3))
|
||||||
|
# plt.show()
|
5
main.py
5
main.py
@ -1,5 +1,3 @@
|
|||||||
import pygame
|
|
||||||
|
|
||||||
import Board
|
import Board
|
||||||
import FindPath
|
import FindPath
|
||||||
import TractorAction
|
import TractorAction
|
||||||
@ -12,9 +10,12 @@ from TractorLoad import TillageUnit
|
|||||||
from constants import *
|
from constants import *
|
||||||
from manualSteering import manualSteeringDriver
|
from manualSteering import manualSteeringDriver
|
||||||
import joblib
|
import joblib
|
||||||
|
import pygame
|
||||||
|
|
||||||
|
|
||||||
pygame.init()
|
pygame.init()
|
||||||
|
|
||||||
|
|
||||||
display = pygame.display.set_mode((DISPLAY_SIZE_HORIZONTAL, DISPLAY_SIZE_VERTICAL))
|
display = pygame.display.set_mode((DISPLAY_SIZE_HORIZONTAL, DISPLAY_SIZE_VERTICAL))
|
||||||
pygame.display.set_caption('Tractor')
|
pygame.display.set_caption('Tractor')
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 106 KiB |
Loading…
Reference in New Issue
Block a user