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
e2fb51d1
Unverified
Commit
e2fb51d1
authored
Oct 11, 2018
by
Vincent Vanhoucke
Committed by
GitHub
Oct 11, 2018
Browse files
Merge pull request #5472 from JonathanJuhl/master
bug fix and python3 compatability
parents
ad254209
08ad2455
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 @
e2fb51d1
...
@@ -22,9 +22,7 @@ import argparse
...
@@ -22,9 +22,7 @@ import argparse
"""
"""
usage:
usage:
Processes all .jpg, .png, .bmp and .gif files found in the specified directory and its subdirectories.
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/
--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
--Model_PATH path to the tensorflow model
"""
"""
...
@@ -45,8 +43,8 @@ size = len(crystal_images)
...
@@ -45,8 +43,8 @@ size = len(crystal_images)
def
load_images
(
file_list
):
def
load_images
(
file_list
):
for
i
in
file_list
:
for
i
in
file_list
:
file
=
open
(
i
)
file
s
=
open
(
i
,
'rb'
)
yield
{
"image_bytes"
:[
file
.
read
()]},
i
yield
{
"image_bytes"
:[
file
s
.
read
()]},
i
...
@@ -66,7 +64,9 @@ with open(PATH +'results.csv', 'w') as csvfile:
...
@@ -66,7 +64,9 @@ with open(PATH +'results.csv', 'w') as csvfile:
results
=
predicter
(
data
)
results
=
predicter
(
data
)
vals
=
results
[
'scores'
][
0
]
vals
=
results
[
'scores'
][
0
]
vals
=
vals
*
100
classes
=
results
[
'classes'
][
0
]
print
(
'Image path: '
+
name
,
'Crystal: '
+
str
(
vals
[
0
]),
'Other: '
+
str
(
vals
[
1
]),
'Precipitate: '
+
str
(
vals
[
2
]),
'Clear '
+
str
(
vals
[
3
]))
dictionary
=
dict
(
zip
(
classes
,
vals
))
Writer
.
writerow
([
'Image path: '
+
name
,
'Crystal: '
+
str
(
vals
[
0
]),
'Other: '
+
str
(
vals
[
1
]),
'Precipitate: '
+
str
(
vals
[
2
]),
'Clear: '
+
str
(
vals
[
3
])])
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