microsoft / microsoft/onnxruntime
Dubious implementation of ROIAlign in 'max' mode
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 184
Description
There are cases, when the results of ROIAlign may be significally different from expected.
Implementation of ROIAlign runs questionably in MAX mode.
https://github.com/microsoft/onnxruntime/blob/7f9d9557b1f4a427dbffa7265af2f478034bcc2f/onnxruntime/core/providers/cpu/object_detection/roialign.cc#L216
I.e., when weighed data feature_map is collected, we commit MAX - operation to all collected data.
So, we return one of weighed value (by [0, 1] - coefficient), which is assuredly less, then all interpolated values.
In the case of centered coordinates of sampling point, nearly 1/4 from expected value is returned.
We need instead, at first, commit interpolation, and afterwards given type of operation (AVG or MAX).
Suggested algorithm is similar to Caffe implementation.


Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in onnxruntime/core/providers/cpu/object_detection/roialign.cc around line 216 and inspect how sampled feature-map values are combined in MAX mode. Compare the behavior with the Caffe implementation referenced in the issue, focusing on interpolation before the reduction. Done means MAX mode returns the expected maximum of interpolated values rather than a weighted input value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100