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

[QUESTION] Invalid data type of cvcuda.nms() function #118

Open
ElinLiu0 opened this issue Nov 10, 2023 · 3 comments
Open

[QUESTION] Invalid data type of cvcuda.nms() function #118

ElinLiu0 opened this issue Nov 10, 2023 · 3 comments
Assignees
Labels
? - needs triage question Further information is requested

Comments

@ElinLiu0
Copy link

What is your question?
Here is the question:the cvcuda.nms() function from documentation here
need those below attributes to calculate:

  • src boxes Tensor : nvcv.Tensor
  • scores Tensor : nvcv.Tensor
  • score Threshold : float
  • iou Threshold : float
    I got all the input attributes with these construction code :
# Copy a clone for Tensor Construction
boxes_clone = boxes.copy()
scores_clone = scores.copy()
boxes_clone = torch.tensor(boxes_clone,device="cuda",dtype=torch.int32)
boxes_clone = nvcv.as_tensor(boxes_clone)
scores_clone = torch.tensor(scores_clone,device="cuda",dtype=torch.float32)
scores_clone = nvcv.as_tensor(scores_clone)


print(type(boxes_clone),type(scores_clone),type(self.confidenceThreshold),type(self.iouThreshold))
# Apply NMS CUDA Function
indices = cvcuda.nms(boxes_clone,scores)

print(indices)

But it raise me a InvokingError message like below:

nms(): incompatible function arguments. The following argument types are supported:
    1. (src: nvcv.Tensor, scores: nvcv.Tensor, score_threshold: float = 1.1920928955078125e-07, iou_threshold: float = 1.0, *, stream: Optional[nvcv.cuda.Stream] = None) -> nvcv.Tensor

Invoked with: <nvcv.Tensor shape=(164, 4) dtype=int32>, array([0.7586603 , 0.7097081 , 0.767958  , 0.78236204, 0.72838205,
       0.75135577, 0.75455606, 0.7190855 , 0.71297336, 0.82068956,
       0.7697949 , 0.78868264, 0.85104907, 0.7875968 , 0.7872595 ,
       0.86548656, 0.77008224, 0.7904344 , 0.7711759 , 0.7773221 ,
       0.76164293, 0.804789  , 0.8095949 , 0.7529364 , 0.8072941 ,
       0.8178994 , 0.703524  , 0.7738    , 0.7346774 , 0.7577837 ,
       0.7631812 , 0.8363519 , 0.76603943, 0.72979015, 0.7744066 ,
       0.77776486, 0.8415555 , 0.84321684, 0.8475255 , 0.74649525,
       0.7497457 , 0.7415061 , 0.8393519 , 0.8238603 , 0.82412285,
       0.74750257, 0.7030225 , 0.7291994 , 0.8311529 , 0.8128832 ,
       0.8061417 , 0.8527547 , 0.80295044, 0.79725283, 0.7942991 ,
       0.8023775 , 0.8073451 , 0.8075176 , 0.797567  , 0.7897532 ,
       0.7954175 , 0.810892  , 0.763571  , 0.8016494 , 0.7373098 ,
       0.77551764, 0.7829293 , 0.7970046 , 0.78473973, 0.79149765,
       0.75949925, 0.74192935, 0.8026274 , 0.7872242 , 0.7483539 ,
       0.8232488 , 0.79359096, 0.80303806, 0.8006276 , 0.735693  ,
       0.738103  , 0.81427705, 0.8062424 , 0.81192076, 0.8231721 ,
       0.8422905 , 0.7103702 , 0.74524415, 0.75137806, 0.8359127 ,
       0.83796084, 0.81999135, 0.7893438 , 0.8124736 , 0.76678663,
       0.7583429 , 0.70672303, 0.70196605, 0.716085  , 0.84689456,
       0.8341809 , 0.8348576 , 0.8163886 , 0.77195305, 0.7660649 ,
       0.876741  , 0.8607939 , 0.8236254 , 0.8343361 , 0.82574046,
       0.78387064, 0.78737396, 0.76560295, 0.87557435, 0.8643305 ,
       0.88600373, 0.8406993 , 0.8318555 , 0.86225355, 0.89372563,
       0.8801202 , 0.81545967, 0.8624695 , 0.8599481 , 0.8590247 ,
       0.88619626, 0.8880276 , 0.8758006 , 0.8741057 , 0.8697329 ,
       0.88414127, 0.8797039 , 0.8760199 , 0.88666004, 0.89366215,
       0.875077  , 0.75500464, 0.88037455, 0.8924499 , 0.88381225,
       0.8576473 , 0.86270386, 0.85533917, 0.8101083 , 0.8530666 ,
       0.8395133 , 0.84177613, 0.8450767 , 0.8457641 , 0.85781676,
       0.8484809 , 0.8510436 , 0.8571972 , 0.8495828 , 0.9065145 ,
       0.923493  , 0.91902345, 0.91615033, 0.9284622 , 0.9181302 ,
       0.92227095, 0.92974496, 0.91810983, 0.9094186 ], dtype=float32)
  File "/root/modelTraining/Apps/GPUClient/VideoProcessorGPU.py", line 102, in postprocess
    indices = cvcuda.nms(boxes_clone,scores)
  File "/root/modelTraining/Apps/GPUClient/test.py", line 14, in <module>
    processor.postprocess(
TypeError: nms(): incompatible function arguments. The following argument types are supported:
    1. (src: nvcv.Tensor, scores: nvcv.Tensor, score_threshold: float = 1.1920928955078125e-07, iou_threshold: float = 1.0, *, stream: Optional[nvcv.cuda.Stream] = None) -> nvcv.Tensor

Invoked with: <nvcv.Tensor shape=(164, 4) dtype=int32>, array([0.7586603 , 0.7097081 , 0.767958  , 0.78236204, 0.72838205,
       0.75135577, 0.75455606, 0.7190855 , 0.71297336, 0.82068956,
       0.7697949 , 0.78868264, 0.85104907, 0.7875968 , 0.7872595 ,
       0.86548656, 0.77008224, 0.7904344 , 0.7711759 , 0.7773221 ,
       0.76164293, 0.804789  , 0.8095949 , 0.7529364 , 0.8072941 ,
       0.8178994 , 0.703524  , 0.7738    , 0.7346774 , 0.7577837 ,
       0.7631812 , 0.8363519 , 0.76603943, 0.72979015, 0.7744066 ,
       0.77776486, 0.8415555 , 0.84321684, 0.8475255 , 0.74649525,
       0.7497457 , 0.7415061 , 0.8393519 , 0.8238603 , 0.82412285,
       0.74750257, 0.7030225 , 0.7291994 , 0.8311529 , 0.8128832 ,
       0.8061417 , 0.8527547 , 0.80295044, 0.79725283, 0.7942991 ,
       0.8023775 , 0.8073451 , 0.8075176 , 0.797567  , 0.7897532 ,
       0.7954175 , 0.810892  , 0.763571  , 0.8016494 , 0.7373098 ,
       0.77551764, 0.7829293 , 0.7970046 , 0.78473973, 0.79149765,
       0.75949925, 0.74192935, 0.8026274 , 0.7872242 , 0.7483539 ,
       0.8232488 , 0.79359096, 0.80303806, 0.8006276 , 0.735693  ,
       0.738103  , 0.81427705, 0.8062424 , 0.81192076, 0.8231721 ,
       0.8422905 , 0.7103702 , 0.74524415, 0.75137806, 0.8359127 ,
       0.83796084, 0.81999135, 0.7893438 , 0.8124736 , 0.76678663,
       0.7583429 , 0.70672303, 0.70196605, 0.716085  , 0.84689456,
       0.8341809 , 0.8348576 , 0.8163886 , 0.77195305, 0.7660649 ,
       0.876741  , 0.8607939 , 0.8236254 , 0.8343361 , 0.82574046,
       0.78387064, 0.78737396, 0.76560295, 0.87557435, 0.8643305 ,
       0.88600373, 0.8406993 , 0.8318555 , 0.86225355, 0.89372563,
       0.8801202 , 0.81545967, 0.8624695 , 0.8599481 , 0.8590247 ,
       0.88619626, 0.8880276 , 0.8758006 , 0.8741057 , 0.8697329 ,
       0.88414127, 0.8797039 , 0.8760199 , 0.88666004, 0.89366215,
       0.875077  , 0.75500464, 0.88037455, 0.8924499 , 0.88381225,
       0.8576473 , 0.86270386, 0.85533917, 0.8101083 , 0.8530666 ,
       0.8395133 , 0.84177613, 0.8450767 , 0.8457641 , 0.85781676,
       0.8484809 , 0.8510436 , 0.8571972 , 0.8495828 , 0.9065145 ,
       0.923493  , 0.91902345, 0.91615033, 0.9284622 , 0.9181302 ,
       0.92227095, 0.92974496, 0.91810983, 0.9094186 ], dtype=float32)

I don't know what's wrong with my input,any answer for that?

@ElinLiu0 ElinLiu0 added ? - needs triage question Further information is requested labels Nov 10, 2023
@AnimeDalit97
Copy link

I found some limitations in here

I think you need to convert the input tensor to int16

@ElinLiu0
Copy link
Author

I found some limitations in here

I think you need to convert the input tensor to int16

thanks,but i still have some trouble need to deal with:because my environment will always raise a error:libstdc++-v3/src/c++11/codecvt.cc not found,even though i reinstall the WSL2 vm,this error still there,do you have any idea of that?

@bhaefnerNV
Copy link

Hi @ElinLiu0,

Thank you for your interest in CVCUDA.

It seems that you invoke the nms operator with scores, which, according to your example, is an array and not an nvcv.Tensor? I guess you could invoke nms with scores_clone, which is an nvcv.Tensor:
cvcuda.nms(boxes_clone,scores) -> cvcuda.nms(boxes_clone,scores_clone)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
? - needs triage question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants