Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
CHILD INTELLIGENT ASSESSMENT TOOL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2020-046
CHILD INTELLIGENT ASSESSMENT TOOL
Commits
c9e43f40
Commit
c9e43f40
authored
Oct 19, 2020
by
MithilaGunasinghe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
split sample data for training and testing purposes
parent
9996bdf3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
CNNmodel/image_proprocessing.py
CNNmodel/image_proprocessing.py
+42
-0
No files found.
CNNmodel/image_proprocessing.py
0 → 100644
View file @
c9e43f40
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author : Gunasinghe M.D.
IT NUM : IT17043342
"""
# Image Preprocessing for train, test and validation sets
import
os
import
random
import
glob
def
prepare_test_data
(
n
):
base_path
=
"shapes"
f1
=
random
.
sample
(
glob
.
glob
(
os
.
path
.
join
(
base_path
,
"test/circles"
)
+
"/*"
),
n
)
f2
=
random
.
sample
(
glob
.
glob
(
os
.
path
.
join
(
base_path
,
"test/squares"
)
+
"/*"
),
n
)
f3
=
random
.
sample
(
glob
.
glob
(
os
.
path
.
join
(
base_path
,
"test/triangles"
)
+
"/*"
),
n
)
for
c
in
f1
:
os
.
remove
(
c
)
for
s
in
f2
:
os
.
remove
(
s
)
for
t
in
f3
:
os
.
remove
(
t
)
def
prepare_validation_data
(
n
):
base_path
=
"shapes"
f1
=
random
.
sample
(
glob
.
glob
(
os
.
path
.
join
(
base_path
,
"validation/circles"
)
+
"/*"
),
n
)
f2
=
random
.
sample
(
glob
.
glob
(
os
.
path
.
join
(
base_path
,
"validation/squares"
)
+
"/*"
),
n
)
f3
=
random
.
sample
(
glob
.
glob
(
os
.
path
.
join
(
base_path
,
"validation/triangles"
)
+
"/*"
),
n
)
for
c
in
f1
:
os
.
remove
(
c
)
for
s
in
f2
:
os
.
remove
(
s
)
for
t
in
f3
:
os
.
remove
(
t
)
# n = number of samples to remove from each categorical folder
prepare_test_data
(
70
)
prepare_validation_data
(
40
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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