Deformable DETR
Deformable DETR은 DETR의 조밀 교차 어텐션을 각 참조점 주변의 희소 다중 스케일 샘플링으로 대체하여 transformer 탐지기를 실용적으로 학습할 수 있게 했습니다. LibreYOLO는 탐지용으로 다섯 가지 크기를 제공하며 추론만 지원합니다.
- 작업
- detection
- 크기
- r50ss, r50ssdc5, r50, r50refine, r50twostage at 800 px
- 설치
pip install libreyolo- 지원 티어
- 추론 전용, v부터 지원. 예측, 검증, 내보내기만 지원합니다. 학습 기능은 적용되지 않습니다.
- 라이선스
- 코드 Apache-2.0, 가중치 Apache-2.0. 상업적 사용
설치
Deformable DETR에는 선택적 extra가 필요하지 않습니다. 순수 PyTorch 다중 스케일 deformable attention 코어를 사용하며 가져오는 모든 항목이 기본 설치에 포함됩니다.
pip install libreyololibreyolo[hub-kernels] 설치는 선택 사항입니다. kernels 패키지가 있으면 LibreYOLO는 런타임에 Hugging Face Hub에서 컴파일된 다중 스케일 deformable attention 커널을 가져와 순수 PyTorch 코어 대신 사용합니다. LIBREYOLO_HUB_KERNELS=0으로 다시 비활성화할 수 있습니다.
예측
처음 사용할 때 Hugging Face에서 가중치를 다운로드해 로컬에 캐시합니다.
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreDeformableDETRr50.pt")result = model(SAMPLE_IMAGE, save=True) for box in result.boxes: print(box.cls, box.conf, box.xyxy)libreyolo predict model=LibreDeformableDETRr50.pt source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/parkour.jpg save=True반환되는 Results 객체는 모든 계열이 반환하는 것과 같으므로 탐지기를 바꾸려면 한 줄만 변경하면 됩니다. conf와 max_det은 쿼리 선택을 필터링합니다. 디코더가 NMS 단계 없는 집합 예측기이므로 iou는 API 일관성을 위해 허용되지만 아무 효과가 없습니다. 소스, 스트리밍, 결과 처리는 예측을 참조합니다.
LibreYOLO에서 Deformable DETR은 추론 전용입니다. 업스트림은 헝가리안 매칭과 focal 분류 손실로 학습하지만 해당 레시피는 여기 구현되지 않았으므로 train()은 NotImplementedError를 발생시킵니다.
변형
공개된 구성을 포괄하는 체크포인트는 다섯 가지이며 모두 같은 입력 해상도를 사용합니다. r50ss는 어텐션을 단일 특징 스케일로 제한하고 r50ssdc5는 여기에 팽창 C5 백본 단계를 추가합니다. r50은 네 특징 맵 레벨에서 샘플링하는 기본 다중 스케일 구성입니다. r50refine은 디코더 계층 전반에 반복 바운딩 박스 정제를 추가하고 r50twostage는 학습된 쿼리 대신 인코더 출력에서 초기 영역 제안을 생성합니다.
검증
val()은 학습에 사용한 형식의 데이터셋을 대상으로 측정한 정밀도, 재현율, mAP 50, mAP 50-95를 포함하는 metrics/ 키 사전을 반환합니다.
from libreyolo import LibreYOLO model = LibreYOLO("LibreDeformableDETRr50.pt") # val()은 객체가 아닌 일반 dict를 반환합니다.metrics = model.val(data="my-dataset.yaml") print(metrics["metrics/mAP50-95"])print(metrics["metrics/mAP50"])print(metrics["metrics/precision"], metrics["metrics/recall"])libreyolo val model=LibreDeformableDETRr50.pt data=my-dataset.yaml내보내기
| 작업 | ONNX | TorchScript | ExecuTorch | TensorRT | OpenVINO | Paddle | MNN | RKNN | ncnn | TFLite | CoreML | Core AI |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Detection | Detection to ONNX: 지원함 | Detection to TorchScript: 지원함 | Detection to ExecuTorch: 지원함 | Detection to TensorRT: 지원함 | Detection to OpenVINO: 지원함 | Detection to Paddle: 지원하지 않음 | Detection to MNN: 지원하지 않음 | Detection to RKNN: 지원하지 않음 | Detection to ncnn: 지원하지 않음 | Detection to TFLite: 지원하지 않음 | Detection to CoreML: 지원하지 않음 | Detection to Core AI: 지원하지 않음 |
내보낸 아티팩트는 파일 접미사에 따라 LibreYOLO()로 다시 불러옵니다. 따라서 .onnx 또는 .engine 파일은 체크포인트처럼 동작하며 동일한 Results를 반환합니다. 각 형식이 받는 인수는 내보내기에 나와 있습니다.
from libreyolo import LibreYOLO model = LibreYOLO("LibreDeformableDETRr50.pt")model.export(format="onnx", imgsz=800)model.export(format="tensorrt", imgsz=800, half=True)libreyolo export model=LibreDeformableDETRr50.pt format=onnx imgsz=800libreyolo export model=LibreDeformableDETRr50.pt format=tensorrt imgsz=800 half=Truefrom libreyolo import LibreYOLO, SAMPLE_IMAGE # 팩토리는 파일 접미사에 따라 라우팅하므로 내보낸 아티팩트도# 다른 체크포인트처럼 불러와 동일한 Results 객체를 반환합니다.model = LibreYOLO("LibreDeformableDETRr50.onnx")result = model(SAMPLE_IMAGE) print(result.boxes.xyxy)체크포인트
이 계열에 공개된 모든 가중치 파일입니다.
| 파일 | 입력(px) | 가중치 라이선스 |
|---|---|---|
| Detection | ||
| LibreDeformableDETRr50ss.pt | 800 | apache-2.0 |
| LibreDeformableDETRr50ssdc5.pt | 800 | apache-2.0 |
| LibreDeformableDETRr50.pt | 800 | apache-2.0 |
| LibreDeformableDETRr50twostage.pt | 800 | apache-2.0 |
| LibreDeformableDETRr50refine.pt | 800 | apache-2.0 |
위의 모든 파일은 현재 LibreYOLO 조직에 있으며 처음 사용할 때 내려받습니다.
라이선스
내려받는 특정 가중치의 Hugging Face 저장소에서 라이선스를 확인하십시오. LibreYOLO 조직의 모든 체크포인트에는 라이선스가 있으며 한 계열 안에서도 항상 같지는 않습니다. 해당 저장소가 신뢰할 수 있는 기준입니다. 아래 요약은 이 페이지를 마지막으로 검증했을 때 적용된 내용을 설명합니다.
관련 라이선스에 관한 설명이며 법률 자문이 아닙니다. 상업적으로 중요한 사안이라면 라이선스를 직접 읽고 별도의 법률 자문을 받으십시오.
- 원작
- Deformable DETR, SenseTime
- 업스트림 라이선스
- Apache-2.0
- LibreYOLO 코드
- MIT
- 가중치
- Apache-2.0, huggingface.co/LibreYOLO에 다시 게시됨
- 해석
- Apache-2.0 is a permissive license, so these weights can be used in commercial and closed-source products. It asks you to keep its license text and attribution notices with any copy of the weights you redistribute, and it grants a patent license. It places no obligation on your own application code, and weights you train yourself on your own data are yours. The five checkpoints are converted from SenseTime's own Hugging Face mirrors, each of which declares apache-2.0 in its model card; that declaration, not the original repository's Google Drive release links, is the redistribution basis.
인용
@article{zhu2020deformable,
title={Deformable DETR: Deformable Transformers for End-to-End Object Detection},
author={Zhu, Xizhou and Su, Weijie and Lu, Lewei and Li, Bin and Wang, Xiaogang and Dai, Jifeng},
journal={arXiv preprint arXiv:2010.04159},
year={2020}
}github.com/fundamentalvision/Deformable-DETR#citing-deformable-detr에 있는 저자의 인용 블록에서 복사했습니다.