Skip to content

Commit

Permalink
添加返回的Json和传入的参数
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer121121 committed Jan 8, 2019
1 parent 2598bda commit 134a4e8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
matplotlib.use('agg')
import matplotlib.pyplot as plt

def Perter(request):

def Perter(request):
query = request.GET.get("q")
if not query:
query = 777
print("----start-----")
#######################################################################
# Evaluate
Expand Down Expand Up @@ -80,14 +83,15 @@ def sort_img(qf, ql, qc, gf, gl, gc):
index = index[mask]
return index

i = int(777)
i = int(query)
index = sort_img(query_feature[i], query_label[i], query_cam[i], gallery_feature, gallery_label, gallery_cam)

########################################################################
# Visualize the rank result

query_path, _ = image_datasets['query'].imgs[i]
query_label = query_label[i]
imgs = []
print(query_path)
print('Top 10 images are as follow:')
try: # Visualize Ranking Result
Expand All @@ -106,7 +110,9 @@ def sort_img(qf, ql, qc, gf, gl, gc):
ax.set_title('%d' % (i + 1), color='green')
else:
ax.set_title('%d' % (i + 1), color='red')
imgs.append(img_path)
print(img_path)
return JsonResponse({'result': result})
except RuntimeError:
for i in range(10):
img_path = image_datasets.imgs[index[i]]
Expand Down

0 comments on commit 134a4e8

Please sign in to comment.