Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
08ad2455
Unverified
Commit
08ad2455
authored
Oct 11, 2018
by
Jonathan juhl
Committed by
GitHub
Oct 11, 2018
Browse files
bug fix and python3 compatability
fixed bug and introduced python3 compatability
parent
e404b51e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
research/marco/Automated_Marco.py
research/marco/Automated_Marco.py
+7
-7
No files found.
research/marco/Automated_Marco.py
View file @
08ad2455
...
...
@@ -22,9 +22,7 @@ import argparse
"""
usage:
Processes all .jpg, .png, .bmp and .gif files found in the specified directory and its subdirectories.
--PATH ( Path to directory of images or path to directory with subdirectory of images). e.g Path/To/Directory/
--Model_PATH path to the tensorflow model
"""
...
...
@@ -45,8 +43,8 @@ size = len(crystal_images)
def
load_images
(
file_list
):
for
i
in
file_list
:
file
=
open
(
i
)
yield
{
"image_bytes"
:[
file
.
read
()]},
i
file
s
=
open
(
i
,
'rb'
)
yield
{
"image_bytes"
:[
file
s
.
read
()]},
i
...
...
@@ -66,7 +64,9 @@ with open(PATH +'results.csv', 'w') as csvfile:
results
=
predicter
(
data
)
vals
=
results
[
'scores'
][
0
]
vals
=
vals
*
100
print
(
'Image path: '
+
name
,
'Crystal: '
+
str
(
vals
[
0
]),
'Other: '
+
str
(
vals
[
1
]),
'Precipitate: '
+
str
(
vals
[
2
]),
'Clear '
+
str
(
vals
[
3
]))
Writer
.
writerow
([
'Image path: '
+
name
,
'Crystal: '
+
str
(
vals
[
0
]),
'Other: '
+
str
(
vals
[
1
]),
'Precipitate: '
+
str
(
vals
[
2
]),
'Clear: '
+
str
(
vals
[
3
])])
classes
=
results
[
'classes'
][
0
]
dictionary
=
dict
(
zip
(
classes
,
vals
))
print
(
'Image path: '
+
name
+
' Crystal: '
+
str
(
dictionary
[
b
'Crystals'
])
+
' Other: '
+
str
(
dictionary
[
b
'Other'
])
+
' Precipitate: '
+
str
(
dictionary
[
b
'Precipitate'
])
+
' Clear: '
+
str
(
dictionary
[
b
'Clear'
]))
Writer
.
writerow
([
'Image path: '
+
name
,
'Crystal: '
+
str
(
dictionary
[
b
'Crystals'
]),
'Other: '
+
str
(
dictionary
[
b
'Other'
]),
'Precipitate: '
+
str
(
dictionary
[
b
'Precipitate'
]),
'Clear: '
+
str
(
dictionary
[
b
'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