Skip to content
Snippets Groups Projects
Commit 76722e69 authored by MathieuKoz's avatar MathieuKoz
Browse files

retire feux + correction chemin

parent 9d96b4c7
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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():
......
......@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment