Int8 problem

The converted fp16 works normally, and the test data set reads a single picture demo normally.
There is no error when converting int8, and the test data set map=0.
There are two normal outputs of onnx-model:
output_loc: 3cc41874
output_conf: 3c1047bf
After doing the int8 calibration data set, there are two more outputs in the cache file:

(Unnamed Layer* 315) [Shuffle]_output: 3d0743b7
(Unnamed Layer* 316) [Softmax]_output: 3c1047bf
The calibration data set adopts 1000 test sets and the calibration map of the entire test set is 0, which eliminates the possibility of errors that the pictures of the calibration data set are not enough.
(So I suspect that there may be an error in the model generated by int8? Onnx_model is needed, which can be provided, and I look forward to your reply.)
TRT-7100-EntropyCalibration2
actual_input_1: 3c001010
445: 3c12acf8
446: 3bc82d2d
447: 3b15afad
448: 3c51feab
449: 3b8e7f30
450: 3b466623
451: 3b1decdd
452: 3b3348d1
453: 3b24e00c
454: 3bea9312
455: 3b7ae264
456: 3b84f39e
457: 3b835f82
458: 3c72f4f5
459: 3b5ebd9b
460: 3b5ebd9b
461: 3b6e5c00
462: 3b1f019b
463: 3b1ec225
464: 3b98f95a
465: 3b68f23a
466: 3b69bea5
467: 3b7e468b
468: 3ba4cb4e
469: 3b0b8267
470: 3af66b2b
471: 3b74925f
472: 3b450a2b
473: 3b22ddac
474: 3b98dd80
475: 3c8de99e
476: 3b46a4f3
477: 3b46a4f3
478: 3b3b3848
479: 3b2e9920
480: 3b73eee3
481: 3c12b7c2
482: 3b5ba624
483: 3b6e1101
484: 3b788846
485: 3be9b30c
486: 3b31ee69
487: 3b11cc9a
488: 3bd1b56b
489: 3b6e316b
490: 3b6dd364
491: 3bd99785
492: 3c000ae7
493: 3bb0e40d
494: 3af5745c
495: 3be4b6d4
496: 3bc1508c
497: 3b4da2fe
498: 3c28100b
499: 3c372562
500: 3bbba737
501: 3aebac6d
502: 3bab99ce
503: 3bb69de0
504: 3ba501b0
505: 3c41acc4
506: 3c4694c9
507: 3bd754c5
508: 3b00eb56
509: 3bb2d072
510: 3beec7dd
511: 3b5eb0bc
512: 3c66b5fa
513: 3c6d4b99
514: 3bb3b8f9
515: 3bac80ac
516: 3b8e7652
517: 3bfb97cd
518: 3bf57d37
519: 3c71a308
520: 3c4910af
521: 3bcc0997
522: 3ba9317b
523: 3bb77012
524: 3bf27054
525: 3bf27054
526: 3c867cf5
527: 3cab8ee9
528: 3bdef309
529: 3bafccd0
530: 3b8ef6b4
531: 3c244ae2
532: 3c244ae2
533: 3c92a66a
534: 3d386d5c
672: 3c92a66a
535: 3c12f6b8
536: 3c0a8a30
537: 3b89e936
538: 3c02c487
539: 3bf3306d
540: 3c20858b
541: 3bd62a70
542: 3b960ae8
543: 3c040dd7
544: 3be7d4fd
545: 3c084d04
546: 3bee817c
547: 3be8b0b7
548: 3be95e8b
549: 3bc66727
550: 3c20bf57
551: 3c05803e
552: 3beb18c1
553: 3bb59871
554: 3bf25d45
555: 3c17bbdd
556: 3be72a0e
557: 3c4616e6
558: 3c38147b
559: 3c0782ac
560: 3be66929
561: 3c0ce715
562: 3bfb9b15
563: 3beed2d3
564: 3c69b36b
565: 3c65aba3
566: 3c0cd43d
567: 3be07b0e
568: 3bd4d342
569: 3c169f61
570: 3bfaceca
571: 3c8b9de9
572: 3c88420f
573: 3c08defd
574: 3c08defd
575: 3bc6db59
576: 3c24afb5
577: 3c0edf49
578: 3c97a2e9
579: 3cd564ba
580: 3c027827
581: 3be7b555
582: 3be73b16
583: 3c3c7aec
584: 3c010547
585: 3cbe8434
586: 3cfe3e3f
587: 3c07a08f
588: 3c0e7514
589: 3beddfa0
590: 3c2e9603
591: 3c198b25
592: 3cec40b2
593: 3d401635
647: 3cdd33bb
594: 3c31509a
595: 3c25a866
596: 3bdcc818
597: 3c43e520
598: 3c0ec945
599: 3c010b84
600: 3c11f07c
601: 3bee8a60
602: 3c3a171e
603: 3beba2fe
604: 3c0ecfed
605: 3c037048
606: 3bd17432
607: 3bf3b1a8
608: 3be73c9d
609: 3c76efbf
610: 3c02a9d9
611: 3c0a8182
612: 3be75c06
613: 3bce9a2c
614: 3bf8d1bc
615: 3c013f85
616: 3c9f569d
617: 3c1a1547
618: 3c09a3d4
619: 3beaf551
620: 3bd76376
621: 3c0a7bb2
622: 3bf8b0d7
623: 3cb64fd7
624: 3cae240f
625: 3c2420d0
626: 3c1311b5
627: 3c133277
628: 3c347c27
629: 3c1e9643
630: 3c17be1e
631: 3c2db765
632: 3c28a00a
633: 3c5ef3e6
634: 3c35a3dd
635: 3c1f22d1
636: 3c5fd9bd
637: 3c3250b4
638: 3c1eaaaa
639: 3d078eda
640: 3c2b639d
641: 3c0432b5
642: 3b8943f2
692: 3ca706a7
694: 3cd524f0
643: 3c2a5f13
693: 3ca706a7
695: 3cd524f0
644: 3c157b57
646: 3cdd33bb
648: 3cdd33bb
649: 3d0d7877
650: 3c241893
711: 3cc41874
736: 3d0743b7
651: 3c060d35
652: 3c301318
653: 3c2b7af7
654: 3c12f83c
655: 3c105347
656: 3c3217e1
657: 3c17b1d9
658: 3c7dd288
659: 3c347c12
660: 3c16d194
661: 3c896210
662: 3c4ccc23
663: 3c24eb1c
664: 3d17c102
665: 3c47722c
666: 3c06b2dd
667: 3bb43d8a
696: 3cb9f1f9
698: 3cfba406
668: 3c495d26
697: 3cb9f1f9
699: 3cfba406
669: 3c5c00a3
671: 3c92a66a
673: 3c92a66a
674: 3d0378f6
675: 3c337747
719: 3cc41874
744: 3d0743b7
676: 3bffef9a
677: 3c551aa1
678: 3c4aecaa
679: 3c1ce860
680: 3c220eac
681: 3c626c62
682: 3c46ef2c
683: 3c8adc19
684: 3c890d95
685: 3c53d0da
686: 3ca3f095
687: 3c5825ac
688: 3c4c077b
689: 3cca7bad
690: 3c40c2bd
691: 3c1d02b6
700: 3cc41874
702: 3d0743b7
701: 3cc41874
703: 3d0743b7
727: 3cc41874
752: 3d0743b7
728: 3cc41874
753: 3d0743b7
765: 3d0743b7
output_loc: 3cc41874
(Unnamed Layer* 315) [Shuffle]_output: 3d0743b7
(Unnamed Layer* 316) [Softmax]_output: 3c1047bf
output_conf: 3c1047bf

Hi, Please refer to the below links to perform inference in INT8

Thanks!

I was able to convert the trt_model fp16 and the reasoning was normal, and I converted the int8’s trt_model with 1000 pictures, but the test map dropped to 0。I would like to ask where there may be a problem, how to debug

Hi @653576489,

Calibration cache is only generated for INT8, not for FP16. Could you please let us know how was first cache file generated?
Also, the calibration cache looks normal at first glance. We would recommend to use setPrecision API to control the layer precision of layers in the model to see if we can identify a layer which might have issue.

Could you please share onnx model and issue reproducible scripts for better assistance.

Thank you.

Uploading: yolov3-darknet53baseline-416.onnx…
calibrator.py (5.9 KB) 19_onnx_to_tensorrt.py (8.7 KB) plugins.py (6.3 KB)

Hello, I uploaded the onnx and the script to generate the calibration file. I think there should be some problems in the layers of onnx, or my post-processing needs to make some changes to int8. However, the output of int8 printed by me is also floating-point, which seems not a post-processing problem. Looking forward to your reply, please contact me if you need anything.Need calibration data set, I can also provide

https://pan.baidu.com/s/1H9-4xdpWaI4X5z4tbnQRAg
l611
Onnx upload failed, I put it in Baidu cloud disk for you to download。I’m surprised that both fp16 and int8 can be converted into TRT model without any error. Why fp16 test normal, int8 test map is equal to 0, looking forward to your reply, thank you.

链接:https://pan.baidu.com/s/1wsf0lGpW1hZoiYc4uYhM6g
提取码:l611
This onnx file has the same error

@spolisetty Hello, you can download the conversion script and onnx file from here。TensorRT - Google Drive

Hi @653576489,

Thank you for sharing model and scripts. We request you to provide steps/commands to run.

@spolisetty python3 19_onnx_to_tensorrt.py -v --int8 -m yolov3-darknet53baseline/mobilenetv2-416
thank you,looking forward to your reply

Hi @653576489,

We tried running scripts you’ve shared. but facing plugins dependency issue. Could you please confirm have you shared all required files.
We also request you to provide following system environment details.

TensorRT Version :
GPU Type :
Nvidia Driver Version :
CUDA Version :
CUDNN Version :
Operating System + Version :
Python Version :
TensorFlow Version (if applicable) :
ONNX_Tensorflow Version :
Onnx Version :

Thank you.

@spolisetty hi ,try this conversion script,Turn out the same error in int8-model, I suspect not script error.onnx-trt.zip (1.4 MB)
python3 20_onnx_to_trt_int8.py
JETSON XAVIER NX:jetpack 4.4
TensorRT:7.1.0.16
CUDA:10.2.89
CUDNN:8.0.0.145
python:3.6.9
pytorch:1.5.0
onnx:1.4.1
looking forward to your replay thanks!

@spolisetty This is the log of my transfer to int8 use yolov2yolov2-int8-log.txt (80.5 KB) .yolov2/3 int8 tests are all without precision.

Hi @653576489,

Looks like you missed to share following files mentioned in readme again. We request you to please provide.
CALIB_IMG_DIR = ‘/home/ubuntu/yolo_related_back/calib_images
onnx_model_path = “/home/ubuntu/yolo_related_back/yolov2-int8darknet19baseline-416.onnx

Thank you.

@spolisetty onnx-trt.zip - Google Drive

Hi @653576489,

We could reproduce the issue. As mentioned previously, have you tried using setPrecision API to control the layer precision of layers in the model to see if you can identify a layer that might have an issue?

Thank you.