Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. def example():
  2. i = 0
  3. resultlist_key = []
  4. result_list = list()
  5. a_list = list()
  6. b_list = list()
  7. a_list.append(feature_matrix_ip)# feature_matrix_ip contains features of the query image
  8. while i < 70:
  9. b_list.append(feature_matrix_db[i])# feature_matrix_db contains features of img. in DB
  10. dist = distance.euclidean(a_list,b_list[i])
  11. result_list.append(dist)
  12. resultlist_key = OrderedDict(sorted(enumerate(result_list),key=lambda x: x[0])).keys()
  13. i = i + 1
  14. res_lst_srt = {'values': result_list,'keys':resultlist_key}
  15. res_lst_srt['values'], res_lst_srt['keys'] = zip(*sorted(zip(res_lst_srt['values'], res_lst_srt['keys'])))# sorting according to the least distance and the key will not change
  16. key = res_lst_srt['keys']
  17.  
  18. %run "D:/6th sem/Major project/Code/frame.py"
  19. Exception in Tkinter callback
  20. Traceback (most recent call last):
  21. File "C:UsersHPAppDataLocalEnthoughtCanopy32Appappdatacanopy-1.0.3.1262.win-x86liblib-tkTkinter.py", line 1410, in __call__
  22. return self.func(*args)
  23. File "D:6th semMajor projectCodeframe.py", line 323, in matching_image
  24. res_lst_srt['values'], res_lst_srt['keys'] = zip(*sorted(zip(res_lst_srt['values'], res_lst_srt['keys'])))
  25.  
  26. ValueError: need more than 0 values to unpack
  27.  
  28. >>> foo, bar = []
  29. Traceback (most recent call last):
  30. File "<stdin>", line 1, in <module>
  31. ValueError: need more than 0 values to unpack
  32.  
  33. >>> values=[1,2,3]
  34. >>> keys=['a', 'b', 'c']
  35. >>> my_dict = dict(zip(keys, values))
  36. >>> my_dict
  37. {'a': 1, 'c': 3, 'b': 2}
  38.  
  39. >>> a, b = tuple() # or you could write a, b = []
  40.  
  41. Traceback (most recent call last):
  42. File "<pyshell#319>", line 1, in <module>
  43. a, b = tuple()
  44. ValueError: need more than 0 values to unpack
  45. >>>
  46.  
  47. zip(*sorted(zip(res_lst_srt['values'], res_lst_srt['keys'])))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement