mit-han-lab / efficientvit

EfficientViT is a new family of vision models for efficient high-resolution vision.
Apache License 2.0
1.59k stars 141 forks source link

What does this parameter mean #85

Open ghm666 opened 3 months ago

ghm666 commented 3 months ago

hi Thank you so much for your code

Export Decoder

trtexec --onnx=assets/export_models/sam/onnx/xl1_decoder.onnx --minShapes=point_coords:1x1x2,point_labels:1x1 --optShapes=point_coords:16x2x2,point_labels:16x2 --maxShapes=point_coords:16x2x2,point_labels:16x2 --fp16 --saveEngine=assets/export_models/sam/tensorrt/xl1_decoder.engine

What does this parameter mean point_coords:1x1x2,point_labels:1x1 point_coords:16x2x2,point_labels:16x2

zhuoyang20 commented 3 months ago

Hi ghm666,

It determines the minimum and maximum number of points/boxes that the TensorRT engine can accept. A single point's coordinate is formatted as 1x1x2, and its label is formatted as 1x1. A single box's coordinate is formatted as 1x2x2, and its label is formatted as 1x2. By configuring the maxShapes as 16x2x2 for coordinates and 16x2 for labels, the engine can process a maximum of 16 points/boxes simultaneously. If you need to process more, you can increase this number.

Best, Zhuoyang

ghm666 commented 3 months ago

@zhuoyang20 Thank you very much for your reply

python vit_trt_inference.py --model xl1 --encoder_engine ./xl1_encoder.engine --decoder_engine ./xl1_decoder.engine --mode point --point [[[510,356,1],[749,748,0],[100,100,1]]] --img_path ./images/test_3.JPEG --out_path ./vit_trt_img.png

I performed a 3-point inference using the tensorRT model, and the following error occurred

[03/18/2024-09:53:16] [TRT] [E] 3: [executionContext.cpp::validateInputBindings::2016] Error Code 3: API Usage Error (Parameter check failed at: runtime/api/executionContext.cpp::validateInputBindings::2016, condition: profileMaxDims.d[i] >= dimensions.d[i]. Supplied binding dimension [1,3,2] for bindings[1] exceed min ~ max range at index 1, maximum dimension in profile is 2, minimum dimension in profile is 1, but supplied dimension is 3. )

[03/18/2024-09:53:16] [TRT] [E] 3: [executionContext.cpp::validateInputBindings::2016] Error Code 3: API Usage Error (Parameter check failed at: runtime/api/executionContext.cpp::validateInputBindings::2016, condition: profileMaxDims.d[i] >= dimensions.d[i]. Supplied binding dimension [1,3] for bindings[2] exceed min ~ max range at index 1, maximum dimension in profile is 2, minimum dimension in profile is 1, but supplied dimension is 3. )