Skip to content

Unnecessary calculations which add then subtract same variable #18

Description

@swdee

In the following code there are unnecessary calculations being performed as the same variable cancels itself out.

const float ua = (tlwh[0] + tlwh[2] - tlwh[0] + 1) * (tlwh[1] + tlwh[3] - tlwh[1] + 1) + box_area - iw * ih;

Instead it should be.

 const float ua = (tlwh[2] + 1) * (tlwh[3] + 1) + box_area - iw * ih; 

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