Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-158
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
2
Merge Requests
2
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-158
2022-158
Commits
34604cb2
Commit
34604cb2
authored
Sep 28, 2022
by
Jayasith H.B.C
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(database) database change
parent
33b44e56
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
5 deletions
+2
-5
backend/database.db
backend/database.db
+0
-0
backend/services/use_case_model_detection_service.py
backend/services/use_case_model_detection_service.py
+2
-5
backend/submissions/use_case/usecase02.jpg
backend/submissions/use_case/usecase02.jpg
+0
-0
No files found.
backend/database.db
View file @
34604cb2
No preview for this file type
backend/services/use_case_model_detection_service.py
View file @
34604cb2
...
...
@@ -51,7 +51,6 @@ def text_extraction(filename, class_id, boxes, accurate_indexes, category_index,
image
=
cv2
.
imread
(
app
.
SUBMISSION_PATH
+
'/'
+
filename
)
for
i
in
range
(
0
,
len
(
accurate_indexes
)):
if
category_index
[
class_id
[
i
]][
'name'
]
!=
"relationship"
:
height
,
width
,
c
=
image
.
shape
ymin
=
boxes
[
i
][
0
]
*
height
...
...
@@ -60,13 +59,9 @@ def text_extraction(filename, class_id, boxes, accurate_indexes, category_index,
xmax
=
boxes
[
i
][
3
]
*
width
crop_img
=
image
[
int
(
ymin
):
int
(
ymax
),
int
(
xmin
):
int
(
xmax
)]
gray_img
=
cv2
.
cvtColor
(
crop_img
,
cv2
.
COLOR_BGR2GRAY
)
thresh
,
bw_img
=
cv2
.
threshold
(
gray_img
,
160
,
255
,
cv2
.
THRESH_TOZERO
)
resize_img
=
cv2
.
resize
(
bw_img
,
None
,
fx
=
1
,
fy
=
1
)
ocr_result
=
pytesseract
.
image_to_string
(
resize_img
,
config
=
'1 eng --oem 1 --psm 13'
)
result
=
ocr_result
.
strip
()
.
replace
(
"
\\
"
,
""
)
text
=
re
.
sub
(
"=|,"
,
""
,
result
)
...
...
@@ -83,3 +78,5 @@ def text_extraction(filename, class_id, boxes, accurate_indexes, category_index,
y_max
=
ymax
)
db
.
session
.
add
(
use_case_obj
)
db
.
session
.
commit
()
backend/submissions/use_case/usecase02.jpg
0 → 100644
View file @
34604cb2
50 KB
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