Commit 2ec241c5 authored by robinechuca's avatar robinechuca
Browse files

ajout images resultat

parent b6c2fa12
......@@ -1066,6 +1066,7 @@ try:
objets = Objects()
except ImportError:
objets = None
import matplotlib.pyplot as plt
def timer(f):
def fonct(*args, **kwargs):
......@@ -1147,8 +1148,10 @@ class Critere:
# softmax_tensor = sess.graph.get_tensor_by_name("softmax:0")
# predictions = np.squeeze(sess.run(softmax_tensor, {'DecodeJpeg/contents:0': image_data}))
# return predictions
return objets.predict(image_data)
if hasattr(self, "save_objects"):
return self.save_objects
self.save_objects = objets.predict(image_data)
return self.save_objects
def dist_mean(self, other):
"""
......@@ -1240,23 +1243,19 @@ def main():
criters = [
Critere(chemin)
for chemin in glob.iglob("../../labsessions/lab1/input/*.jpg")]
rang = random.randint(0, len(criters)-1)
ref, others = criters[rang], criters[:rang] + criters[rang+1:]
# for im in criters:
# if im.is_natural():
# im.show()
import matplotlib.pyplot as plt
while 1:
rang = random.randint(0, len(criters)-1)
ref, others = criters[rang], criters[:rang] + criters[rang+1:]
plt.subplot(2, 3, 1)
plt.imshow(ref.image[..., ::-1], vmin=0, vmax=255)
plt.subplot(2, 3, 1)
plt.imshow(ref.image[..., ::-1], vmin=0, vmax=255)
bests = sorted(others, key=lambda other: ref.dist_global(other, objects=1))[:5]
for i, best in enumerate(bests):
plt.subplot(2, 3, i+2)
plt.imshow(best.image[..., ::-1], vmin=0, vmax=255)
plt.show()
bests = sorted(others, key=lambda other: ref.dist_global(other, objects=1))[:5]
for i, best in enumerate(bests):
plt.subplot(2, 3, i+2)
plt.imshow(best.image[..., ::-1], vmin=0, vmax=255)
plt.show()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment