Skip to content

Predicted labels print in incorrect order #17

Open
@jacobmanning

Description

@jacobmanning

There is a bug here causing predicted labels to be printed in incorrect order. Traversing a java.util.PriorityQueue with a range-based for loop does not guarantee traversal in sorted order. Fixed by converting PQ to array, sorting array with PQ.comparator(), and returning the results in sorted order.

More information on the undefined behavior of traversing PQ here.

I just put in a pull request to fix this issue in the similar Codelabs TF image classifier repo. The same fix to TensorFlowHelper.java will work here.

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