Add Image Processor Fast RT-DETR (#34354)

* add fast image processor rtdetr

* add gpu/cpu test and fix docstring

* remove prints

* add to doc

* nit docstring

* avoid iterating over images/annotations several times

* change torch typing

* Add image processor fast documentation
This commit is contained in:
Yoni Gozlan
2024-10-30 13:49:47 -04:00
committed by GitHub
parent 9f06fb0505
commit 48872fd6ae
12 changed files with 1251 additions and 317 deletions

View File

@@ -677,7 +677,7 @@ class DetrImageProcessingTest(AnnotationFormatTestMixin, ImageProcessingTestMixi
target = {"image_id": 39769, "annotations": target}
processor = self.image_processor_list[1].from_pretrained("facebook/detr-resnet-50")
processor = self.image_processor_list[1]()
# 1. run processor on CPU
encoding_cpu = processor(images=image, annotations=target, return_tensors="pt", device="cpu")
# 2. run processor on GPU
@@ -734,7 +734,7 @@ class DetrImageProcessingTest(AnnotationFormatTestMixin, ImageProcessingTestMixi
masks_path = pathlib.Path("./tests/fixtures/tests_samples/COCO/coco_panoptic")
processor = self.image_processor_list[1].from_pretrained("facebook/detr-resnet-50-panoptic")
processor = self.image_processor_list[1](format="coco_panoptic")
# 1. run processor on CPU
encoding_cpu = processor(
images=image, annotations=target, masks_path=masks_path, return_tensors="pt", device="cpu"