From 76722e69856f9ff6fc44aa6f3f7f467fb2955aa5 Mon Sep 17 00:00:00 2001
From: MathieuKoz <127348750+MathieuKoz@users.noreply.github.com>
Date: Thu, 20 Jun 2024 21:42:46 +0200
Subject: [PATCH] retire feux + correction chemin

---
 supervised_learning/config.py             |  2 +-
 supervised_learning/create_classifiers.py | 12 +-----------
 supervised_learning/detection.py          |  5 ++---
 3 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/supervised_learning/config.py b/supervised_learning/config.py
index 92dc335..a200dc2 100644
--- a/supervised_learning/config.py
+++ b/supervised_learning/config.py
@@ -4,7 +4,7 @@ TRAINING_IMAGE_FOLDER_PATH = "./data/train/images/"
 TRAINING_LABEL_FOLDER_PATH = "./data/train/labels/"
 VAL_IMAGE_FOLDER_PATH = "./data/val/images/"
 VAL_LABEL_FOLDER_PATH = "./data/val/labels/"
-PREDICTION_LABEL_FOLDER_PATH = "./data/train/predicted_labels/"
+PREDICTION_LABEL_FOLDER_PATH = "./data/val/predicted_labels/"
 CLASSIFIERS_FOLDER_PATH = "./supervised_learning/classifiers/saves/"
 WINDOW_SIZES = [(64, 64), (128, 128), (256, 256),(512,512)]  # Window sizes during slidding window process
 STEP_SIZE = 16
\ No newline at end of file
diff --git a/supervised_learning/create_classifiers.py b/supervised_learning/create_classifiers.py
index 84de49c..af1eed4 100644
--- a/supervised_learning/create_classifiers.py
+++ b/supervised_learning/create_classifiers.py
@@ -105,8 +105,6 @@ for classe in CLASSES:
         datasets["train"][classe]["X"], datasets["train"][classe]["Y"] = create_binary_classification_dataset(datas_train, classe)
         datasets["val"][classe]["X"], datasets["val"][classe]["Y"] = create_binary_classification_dataset(datas_val, classe)
         
-        datasets["feux_train"]["feux"]["X"], datasets["feux_train"]["feux"]["Y"] = create_binary_classification_dataset_feux(datas_train)
-        datasets["feux_val"]["feux"]["X"], datasets["feux_val"]["feux"]["Y"] = create_binary_classification_dataset_feux(datas_val)
 
 # Dict format to store all classifiers
 classifiers = {
@@ -118,7 +116,6 @@ classifiers = {
     "frouge": None, 
     "forange": None, 
     "fvert": None,
-    "feux" : None,
 }
 
 # ------------- CREATE CLASSIFIERS -----------------
@@ -126,7 +123,7 @@ print("Creating classifiers...")
 for classe in CLASSES:
     if classe not in ['ff', 'empty']:
         classifiers[classe] = svm.SVC(kernel='poly', probability=True)
-classifiers['feux'] = svm.SVC(kernel='poly', probability=True)
+
 
 # ------------- TRAIN & TEST CLASSIFIERS -----------------
 print("Train and testing all classifiers...")
@@ -138,13 +135,6 @@ for classe in CLASSES:
         y_pred = classifiers[classe].predict(X_val)
         print(f"Précision pour panneaux {classe}: {np.mean(y_pred == y_val)}")
 
-X_train, y_train =  datasets["feux_train"]["feux"]["X"], datasets["feux_train"]["feux"]["Y"]
-X_val, y_val = datasets["feux_val"]["feux"]["X"], datasets["feux_val"]["feux"]["Y"]
-classifiers['feux'].fit(X_train, y_train)
-y_feu = classifiers['feux'].predict(X_val)
-print(f"Précision pour panneaux feux: {np.mean(y_feu == y_val)}")
-
-
 # ------------- SAVE CLASSIFIERS -----------------
 print("Saving classifiers")
 for classes, model in classifiers.items():
diff --git a/supervised_learning/detection.py b/supervised_learning/detection.py
index 4434512..b068a1a 100644
--- a/supervised_learning/detection.py
+++ b/supervised_learning/detection.py
@@ -40,8 +40,7 @@ classifiers = {
     "ceder": None, 
     "frouge": None, 
     "forange": None, 
-    "fvert": None,
-    "feux":None
+    "fvert": None
 }
 
 # Parse dict and load all classifiers
@@ -79,7 +78,7 @@ for filepath, image in X.items():
 
     # Filter rois with Non Maximum Suppression process
     rois = non_max_suppression(rois, iou_threshold=0.1)     
-    #display_rois(image, rois)  -- UNCOMMENT TO DISPLAY
+    #display_rois(image, rois)  #-- UNCOMMENT TO DISPLAY
 
     # Write preticted labels into prediction files
     prediction_file_path = os.path.join(output_folder, f"{name}.csv")
-- 
GitLab