Compile opencv with cuda support

From Simon's Help System
Revision as of 14:06, 21 January 2024 by Simon (talk | contribs) (Created page with "https://www.youtube.com/watch?v=art0-99fFa8 https://github.com/mdegans/nano_build_opencv/tree/master You want to change line 114 in opencv/modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp: from: <pre> if (weight != 1.0)</pre> to: <pre> if (weight != static_cast<T>(1.0))</pre> As well as line 124 in opencv/modules/dnn/src/cuda4dnn/primitives/region.hpp (due to a similar error): from: <pre> if (nms_iou_threshold > 0) {</pre> to: <pre> if (nms_iou_threshold > stat...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

https://www.youtube.com/watch?v=art0-99fFa8

https://github.com/mdegans/nano_build_opencv/tree/master


You want to change line 114 in opencv/modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp: from:

if (weight != 1.0)

to:

if (weight != static_cast<T>(1.0))

As well as line 124 in opencv/modules/dnn/src/cuda4dnn/primitives/region.hpp (due to a similar error): from:

if (nms_iou_threshold > 0) {

to:

if (nms_iou_threshold > static_cast<T>(0)) {

Explanation: Since both variables, weight and nms_iou_threshold, are templated and finally boil down to a primitive type during compilation, it is meaningful to use a static_cast to convert the respective constant (1.0 (by default double) and 0 (by default int)) to the template type. Based on the operator candidates the required types should all be compatible, i.e., the constant values are safe to be casted to the target template type.