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
2d7471e5
Commit
2d7471e5
authored
Jul 03, 2020
by
Gunasinghe M.D.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
748938ce
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
image_proprocessing.py
image_proprocessing.py
+40
-0
No files found.
image_proprocessing.py
0 → 100644
View file @
2d7471e5
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Gunasinghe M.D.
"""
# 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