Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-220
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
2022-220
2022-220
Commits
cdb0ebb5
Commit
cdb0ebb5
authored
Dec 02, 2022
by
Kariyawasam R.P
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shape Recognition- Test
parent
9327b0ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
Test.py
Test.py
+36
-0
No files found.
Test.py
0 → 100644
View file @
cdb0ebb5
from
tensorflow.keras.models
import
Sequential
,
save_model
,
load_model
import
numpy
as
np
import
cv2
width
=
640
height
=
480
threshold
=
0.65
cameraNo
=
0
def
preProcessing
(
img
):
img
=
cv2
.
cvtColor
(
img
,
cv2
.
COLOR_BGR2GRAY
)
img
=
cv2
.
equalizeHist
(
img
)
img
=
img
/
255
return
img
def
test
():
model
=
load_model
(
'model.h5'
)
img
=
cv2
.
imread
(
'Test/test.png'
)
# img = cv2.imread('Test/' + name)
img
=
np
.
asarray
(
img
)
img
=
cv2
.
resize
(
img
,
(
32
,
32
))
img
=
preProcessing
(
img
)
img
=
img
.
reshape
(
1
,
32
,
32
,
1
)
# classIndex = int(model.predict(img))
predictions
=
model
.
predict
(
img
)
probVal
=
np
.
amax
(
predictions
)
a
=
np
.
amax
(
predictions
)
*
100
x
=
"
%.2
f"
%
round
(
a
,
2
)
print
(
predictions
)
print
(
x
)
return
probVal
print
(
test
())
\ 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