android-demo-app icon indicating copy to clipboard operation
android-demo-app copied to clipboard

object_detection demo the argsort is wrong

Open delongwu opened this issue 2 years ago • 1 comments

hi, the comparator in [nonMaxSuppression] function of pytorch/demo/objectdetection)/PrePostProcessor.java is asc order, not desc order. it is just oppositive than swift comparator. the right one in java is :

  // Do an argsort on the confidence scores, from high to low.
    Collections.sort(boxes,
            new Comparator<Result>() {
                @Override
                public int compare(Result o1, Result o2) {
                    return o2.score.compareTo(o1.score);
                }
            });

delongwu avatar Jul 20 '22 02:07 delongwu

Hi, that seems to be the case! We were experiencing much lower confidence scores in the mobile app with respect to GPU. This fix apparently did the trick.

FabrizioPe avatar Mar 29 '23 12:03 FabrizioPe