Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #3

Merged
merged 53 commits into from
Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
b7d3913
first commit
likholat Apr 15, 2020
71a269c
wrong result
likholat Apr 22, 2020
d3eb91c
right result but wrong label
likholat Apr 23, 2020
d970854
right result but wrong label
likholat Apr 23, 2020
2e42350
right result but wrong label
likholat Apr 23, 2020
a4749ab
wrong label
likholat Apr 23, 2020
3f7002b
probability in range [0,1]
likholat Apr 23, 2020
893efdc
fix comments
likholat Apr 24, 2020
8cd6cf3
fix comments
likholat Apr 24, 2020
c50d30d
fix comment
likholat Apr 24, 2020
4616dbe
fix comment
likholat Apr 24, 2020
2bfa5ef
fix commets
likholat Apr 27, 2020
a6ce0b1
fix comments
likholat Apr 27, 2020
503b73c
first commit
likholat Apr 28, 2020
549ab64
classify added
likholat Apr 29, 2020
47fc54d
rename file
likholat Apr 29, 2020
e7f8fb5
classification constructor added
likholat Apr 30, 2020
ac74cce
to save changes
likholat Apr 30, 2020
4c42ec0
fix comments
likholat Apr 30, 2020
c6f4e93
fix comment
likholat Apr 30, 2020
46d2b01
fit comments
likholat Apr 30, 2020
86ed664
fixes
likholat Apr 30, 2020
b67f5cb
fix comments
likholat May 7, 2020
a9b0807
fix comments
likholat May 7, 2020
868e2c3
fix comments
likholat May 8, 2020
bf25e8b
fix comments
likholat May 8, 2020
44216c7
fix comments
likholat May 15, 2020
7fe4a96
fix coments
likholat May 20, 2020
bdc3784
fix coments
likholat May 21, 2020
e7830ae
fix comments
likholat May 22, 2020
97257e4
fix comments
likholat Jun 1, 2020
8b69285
Merge pull request #1 from likholat/tensorflow_test
likholat Jun 1, 2020
1f5e845
fixes
likholat Jun 22, 2020
63e2d30
fixes
likholat Jun 22, 2020
287ab61
fixes
likholat Jun 22, 2020
62bdc48
fixes
likholat Jun 22, 2020
0879df1
first commit
likholat May 20, 2020
46f3d0b
fixed comments
likholat Jun 23, 2020
f517ae6
quantisation added
likholat Jun 24, 2020
ef9440d
fixed metric
likholat Jun 24, 2020
6abc8e7
fixed comments
likholat Jun 24, 2020
be62f6a
fixed comments
likholat Jun 24, 2020
7896659
fixed comments
likholat Jun 24, 2020
06e1931
estimated accuracy added
likholat Jun 25, 2020
6f8284b
fixed comments
likholat Jun 25, 2020
e282f47
fixes
likholat Jun 25, 2020
a189342
fixes
likholat Jun 25, 2020
1a4c4f0
fixes
likholat Jun 25, 2020
07ba1c6
fixes
likholat Jun 25, 2020
b40879b
fixes
likholat Jun 25, 2020
779b5b5
fixes
likholat Jun 25, 2020
6c59cd3
fixes
likholat Jun 25, 2020
b5ceb2b
Merge pull request #2 from likholat/openvino_test
likholat Jul 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
classification constructor added
  • Loading branch information
likholat committed Apr 30, 2020
commit e7f8fb5c5ebd9a13f721b66df816e012db66f725
17 changes: 9 additions & 8 deletions classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
import cv2 as cv

class Classification:
def sigmoid(x):
return 1 / (1 + np.exp(-x))
graph = None

def load_pb(path_to_pb):
def __init__(self, path_to_pb):
with tf.io.gfile.GFile(path_to_pb, "rb") as f:
graph_def = tf.compat.v1.GraphDef()
graph_def.ParseFromString(f.read())
return graph_def
self.graph = graph_def

def sigmoid(x):
return 1 / (1 + np.exp(-x))

def classify(graph, imgPath):
def classify(self, img):
image_mean = 127.5
image_std = 127.5
image_size_x = 299
Expand All @@ -22,11 +24,10 @@ def classify(graph, imgPath):
input_node = 'input:0'

with tf.compat.v1.Session() as sess:
tf.import_graph_def(graph, name = "")
tf.import_graph_def(self.graph, name = "")
g = self.graph
prob_tensor = sess.graph.get_tensor_by_name(output_layer)

img = cv.imread(imgPath)

img = cv.resize(img, (image_size_x, image_size_y))
img = np.expand_dims(img, axis=0)
img = (img - image_mean) / image_std
Expand Down
6 changes: 4 additions & 2 deletions evaluate_tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import numpy as np
import argparse
from classification import Classification
import cv2 as cv

def main():
parser = argparse.ArgumentParser()
Expand All @@ -11,7 +12,7 @@ def main():
parser.add_argument('--rightVals', help='.txt val path', default='val.txt')
argv = parser.parse_args()

graph = Classification.load_pb(argv.graph)
graph = Classification(argv.graph)

with open(argv.labels, 'rt') as f:
labels = f.read().strip().split('\n')
Expand All @@ -26,8 +27,9 @@ def main():

for i in range(size):
imgPath = argv.databasePath + vals[i].rsplit(' ')[0]
img = cv.imread(imgPath)
val = int(vals[i].rsplit(' ')[1])
results = Classification.classify(graph, imgPath)
results = graph.classify(img)

if val == (results[0] - 1):
top_1 += 1
Expand Down