Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make empty output type stable and have correct empty shape #61

Merged
merged 1 commit into from
Mar 28, 2021

Conversation

IanButterworth
Copy link
Collaborator

@IanButterworth IanButterworth commented Mar 28, 2021

The output when no detections were made was unnecessarily type unstable, returning a CUDA array if GPU enabled, and for no real reason resolved to a different empty array size.
Given that the end filtering always happens on cpu, this can be simplified to always return Matrix{Float32} with the correct dim 1 size based on the model class count + standard params.

On a CPU-only machine

Master

No detections

julia> yolomod(batch, detectThresh=0.5, overlapThresh=0.8)
Any[]

1 detection

julia> yolomod(batch, detectThresh=0.5, overlapThresh=0.8)
89×1 Matrix{Float32}

This PR

No detections

julia> yolomod(batch, detectThresh=0.5, overlapThresh=0.8)
89×0 Matrix{Float32}

1 detection

julia> yolomod(batch, detectThresh=0.5, overlapThresh=0.8)
89×1 Matrix{Float32}

@IanButterworth IanButterworth changed the title Make empty output type stable Make empty output type stable and have correct empty shape Mar 28, 2021
@IanButterworth IanButterworth merged commit 9fbeda7 into master Mar 28, 2021
@IanButterworth IanButterworth deleted the ib/empty_out_type_stable branch March 28, 2021 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant