Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Naundorf
HPC_Vehicle_Classification
Commits
940cdc07
Commit
940cdc07
authored
Jun 18, 2022
by
Naundorf
Browse files
Update KI-KNN
parent
4b17b010
Pipeline
#6557
failed with stage
in 2 minutes and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
KI-KNN
View file @
940cdc07
...
...
@@ -23,30 +23,25 @@ def train_test_data_split(X, y):
return
X_train
,
X_test
,
y_train
,
y_test
#
creating
a
model
def
create_and_compile_model
():
print
(
"Creating a Model"
)
from
keras
.
models
import
Sequential
from
keras
.
layers
import
Conv2D
,
Dense
,
MaxPooling2D
,
Dropout
,
Flatten
,
BatchNormalization
model
=
models
.
Sequential
()
model
.
add
(
Conv2D
(
32
,
kernel_size
=(
3
,
3
),
activation
=
"relu"
,
input_shape
=(
constants
.
N_FEATURE
,
constants
.
FEATURE_MAX_LEN
,
constants
.
CHANNELS
)))
model
.
add
(
Conv2D
(
32
,
kernel_size
=(
3
,
3
),
activation
=
"relu"
))
model
.
add
(
MaxPooling2D
(
pool_size
=(
2
,
2
)))
model
.
add
(
Conv2D
(
64
,
kernel_size
=(
3
,
3
),
activation
=
"relu"
))
model
.
add
(
MaxPooling2D
(
pool_size
=(
2
,
2
)))
model
.
add
(
Dropout
(
0.5
))
model
.
add
(
Flatten
())
model
.
add
(
Dense
(
128
,
activation
=
"relu"
))
model
.
add
(
Dense
(
constants
.
OUTPUT_LAYER_DIMENSIONS
,
activation
=
'softmax'
))
print
(
"Compiling a Model"
)
optimizer
=
keras
.
optimizers
.
RMSprop
()
model
.
compile
(
optimizer
=
optimizer
,
loss
=
constants
.
LOSS_FUNCTION_SPARSE
,
metrics
=[
constants
.
ACCURACY_METRICS
])
print
(
model
.
summary
())
return
model
print
(
"Creating a Model"
)
from
keras
.
models
import
Sequential
from
keras
.
layers
import
Conv2D
,
Dense
,
MaxPooling2D
,
Dropout
,
Flatten
,
BatchNormalization
model
=
models
.
Sequential
()
model
.
add
(
Conv2D
(
32
,
kernel_size
=(
3
,
3
),
activation
=
"relu"
,
input_shape
=(
constants
.
N_FEATURE
,
constants
.
FEATURE_MAX_LEN
,
constants
.
CHANNELS
)))
model
.
add
(
Conv2D
(
32
,
kernel_size
=(
3
,
3
),
activation
=
"relu"
))
model
.
add
(
MaxPooling2D
(
pool_size
=(
2
,
2
)))
model
.
add
(
Conv2D
(
64
,
kernel_size
=(
3
,
3
),
activation
=
"relu"
))
model
.
add
(
MaxPooling2D
(
pool_size
=(
2
,
2
)))
model
.
add
(
Dropout
(
0.5
))
model
.
add
(
Flatten
())
model
.
add
(
Dense
(
128
,
activation
=
"relu"
))
model
.
add
(
Dense
(
constants
.
OUTPUT_LAYER_DIMENSIONS
,
activation
=
'softmax'
))
print
(
"Compiling a Model"
)
optimizer
=
keras
.
optimizers
.
RMSprop
()
model
.
compile
(
optimizer
=
optimizer
,
loss
=
constants
.
LOSS_FUNCTION_SPARSE
,
metrics
=[
constants
.
ACCURACY_METRICS
])
print
(
model
.
summary
())
return
model
def
preprocessing_csv_data
():
print
(
"Reading Features... "
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment