Skip to content

Commit

Permalink
Fix sorting precision by confidence scores
Browse files Browse the repository at this point in the history
When sorting a float number as text, strings like '1.0169535613613334e-07' will not be interpreted as expected.
  • Loading branch information
viniciusarruda authored Oct 11, 2018
1 parent 847326b commit 5c4d59d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def draw_plot_func(dictionary, n_classes, window_title, plot_title, x_label, out
bounding_boxes.append({"confidence":confidence, "file_id":file_id, "bbox":bbox})
#print(bounding_boxes)
# sort predictions by decreasing confidence
bounding_boxes.sort(key=lambda x:x['confidence'], reverse=True)
bounding_boxes.sort(key=lambda x:float(x['confidence']), reverse=True)
with open(tmp_files_path + "/" + class_name + "_predictions.json", 'w') as outfile:
json.dump(bounding_boxes, outfile)

Expand Down

0 comments on commit 5c4d59d

Please sign in to comment.