Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SY32_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Victor Demessance
SY32_project
Commits
76722e69
Commit
76722e69
authored
8 months ago
by
MathieuKoz
Browse files
Options
Downloads
Patches
Plain Diff
retire feux + correction chemin
parent
9d96b4c7
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
supervised_learning/config.py
+1
-1
1 addition, 1 deletion
supervised_learning/config.py
supervised_learning/create_classifiers.py
+1
-11
1 addition, 11 deletions
supervised_learning/create_classifiers.py
supervised_learning/detection.py
+2
-3
2 additions, 3 deletions
supervised_learning/detection.py
with
4 additions
and
15 deletions
supervised_learning/config.py
+
1
−
1
View file @
76722e69
...
...
@@ -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
This diff is collapsed.
Click to expand it.
supervised_learning/create_classifiers.py
+
1
−
11
View file @
76722e69
...
...
@@ -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
():
...
...
This diff is collapsed.
Click to expand it.
supervised_learning/detection.py
+
2
−
3
View file @
76722e69
...
...
@@ -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
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment