achterbrain commited on
Commit
982eb46
β€’
1 Parent(s): 6970404

fixed error in DETR counting function

Browse files
pages/Functions/Assessment_functions.py CHANGED
@@ -179,6 +179,10 @@ def DETR_multi_object_counting(img, object_classes, object_counts, confidence_tr
179
 
180
  # Return False is the count for a given label does not match
181
  for i_item in label_dict.items():
 
 
 
 
182
  if int(count_dict[i_item[0]])==int(i_item[1]): # Adding type control for comparison due to str read in
183
  print(str(i_item)+'_true')
184
  else:
 
179
 
180
  # Return False is the count for a given label does not match
181
  for i_item in label_dict.items():
182
+ # Check whether current label item exists in count dict, else return false
183
+ if i_item[0] not in count_dict:
184
+ return False
185
+ # Now that we checked the label item is in count dict, check that the count matches
186
  if int(count_dict[i_item[0]])==int(i_item[1]): # Adding type control for comparison due to str read in
187
  print(str(i_item)+'_true')
188
  else: