Skip to content

Accuracy degradation when converting weights to --fp16 with trtexec. #17

@rodneyML

Description

@rodneyML

I have successfully converted EfficientTAM to TensorRT (from ONNX) thanks for the tips @okideal in #7 , but I am seeing a very strange issue with the image_encoder if I use trtexec with --fp16. It degrades the accuracy by A LOT when --fp16 is used. This is the first time I am seeing this with a model converted to --fp16 (normally the accuracy degrades, but by a negligible margin).

To confirm this was indeed because of --fp16, I have built it with the normal (fp32) and --fp16. I also set the LayerNorm nodes and their inputs/outputs to trt.DataType.FLOAT of the --fp16 model, but still no luck. It seems that if I set all of the layers containing blocks in the name to trt.DataType.FLOAT, it works fine (but that is basically the whole image encoder).

Here are some screenshots of the accuracy degradation (on a still image):

FP16 version FP32 version
Image Image

@yformer Do you know what might be the issue with converting the image encoder weights to FP16 ?
@okideal Did you encounter similar issues with your setup or did you just leave it in fp32?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions