Open
Conversation
20250416
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have updated the PyTorch and TensorRT inference sample code. The results can be checked below, and the currently identified issue is that the TensorRT inference results show slight discrepancies. Further adjustments are required, and the sample code should be used for reference purposes only.
Key Points:
Sample code updated for PyTorch/TensorRT inference
TensorRT outputs exhibit minor inconsistencies (needs refinement)
Experimental stage — verify results before deployment
pip install tensorrt-cu12 cuda-python pycuda
※ I tested this setup with Python 3.11, torch 2.5.1+cu121, CUDA 12.1, and TensorRT 10.9. Please note that you may need to install TensorRT 10.9 separately instead of using pip install. I'm sorry that the code isn't complete.
ONNX Result
00000 | 595.3686237335205 ms | Image: 004, Anomaly Score: 0.3086
00001 | 103.70206832885742 ms | Image: 002, Anomaly Score: 0.3567
00002 | 102.04100608825684 ms | Image: 018, Anomaly Score: 0.3324
00003 | 102.7829647064209 ms | Image: 008, Anomaly Score: 0.3066
00004 | 101.47380828857422 ms | Image: 011, Anomaly Score: 0.2808
00005 | 100.68964958190918 ms | Image: 000, Anomaly Score: 0.3425
00006 | 100.78644752502441 ms | Image: 001, Anomaly Score: 0.3089
00007 | 100.05760192871094 ms | Image: 014, Anomaly Score: 0.3014
00008 | 101.07970237731934 ms | Image: 016, Anomaly Score: 0.3057
00009 | 103.20234298706055 ms | Image: 006, Anomaly Score: 0.3094
00010 | 102.74052619934082 ms | Image: 017, Anomaly Score: 0.2981
00011 | 105.89814186096191 ms | Image: 003, Anomaly Score: 0.3535
00012 | 103.76238822937012 ms | Image: 013, Anomaly Score: 0.2942
00013 | 101.75347328186035 ms | Image: 009, Anomaly Score: 0.2592
00014 | 127.05779075622559 ms | Image: 010, Anomaly Score: 0.3185
00015 | 107.2390079498291 ms | Image: 007, Anomaly Score: 0.3066
00016 | 108.24441909790039 ms | Image: 019, Anomaly Score: 0.2923
00017 | 106.25267028808594 ms | Image: 012, Anomaly Score: 0.2557
00018 | 103.95479202270508 ms | Image: 005, Anomaly Score: 0.3261
00019 | 108.18338394165039 ms | Image: 015, Anomaly Score: 0.2911
TRT Result
00000 | 139.35 ms | Image: 004, Score: 0.3339
00001 | 97.73 ms | Image: 002, Score: 0.3769
00002 | 93.88 ms | Image: 018, Score: 0.3679
00003 | 95.98 ms | Image: 008, Score: 0.3183
00004 | 95.63 ms | Image: 011, Score: 0.3063
00005 | 94.87 ms | Image: 000, Score: 0.3677
00006 | 95.44 ms | Image: 001, Score: 0.3435
00007 | 93.76 ms | Image: 014, Score: 0.3250
00008 | 94.06 ms | Image: 016, Score: 0.3253
00009 | 94.59 ms | Image: 006, Score: 0.3426
00010 | 94.76 ms | Image: 017, Score: 0.3201
00011 | 95.95 ms | Image: 003, Score: 0.3690
00012 | 95.12 ms | Image: 013, Score: 0.3146
00013 | 96.25 ms | Image: 009, Score: 0.2840
00014 | 96.11 ms | Image: 010, Score: 0.3539
00015 | 97.61 ms | Image: 007, Score: 0.3384
00016 | 96.04 ms | Image: 019, Score: 0.3152
00017 | 94.86 ms | Image: 012, Score: 0.2786
00018 | 97.17 ms | Image: 005, Score: 0.3903
00019 | 102.38 ms | Image: 015, Score: 0.3302