ChuRuaNh0 / FastSam_Awsome_TensorRT

105 stars 11 forks source link

rookie:run inference_trt.py utils.py error #6

Open Haroldhy opened 1 year ago

Haroldhy commented 1 year ago

Traceback (most recent call last): File "F:\hy\FastSam_Awsome_TensorRT\inference_trt.py", line 100, in masks = model.segment(img) File "F:\hy\FastSam_Awsome_TensorRT\inference_trt.py", line 92, in segment image_with_masks = segment_everything(bgr_img, result, input_size=self.imgsz) File "F:\hy\FastSam_Awsome_TensorRT\utils.py", line 382, in segment_everything input_size = int(input_size) # 确保 imgsz 是整数 TypeError: int() argument must be a string, a bytes-like object or a number, not 'tuple' [07/12/2023-10:48:01] [TRT] [E] 1: [defaultAllocator.cpp::nvinfer1::internal::DefaultAllocator::deallocate::42] Error Code 1: Cuda Runtime (invalid argument)

the input size is [1024,1024].I cannot make input_size = 1024,because other places has "w,h = inputsize".Can anyone help?

ChuRuaNh0 commented 1 year ago

you have to convert to trt with size you want.

Haroldhy commented 1 year ago

May I ask about your numpy version?I have encountered many problems about codes using numpy. for example, w, h = input.size In my computer, input.size is a number so that error occurred.

Haroldhy commented 1 year ago

我跑出来最后的结果(trt)和原来pytorch模型跑出来的结果不一样,感觉效果变差了一点,虽然不多,但感觉还是有影响的。 作者有遇到类似的情况吗?谢谢

ChuRuaNh0 commented 1 year ago

@Haroldhy Yes, It's a given. When you convert pt 2 trt, some parameters will change.

mytk2012 commented 12 months ago

Have you solved it? I met the same problem. And i have changed the input size of trt to 320*320.

Haroldhy commented 12 months ago

@mytk2012 你说的是哪一个问题?是关于报错的问题吗?还是效果变差的问题

mytk2012 commented 12 months ago

the fix of error:the input size is [1024,1024].I cannot make input_size = 1024,because other places has "w,h = inputsize".

Haroldhy commented 12 months ago

我怀疑是numpy版本的问题。你要修改一下那一个文件的这一段代码,这段代码的逻辑是没问题的。然后我记得还需要修改某个函数的输入,否则输出图像的形状可能会有问题。

mytk2012 commented 11 months ago

@mytk2012 你说的是哪一个问题?是关于报错的问题吗?还是效果变差的问题

效果差很多啊,int8的时候