Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
boris_conforty
Food-Recognition
Commits
480d7084
Commit
480d7084
authored
Feb 20, 2020
by
Ubuntu
Browse files
Added dummy file to push folder and fixed folder not being created on temp image file save
parent
66498a81
Changes
2
Hide whitespace changes
Inline
Side-by-side
api_ml_bc/predict.py
View file @
480d7084
...
...
@@ -178,7 +178,9 @@ def predict_output (image):
Generate json output object
"""
_output
=
[]
temp_path
=
os
.
path
.
join
(
ROOT_DIR
,
'temp_inception'
)
os
.
makedirs
(
temp_path
,
exist_ok
=
True
)
temp_image_file
=
os
.
path
.
join
(
temp_path
,
'tmp.jpg'
)
for
_idx
,
class_id
in
enumerate
(
p
[
"class_ids"
]):
# Traverse through all identified individual instances of classes
polygon
=
[]
...
...
@@ -206,11 +208,10 @@ def predict_output (image):
image_cropped
=
image
[
x0
:
x0
+
width
,
y0
:
y0
+
height
,
:]
im
=
Image
.
fromarray
(
image_cropped
)
src
=
os
.
path
.
join
(
ROOT_DIR
,
'temp_inception/tmp.jpg'
)
im
.
save
(
src
)
label
,
score
=
runt
(
src
,
labels
,
input_layer
,
output_layer
)
im
.
save
(
temp_image_file
)
label
,
score
=
runt
(
temp_image_file
,
labels
,
input_layer
,
output_layer
)
# barcoded = run_barcoded(src, model_barcoded)
os
.
remove
(
src
)
os
.
remove
(
temp_image_file
)
_result
=
{}
_result
[
"image_id"
]
=
"?"
...
...
api_ml_bc/temp_inception/_
0 → 100644
View file @
480d7084
File added
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