Skip to content

take into account confidences when selecting final match for most* strategy #36

@hqhoang

Description

@hqhoang

For frame_strategy of "most", "most_models", and "most_unique", since we have to loop through all the matches anyway, might as well take into consideration the confidences to pick out the best. For example, if three matches all have 1 detected object, the match with the highest confidence should be selected instead of the first one.

It's obviously more complicated when there are multiple detected objects, perhaps compare the sum of the confidences as a simple criteria. Something like this?

for idx,item in enumerate(all_matches):
  if  ((frame_strategy == 'first') or
  ((frame_strategy == 'most') and (len(item['labels']) > len(matched_l))) or
  ((frame_strategy == 'most') and (len(item['labels']) == len(matched_l)) and (sum(matched_c) < sum(item['confidences']))) or
  ((frame_strategy == 'most_models') and (len(item['detection_types']) > len(matched_detection_types))) or
  ((frame_strategy == 'most_models') and (len(item['detection_types']) == len(matched_detection_types)) and (sum(matched_c) < sum(item['confidences']))) or
  ((frame_strategy == 'most_unique') and (len(set(item['labels'])) > len(set(matched_l)))) or
  ((frame_strategy == 'most_unique') and (len(set(item['labels'])) == len(set(matched_l))) and (sum(matched_c) < sum(item['confidences'])))):

I've been testing the above mod in my local installation and it seems to work well in picking out the best detected frame for better accuracy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions