Skip to content

Instantly share code, notes, and snippets.

@Tob-iee
Last active October 25, 2023 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tob-iee/b003c9ba26046e0c4bdbdb7ebdde64de to your computer and use it in GitHub Desktop.
Save Tob-iee/b003c9ba26046e0c4bdbdb7ebdde64de to your computer and use it in GitHub Desktop.
Load DETR’s image processor, encode the images and reformat the annotations with the image processor.
# Load transformer image processor for DetrModel
checkpoint = "facebook/detr-resnet-50"
image_processor = AutoImageProcessor.from_pretrained(checkpoint)
# converting targets to DETR format & resizing + normalization both image & target
encoding=image_processor(images=images_trans, annotations=targets, return_tensors="pt")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment