Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mahindra_ocr_shikhin
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
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikhin.vc
mahindra_ocr_shikhin
Commits
7ab18e7b
Commit
7ab18e7b
authored
Dec 05, 2022
by
Sikhin VC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
77e97d5a
Pipeline
#49724
canceled with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
12 deletions
+40
-12
README.md
README.md
+2
-0
edge_engine/ai/model/modelwraper.py
edge_engine/ai/model/modelwraper.py
+2
-2
scripts/cement_counter.py
scripts/cement_counter.py
+36
-10
No files found.
README.md
View file @
7ab18e7b
# mahindra_and_mahindra_text_recognition
edge_engine/ai/model/modelwraper.py
View file @
7ab18e7b
...
...
@@ -22,5 +22,5 @@ class ModelWrapper(ABC):
def
predict
(
self
,
x
):
pre_x
=
self
.
_pre_process
(
x
)
prediction
=
self
.
_predict
(
pre_x
)
result
=
self
.
_post_process
(
prediction
)
return
result
#
result = self._post_process(prediction)
#
return result
scripts/cement_counter.py
View file @
7ab18e7b
...
...
@@ -94,8 +94,8 @@ class CementBagCounter(ModelWrapper):
self
.
fixed_and_internal_engine
=
[
"2"
,
"K"
,
"C"
,
"A"
]
self
.
month_engine
=
[
"K"
,
"L"
,
"M"
,
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"J"
]
self
.
month_front_axle_bar
=
[
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"I"
,
"J"
,
"K"
,
"L"
,
"M"
]
self
.
text_json
=
{
"data"
:{
"text"
:
" "
,
"fixed characters"
:
" "
,
"internal characters"
:
" "
,
"year"
:
" "
,
"month"
:
" "
,
"plant"
:
" "
,
"serial number"
:
" "
},
"status"
:
False
,
"message"
:
"
"
}
self
.
text_json
=
{
"data"
:{
"text"
:
" "
,
"fixed characters"
:
" "
,
"internal characters"
:
" "
,
"year"
:
" "
,
"month"
:
" "
,
"plant"
:
" "
,
"serial number"
:
" "
},
"status"
:
False
,
"message"
:
"
Image not clear
"
}
self
.
digit_list
=
[
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"0"
]
self
.
initial_object_position
=
None
self
.
uncounted_objects
=
ExpiringDict
(
...
...
@@ -232,10 +232,10 @@ class CementBagCounter(ModelWrapper):
# print(sub_list)
matching_chars
=
[
i
for
i
,
j
in
zip
(
sub_list
,
self
.
internal_engine
)
if
i
==
j
]
# print(matching_chars)
if
(
len
(
matching_chars
)
<
3
):
return
False
,
None
return
True
,
None
if
(
len
(
matching_chars
)
>
0
):
# print("1234567890!@#$%^&*()")
return
True
,
None
return
False
,
None
def
plant_ver
(
self
,
text_list
,
part_name
):
if
(
part_name
==
"front_axle_bar"
):
...
...
@@ -334,8 +334,13 @@ class CementBagCounter(ModelWrapper):
actual_text
.
append
(
"R"
)
else
:
return
"Image not clear"
,
False
for
elem
in
corrected_digit
:
print
(
"elements are----"
)
print
(
elem
)
if
elem
not
in
self
.
digit_list
:
return
"Image not clear"
,
False
actual_text
.
extend
(
corrected_digit
)
return
actual_text
,
True
else
:
if
(
plant_verification
):
actual_text
.
append
(
"R"
)
...
...
@@ -363,10 +368,15 @@ class CementBagCounter(ModelWrapper):
for
elem
in
corrected_digit
:
print
(
"elements are----"
)
print
(
elem
)
if
elem
not
in
self
.
digit_list
:
return
"Image not clear"
,
False
actual_text
.
extend
(
corrected_digit
)
return
actual_text
,
True
return
actual_text
,
True
def
_predict
(
self
,
obj
):
...
...
@@ -378,6 +388,11 @@ class CementBagCounter(ModelWrapper):
part_name
=
self
.
check_character
(
text
)
if
not
part_name
:
text
=
"Image not Clear"
self
.
text_json
=
{
"data"
:
{
"text"
:
" "
,
"fixed characters"
:
" "
,
"internal characters"
:
" "
,
"year"
:
" "
,
"month"
:
" "
,
"plant"
:
" "
,
"serial number"
:
" "
},
"status"
:
False
,
"message"
:
"Image not clear"
}
pass
else
:
text_list
=
[]
for
letter
in
text
:
...
...
@@ -429,7 +444,9 @@ class CementBagCounter(ModelWrapper):
self
.
text_json
[
"data"
][
"plant"
]
=
plant
self
.
text_json
[
"data"
][
"serial number"
]
=
serial_number
self
.
text_json
[
"status"
]
=
True
self
.
text_json
[
"message"
]
=
" "
else
:
print
(
"engine part---------------------"
)
year
=
" "
month
=
" "
# fixed_char = redefined_text[0:3]
...
...
@@ -456,10 +473,19 @@ class CementBagCounter(ModelWrapper):
self
.
text_json
[
"data"
][
"plant"
]
=
plant
self
.
text_json
[
"data"
][
"serial number"
]
=
serial_number
self
.
text_json
[
"status"
]
=
True
self
.
text_json
[
"message"
]
=
" "
else
:
self
.
recognition_output
=
"Image not clear"
self
.
text_json
[
"data"
][
"text"
]
=
self
.
recognition_output
self
.
text_json
[
"data"
][
"fixed characters"
]
=
" "
self
.
text_json
[
"data"
][
"internal characters"
]
=
" "
self
.
text_json
[
"data"
][
"year"
]
=
" "
self
.
text_json
[
"data"
][
"month"
]
=
" "
self
.
text_json
[
"data"
][
"plant"
]
=
" "
self
.
text_json
[
"data"
][
"serial number"
]
=
" "
# self.recognition_output = "Image not clear"
self
.
text_json
[
"data"
][
"text"
]
=
" "
self
.
text_json
[
"status"
]
=
False
self
.
text_json
[
"message"
]
=
"Image is not clear"
...
...
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