add sunflower to neural network
@ -19,7 +19,7 @@ class NeuralNetwork:
|
||||
self.batch_size = 25
|
||||
self.img_width, self.img_height, self.img_num_channels = 25, 25, 3
|
||||
self.loss_function = sparse_categorical_crossentropy
|
||||
self.no_classes = 7
|
||||
self.no_classes = 8
|
||||
self.no_epochs = 40
|
||||
self.optimizer = Adam()
|
||||
self.verbosity = 1
|
||||
@ -28,7 +28,7 @@ class NeuralNetwork:
|
||||
self.input_shape = (self.img_width, self.img_height, self.img_num_channels)
|
||||
|
||||
# labels
|
||||
self.labels = ["cabbage", "carrot", "corn", "lettuce", "paprika", "potato", "tomato"]
|
||||
self.labels = ["cabbage", "carrot", "corn", "lettuce", "paprika", "potato", "sunflower" , "tomato"]
|
||||
|
||||
def init_model(self):
|
||||
if not self.model_dir_is_empty():
|
||||
@ -49,8 +49,18 @@ class NeuralNetwork:
|
||||
self.model.add(Dense(16, activation='relu'))
|
||||
self.model.add(Dense(self.no_classes, activation='softmax'))
|
||||
|
||||
self.model.compile(loss=self.loss_function,
|
||||
optimizer=self.optimizer,
|
||||
metrics=['accuracy'])
|
||||
|
||||
# Start training
|
||||
self.model.fit(
|
||||
self.train_datagen,
|
||||
epochs=self.no_epochs,
|
||||
shuffle=False)
|
||||
|
||||
# Display a model summary
|
||||
self.model.summary()
|
||||
#self.model.summary()
|
||||
|
||||
def load_images(self):
|
||||
# Create a generator
|
||||
@ -65,17 +75,6 @@ class NeuralNetwork:
|
||||
target_size=(25, 25),
|
||||
class_mode='sparse')
|
||||
|
||||
def train(self):
|
||||
self.model.compile(loss=self.loss_function,
|
||||
optimizer=self.optimizer,
|
||||
metrics=['accuracy'])
|
||||
|
||||
# Start training
|
||||
self.model.fit(
|
||||
self.train_datagen,
|
||||
epochs=self.no_epochs,
|
||||
shuffle=False)
|
||||
|
||||
def predict(self, field: BaseField) -> str:
|
||||
print(field.get_img_path())
|
||||
# corn_img_path = os.path.join(RESOURCE_DIR,'corn.png')
|
||||
@ -107,7 +106,7 @@ class NeuralNetwork:
|
||||
prediction = self.predict(field)
|
||||
|
||||
# Saving model
|
||||
if not self.model_dir_is_empty():
|
||||
if self.model_dir_is_empty():
|
||||
save_model(self.model, MODEL_DIR)
|
||||
|
||||
return prediction
|
||||
|
@ -34,7 +34,7 @@ MAP_DIR = os.path.join(BASE_DIR, 'maps')
|
||||
MAP_FILE_NAME = 'map'
|
||||
TRAINING_SET_DIR = os.path.join(RESOURCE_DIR, 'smaller_train')
|
||||
TEST_SET_DIR = os.path.join(RESOURCE_DIR, 'smaller_test')
|
||||
ADAPTED_IMG_DIR = os.path.join(RESOURCE_DIR, "adapted-images")
|
||||
ADAPTED_IMG_DIR = os.path.join(RESOURCE_DIR, "adapted_images")
|
||||
MODEL_DIR = os.path.join(RESOURCE_DIR, 'saved_model')
|
||||
|
||||
# Picture format
|
||||
|
BIN
resources/adapted_images/_0_1015167.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_1106354.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_1413522.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_1434689.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_1576755.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_159961.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_1712739.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_1888958.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_1975706.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_199073.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_2002648.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_222218.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_2230058.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_2449241.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_253662.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_264174.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_2691611.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_3173670.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_319191.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_3201661.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_3754557.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_4796871.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_4990665.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_5438921.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_5908525.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_5932156.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_6305545.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_6385267.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_6763548.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_7072104.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_7425355.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_7742986.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_783957.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_7877668.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_8422282.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_877573.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_8898620.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_9419219.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_9674373.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_0_9842902.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_1021571.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_1102213.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_1398151.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_1406127.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_1424951.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_1507834.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_1685295.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_196777.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_229906.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_2507529.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_2535914.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_255924.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_2638732.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_3141154.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_3444672.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_348237.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_370495.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_4098518.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_4352202.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_4810874.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_4979742.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_5055936.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_5167533.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_6296802.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_6573200.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_6831423.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_7144812.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_7323947.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_7527599.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_8253326.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_8481408.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_8564476.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_8802269.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_8861920.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_9102035.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_9197755.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_9490635.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_9509714.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_9599114.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_100_9967276.jpeg
Normal file
After Width: | Height: | Size: 1000 B |
BIN
resources/adapted_images/_101_1012072.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_1187710.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_131211.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_1328795.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_1488133.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_2079219.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_236479.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_2624928.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_2630073.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_2704938.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_2849540.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_2936003.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_304819.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_3539195.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_3673590.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_3767745.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_4232152.jpeg
Normal file
After Width: | Height: | Size: 1014 B |
BIN
resources/adapted_images/_101_5498486.jpeg
Normal file
After Width: | Height: | Size: 1014 B |