엔드 투 엔드 GPU 최적화를 통한 빠르고 정확한 단일 단계 객체 감지.
ODTK는 다양한 백본과 감지 헤드를 갖춘 단일 샷 객체 검출기입니다. 이를 통해 성능/정확도 트레이드 오프가 가능합니다.
다음을 사용하여 엔드 투 엔드 GPU 처리에 최적화됩니다.
이 repo는 이제 회전 된 경계 박스 탐지를 지원합니다. --rotated-bbox 명령 사용 방법에 대한 자세한 내용은 회전 감지 훈련 및 회전 탐지 추론 문서를 참조하십시오.
경계 박스 주석은 [x, y, w, h, theta] 로 설명됩니다.
감지 파이프 라인을 통해 사용자는 대기 시간 진수 트레이드 오프 선호에 따라 특정 백본을 선택할 수 있습니다.
전체 교육 일정 후 Coco 2017 (Train/Val)의 ODTK Retinanet 모델 정확도 및 추론 대기 시간 및 FPS (초당 프레임). 추론 결과에는 1의 배치 크기에 대한 후 처리 후 경계 박스가 포함됩니다. FP16 Tensorrt 엔진에서 --with-dali 사용하여 --resize 800 에서 측정 된 추론.
| 등뼈 | 지도 @[iou = 0.50 : 0.95] | DGX1V에서의 교육 시간 | V100의 추론 대기 시간 FP16 | T4의 추론 대기 시간 INT8 | A100의 추론 대기 시간 FP16 | A100의 추론 대기 시간 INT8 |
|---|---|---|---|---|---|---|
| RESNET18FPN | 0.318 | 5 시간 | 14ms; 71 fps | 18ms; 56 fps | 9ms; 110 fps | 7ms; 141 fps |
| Mobilenetv2fpn | 0.333 | 14ms; 74 fps | 18ms; 56 fps | 9ms; 114 fps | 7ms; 138 fps | |
| RESNET34FPN | 0.343 | 6 시간 | 16ms; 64 fps | 20ms; 50fps | 10ms; 103 fps | 7ms; 142 fps |
| RESNET50FPN | 0.358 | 7 시간 | 18ms; 56 fps | 22ms; 45 fps | 11ms; 93 fps | 8ms; 129 fps |
| RESNET101FPN | 0.376 | 10 시간 | 22ms; 46 fps | 27ms; 37 fps | 13ms; 78 fps | 9ms; 117 fps |
| RESNET152FPN | 0.393 | 12 시간 | 26ms; 38 fps | 33ms; 31 FPS | 15ms; 66 fps | 10ms; 103 fps |
최상의 성능을 위해 최신 Pytorch NGC Docker 컨테이너를 사용하십시오. 이 저장소를 복제하고 자신의 이미지를 빌드하고 실행하십시오.
git clone https://github.com/nvidia/retinanet-examples
docker build -t odtk:latest retinanet-examples/
docker run --gpus all --rm --ipc=host -it odtk:latest 교육, 추론, 평가 및 모델 수출은 odtk 유틸리티를 통해 수행 할 수 있습니다. 매개 변수 목록을 포함한 자세한 내용은 교육 및 추론 문서를 참조하십시오.
미리 훈련 된 백본에서 Coco 2017에서 탐지 모델을 훈련하십시오.
odtk train retinanet_rn50fpn.pth --backbone ResNet50FPN
--images /coco/images/train2017/ --annotations /coco/annotations/instances_train2017.json
--val-images /coco/images/val2017/ --val-annotations /coco/annotations/instances_val2017.json데이터 세트에서 미리 훈련 된 모델을 미세 조정하십시오. 아래의 예에서는 JSON 주석과 함께 파스칼 VOC를 사용합니다.
odtk train model_mydataset.pth --backbone ResNet50FPN
--fine-tune retinanet_rn50fpn.pth
--classes 20 --iters 10000 --val-iters 1000 --lr 0.0005
--resize 512 --jitter 480 640 --images /voc/JPEGImages/
--annotations /voc/pascal_train2012.json --val-annotations /voc/pascal_val2012.json 참고 : 입력 이미지의 짧은면은 더 긴면이 max-size 보다 크지 않으면 resize 조정으로 크기가 크기가 작습니다. 훈련하는 동안 이미지는 무작위로 무작위로 jitter 범위 내에서 새로운 크기로 크기를 조정합니다.
Coco 2017에서 탐지 모델 평가 :
odtk infer retinanet_rn50fpn.pth --images /coco/images/val2017/ --annotations /coco/annotations/instances_val2017.json데이터 세트에서 추론 실행 :
odtk infer retinanet_rn50fpn.pth --images /dataset/val --output detections.json더 빠른 추론을 위해, 감지 모델을 최적화 된 FP16 Tensorrt 엔진으로 내 보냅니다.
odtk export model.pth engine.planCoco 2017에서 Tensorrt 백엔드로 모델을 평가하십시오.
odtk infer engine.plan --images /coco/images/val2017/ --annotations /coco/annotations/instances_val2017.json더 빠른 추론을 위해서는 INT8 교정을 수행하여 최적화 된 INT8 Tensorrt 엔진을 만듭니다.
odtk export model.pth engine.plan --int8 --calibration-images /coco/images/val2017/이렇게하면 교정을 수행 할 필요없이 나중에 동일한 모델에 대해 int8 tensorrt 엔진을 생성하는 데 사용할 수있는 int8calibrationtable 파일이 생성됩니다.
또는 캐시 된 교정 테이블을 사용하여 최적화 된 INT8 Tensorrt 엔진을 만듭니다.
odtk export model.pth engine.plan --int8 --calibration-table /path/to/INT8CalibrationTableRetinanet은 Coco JSON 형식의 주석을 지원합니다. 자신의 데이터 세트에서 주석을 JSON으로 변환 할 때 다음 항목이 필요합니다.
{
"images": [{
"id" : int,
"file_name" : str
}],
"annotations": [{
"id" : int,
"image_id" : int,
"category_id" : int,
"bbox" : [x, y, w, h] # all floats
"area": float # w * h. Required for validation scores
"iscrowd": 0 # Required for validation scores
}],
"categories": [{
"id" : int
]}
}
회전 된 탐지에 --rotated-bbox 플래그를 사용하는 경우, 주석에 플로트 theta 추가하십시오. 유효성 검사 점수를 얻으려면 segmentation 섹션도 작성해야합니다.
"bbox" : [x, y, w, h, theta] # all floats, where theta is measured in radians anti-clockwise from the x-axis.
"segmentation" : [[x1, y1, x2, y2, x3, y3, x4, y4]]
# Required for validation scores.
이것은 공식적인 NVIDIA 제품이 아닌 연구 프로젝트입니다.
이 지점은 Tensorrt 7을 사용합니다. Pytorch를 사용하여 모델을 훈련시키고 추론하는 경우 Tesla GPU (예 : V100, T4)에서 Tensorrt 엔진을 작성하는 경우이 분기를 사용해야합니다.
Jetson 장치 (예 : Jetson AGX Xavier)에 JetPack 버전 4.3에 모델을 배포하려면이 repo의 19.10 지점을 사용해야합니다.